Skip to content

Commit

Permalink
Update the maven publish plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
madeye committed May 10, 2021
1 parent 8416d88 commit 37a1773
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 30 deletions.
62 changes: 54 additions & 8 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,26 +1,72 @@
plugins {
id("com.android.library")
id("com.vanniktech.maven.publish")
id("maven-publish")
kotlin("android")
id("kotlin-parcelize")
signing
}

setupCommon()

android {
defaultConfig {
versionCode = findProperty("VERSION_CODE").toString().toInt()
versionName = findProperty("VERSION_NAME").toString()
versionCode = 10
versionName = "2.0.1"
}

lintOptions.informational("GradleDependency")
}

mavenPublish.targets.getByName("uploadArchives") {
releaseRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
snapshotRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
repositoryUsername = findProperty("NEXUS_USERNAME").toString()
repositoryPassword = findProperty("NEXUS_PASSWORD").toString()
afterEvaluate {
publishing {
publications {
create<MavenPublication>("release") {
from(components["release"])

groupId = "com.github.shadowsocks"
artifactId = "plugin"
version = android.defaultConfig.versionName

pom {
name.set("Shadowsocks Plugin")
description.set("SIP003 plugin for Shadowsocks")
url.set("http://www.example.com/library")
licenses {
license {
name.set("The GNU General Public License v3.0")
url.set("https://www.gnu.org/licenses/gpl-3.0.html")
}
}
developers {
developer {
id.set("Mygod")
name.set("Mygod Studio")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/shadowsocks/shadowsocks-android.git")
developerConnection.set("scm:git:git://github.com/shadowsocks/shadowsocks-android.git")
url.set("https://github.com/shadowsocks/shadowsocks-android")
}
}
}
}
repositories {
maven {
val releaseRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
val snapshotRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
credentials {
username = findProperty("NEXUS_USERNAME").toString()
password = findProperty("NEXUS_PASSWORD").toString()
}
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotRepositoryUrl else releaseRepositoryUrl)
}
}
}
signing {
sign(publishing.publications["release"])
}
}

dependencies {
Expand Down
22 changes: 0 additions & 22 deletions plugin/gradle.properties

This file was deleted.

0 comments on commit 37a1773

Please sign in to comment.