|
| 1 | +import internal.android |
| 2 | +import java.util.Properties |
| 3 | + |
| 4 | +plugins { |
| 5 | + id("maven-publish") |
| 6 | + id("signing") |
| 7 | +} |
| 8 | + |
| 9 | +android { |
| 10 | + publishing { |
| 11 | + singleVariant("release") { |
| 12 | + withSourcesJar() |
| 13 | + } |
| 14 | + } |
| 15 | +} |
| 16 | + |
| 17 | +private val publishProperties by lazy { |
| 18 | + rootProject.file("gradle/publish.properties").inputStream() |
| 19 | + .use { Properties().apply { load(it) } } |
| 20 | +} |
| 21 | +val libraryName by lazy { |
| 22 | + val properties = project.file("library.properties").inputStream() |
| 23 | + .use { Properties().apply { load(it) } } |
| 24 | + properties.getProperty("lib_name") |
| 25 | +} |
| 26 | + |
| 27 | +publishing { |
| 28 | + publications.create<MavenPublication>("release") { |
| 29 | + artifactId = libraryName |
| 30 | + |
| 31 | + afterEvaluate { from(components["release"]) } |
| 32 | + |
| 33 | + pom { |
| 34 | + name = libraryName |
| 35 | + description = provider { project.description } |
| 36 | + url = publishProperties.getProperty("home_page") |
| 37 | + |
| 38 | + licenses { |
| 39 | + license { |
| 40 | + name = publishProperties.getProperty("license_name") |
| 41 | + url = publishProperties.getProperty("license_url") |
| 42 | + } |
| 43 | + } |
| 44 | + |
| 45 | + developers { |
| 46 | + developer { |
| 47 | + id = "Zestxx" |
| 48 | + name = "Roman Choriev" |
| 49 | + email = "r.choryev@redmadrobot.com" |
| 50 | + } |
| 51 | + } |
| 52 | + |
| 53 | + contributors { |
| 54 | + contributor { |
| 55 | + name = "Osip Fatkullin" |
| 56 | + email = "o.fatkullin@redmadrobot.com" |
| 57 | + } |
| 58 | + contributor { |
| 59 | + name = "Alexandr Anisimov" |
| 60 | + email = "PilotOfSparrow@gmail.com" |
| 61 | + } |
| 62 | + contributor { |
| 63 | + name = "Dmitry trabo" |
| 64 | + email = "dtrabo@gmail.com" |
| 65 | + } |
| 66 | + } |
| 67 | + |
| 68 | + scm { |
| 69 | + connection = "scm:git:git://github.com/RedMadRobot/debug-panel-android.git" |
| 70 | + developerConnection = "scm:git:ssh://github.com/RedMadRobot/debug-panel-android.git" |
| 71 | + url = publishProperties.getProperty("home_page") |
| 72 | + } |
| 73 | + } |
| 74 | + } |
| 75 | + |
| 76 | + repositories { |
| 77 | + mavenLocal() |
| 78 | + maven { |
| 79 | + name = "OSSRH" |
| 80 | + url = project.uri(publishProperties.getProperty("sonatype_repo")) |
| 81 | + |
| 82 | + credentials { |
| 83 | + username = System.getenv("OSSRH_USER") |
| 84 | + password = System.getenv("OSSRH_PASSWORD") |
| 85 | + } |
| 86 | + } |
| 87 | + } |
| 88 | +} |
| 89 | + |
| 90 | +afterEvaluate { |
| 91 | + signing { |
| 92 | + useGpgCmd() |
| 93 | + sign(publishing.publications["release"]) |
| 94 | + } |
| 95 | +} |
0 commit comments