Skip to content

Commit 57eb430

Browse files
committed
Migrate from bintray to nexus
Add maven configuration for publishing.
1 parent 5c83766 commit 57eb430

File tree

3 files changed

+42
-48
lines changed

3 files changed

+42
-48
lines changed

build.gradle

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,29 @@ buildscript {
2222
'buildTools' : '30.0.3',
2323
'appcompat' : '1.2.0',
2424
'constraintlayout': '2.0.4',
25-
'kotlin' : '1.5.0',
25+
'kotlin' : '1.5.10',
2626
'viewpager2' : '1.0.0'
2727
]
2828

2929
repositories {
3030
mavenCentral()
3131
google()
32-
jcenter()
3332
}
3433

3534
dependencies {
3635
classpath 'com.android.tools.build:gradle:7.1.0-alpha02'
37-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
3836
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
3937
}
4038
}
4139

40+
plugins {
41+
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
42+
}
43+
4244
allprojects {
4345
repositories {
4446
mavenCentral()
4547
google()
46-
jcenter()
4748
}
4849
}
4950

@@ -80,4 +81,33 @@ ext {
8081
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
8182
licenseDistribution = 'repo'
8283
allLicenses = ["Apache-2.0"]
84+
85+
publication = 'local.properties'
86+
87+
ext["signing.keyId"] = ''
88+
ext["signing.password"] = ''
89+
ext["signing.secretKeyRingFile"] = ''
90+
91+
ossrhUsername = ''
92+
ossrhPassword = ''
93+
sonatypeStagingProfileId = ''
94+
}
95+
96+
apply plugin: 'io.github.gradle-nexus.publish-plugin'
97+
98+
File publish = project.rootProject.file("${publication}")
99+
if (publish.exists()) {
100+
Properties properties = new Properties()
101+
new FileInputStream(publish).withCloseable { is -> properties.load(is) }
102+
properties.each { name, value -> ext[name] = value }
103+
}
104+
105+
nexusPublishing {
106+
repositories {
107+
sonatype {
108+
username = ossrhUsername
109+
password = ossrhPassword
110+
stagingProfileId = sonatypeStagingProfileId
111+
}
112+
}
83113
}

dynamic-motion/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ dependencies {
3939
api "androidx.viewpager2:viewpager2:${versions.viewpager2}"
4040
}
4141

42-
if (project.rootProject.file('local.properties').exists()) {
43-
apply from: 'bintray.gradle'
42+
if (project.rootProject.file("${publication}").exists()) {
43+
apply from: 'maven.gradle'
4444
}
4545

4646
task generateJavadoc() {

dynamic-motion/bintray.gradle renamed to dynamic-motion/maven.gradle

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
apply plugin: 'maven-publish'
18-
apply plugin: 'com.jfrog.bintray'
18+
apply plugin: 'signing'
1919

2020
group = mavenGroup
2121
version = mavenVersion
@@ -105,48 +105,12 @@ publishing {
105105
}
106106
}
107107

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

112-
bintray {
113-
user = properties.getProperty("bintray.user")
114-
key = properties.getProperty("bintray.key")
115-
116-
filesSpec {
117-
from "$buildDir/publications/library/pom-default.xml"
118-
into "$mavenDir/$mavenArtifactId/$mavenVersion/"
119-
rename { String fileName ->
120-
"${mavenArtifactId}-${mavenVersion}.pom"
121-
}
122-
}
123-
124-
configurations = ['archives']
125-
126-
pkg {
127-
repo = mavenRepo
128-
name = mavenArtifactId
129-
desc = projectDesc
130-
websiteUrl = siteUrl
131-
vcsUrl = "${gitUrl}.git"
132-
issueTrackerUrl = issueUrl
133-
licenses = allLicenses
134-
publish = true
135-
publicDownloadNumbers = true
136-
137-
githubRepo = githubUrl
138-
139-
version {
140-
name = mavenVersion
141-
desc = versionDesc
142-
released = new Date()
143-
144-
gpg {
145-
sign = true
146-
passphrase = properties.getProperty("bintray.passphrase")
147-
}
148-
}
149-
}
112+
signing {
113+
sign publishing.publications
150114
}
151115

152116
afterEvaluate { project ->

0 commit comments

Comments
 (0)