Skip to content

Commit 37a1773

Browse files
committed
Update the maven publish plugin
1 parent 8416d88 commit 37a1773

File tree

2 files changed

+54
-30
lines changed

2 files changed

+54
-30
lines changed

plugin/build.gradle.kts

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,72 @@
11
plugins {
22
id("com.android.library")
3-
id("com.vanniktech.maven.publish")
3+
id("maven-publish")
44
kotlin("android")
55
id("kotlin-parcelize")
6+
signing
67
}
78

89
setupCommon()
910

1011
android {
1112
defaultConfig {
12-
versionCode = findProperty("VERSION_CODE").toString().toInt()
13-
versionName = findProperty("VERSION_NAME").toString()
13+
versionCode = 10
14+
versionName = "2.0.1"
1415
}
1516

1617
lintOptions.informational("GradleDependency")
1718
}
1819

19-
mavenPublish.targets.getByName("uploadArchives") {
20-
releaseRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
21-
snapshotRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
22-
repositoryUsername = findProperty("NEXUS_USERNAME").toString()
23-
repositoryPassword = findProperty("NEXUS_PASSWORD").toString()
20+
afterEvaluate {
21+
publishing {
22+
publications {
23+
create<MavenPublication>("release") {
24+
from(components["release"])
25+
26+
groupId = "com.github.shadowsocks"
27+
artifactId = "plugin"
28+
version = android.defaultConfig.versionName
29+
30+
pom {
31+
name.set("Shadowsocks Plugin")
32+
description.set("SIP003 plugin for Shadowsocks")
33+
url.set("http://www.example.com/library")
34+
licenses {
35+
license {
36+
name.set("The GNU General Public License v3.0")
37+
url.set("https://www.gnu.org/licenses/gpl-3.0.html")
38+
}
39+
}
40+
developers {
41+
developer {
42+
id.set("Mygod")
43+
name.set("Mygod Studio")
44+
email.set("[email protected]")
45+
}
46+
}
47+
scm {
48+
connection.set("scm:git:git://github.com/shadowsocks/shadowsocks-android.git")
49+
developerConnection.set("scm:git:git://github.com/shadowsocks/shadowsocks-android.git")
50+
url.set("https://github.com/shadowsocks/shadowsocks-android")
51+
}
52+
}
53+
}
54+
}
55+
repositories {
56+
maven {
57+
val releaseRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
58+
val snapshotRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
59+
credentials {
60+
username = findProperty("NEXUS_USERNAME").toString()
61+
password = findProperty("NEXUS_PASSWORD").toString()
62+
}
63+
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotRepositoryUrl else releaseRepositoryUrl)
64+
}
65+
}
66+
}
67+
signing {
68+
sign(publishing.publications["release"])
69+
}
2470
}
2571

2672
dependencies {

plugin/gradle.properties

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)