Skip to content

Commit

Permalink
Migrate from bintray to nexus
Browse files Browse the repository at this point in the history
Add maven configuration for publishing.
  • Loading branch information
pranavpandey committed Jun 15, 2021
1 parent 5c83766 commit 57eb430
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 48 deletions.
38 changes: 34 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,29 @@ buildscript {
'buildTools' : '30.0.3',
'appcompat' : '1.2.0',
'constraintlayout': '2.0.4',
'kotlin' : '1.5.0',
'kotlin' : '1.5.10',
'viewpager2' : '1.0.0'
]

repositories {
mavenCentral()
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.0-alpha02'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
}
}

plugins {
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}

allprojects {
repositories {
mavenCentral()
google()
jcenter()
}
}

Expand Down Expand Up @@ -80,4 +81,33 @@ ext {
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
licenseDistribution = 'repo'
allLicenses = ["Apache-2.0"]

publication = 'local.properties'

ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.secretKeyRingFile"] = ''

ossrhUsername = ''
ossrhPassword = ''
sonatypeStagingProfileId = ''
}

apply plugin: 'io.github.gradle-nexus.publish-plugin'

File publish = project.rootProject.file("${publication}")
if (publish.exists()) {
Properties properties = new Properties()
new FileInputStream(publish).withCloseable { is -> properties.load(is) }
properties.each { name, value -> ext[name] = value }
}

nexusPublishing {
repositories {
sonatype {
username = ossrhUsername
password = ossrhPassword
stagingProfileId = sonatypeStagingProfileId
}
}
}
4 changes: 2 additions & 2 deletions dynamic-motion/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ dependencies {
api "androidx.viewpager2:viewpager2:${versions.viewpager2}"
}

if (project.rootProject.file('local.properties').exists()) {
apply from: 'bintray.gradle'
if (project.rootProject.file("${publication}").exists()) {
apply from: 'maven.gradle'
}

task generateJavadoc() {
Expand Down
48 changes: 6 additions & 42 deletions dynamic-motion/bintray.gradle → dynamic-motion/maven.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'signing'

group = mavenGroup
version = mavenVersion
Expand Down Expand Up @@ -105,48 +105,12 @@ publishing {
}
}

// Bintray
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
ext["signing.keyId"] = rootProject.ext["signing.keyId"]
ext["signing.password"] = rootProject.ext["signing.password"]
ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"]

bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.key")

filesSpec {
from "$buildDir/publications/library/pom-default.xml"
into "$mavenDir/$mavenArtifactId/$mavenVersion/"
rename { String fileName ->
"${mavenArtifactId}-${mavenVersion}.pom"
}
}

configurations = ['archives']

pkg {
repo = mavenRepo
name = mavenArtifactId
desc = projectDesc
websiteUrl = siteUrl
vcsUrl = "${gitUrl}.git"
issueTrackerUrl = issueUrl
licenses = allLicenses
publish = true
publicDownloadNumbers = true

githubRepo = githubUrl

version {
name = mavenVersion
desc = versionDesc
released = new Date()

gpg {
sign = true
passphrase = properties.getProperty("bintray.passphrase")
}
}
}
signing {
sign publishing.publications
}

afterEvaluate { project ->
Expand Down

0 comments on commit 57eb430

Please sign in to comment.