|
| 1 | +apply plugin: 'maven-publish' |
| 2 | +apply plugin: 'signing' |
| 3 | + |
| 4 | +task androidSourcesJar(type: Jar) { |
| 5 | + archiveClassifier.set('sources') |
| 6 | + if (project.plugins.findPlugin("com.android.library")) { |
| 7 | + // For Android libraries |
| 8 | + from android.sourceSets.main.java.srcDirs |
| 9 | + from android.sourceSets.main.kotlin.srcDirs |
| 10 | + } else { |
| 11 | + // For pure Kotlin libraries, in case you have them |
| 12 | + from sourceSets.main.java.srcDirs |
| 13 | + from sourceSets.main.kotlin.srcDirs |
| 14 | + } |
| 15 | +} |
| 16 | + |
| 17 | +artifacts { |
| 18 | + archives androidSourcesJar |
| 19 | +} |
| 20 | + |
| 21 | +group = PUBLISH_GROUP_ID |
| 22 | +version = PUBLISH_VERSION |
| 23 | + |
| 24 | +afterEvaluate { |
| 25 | + publishing { |
| 26 | + publications { |
| 27 | + release(MavenPublication) { |
| 28 | + // The coordinates of the library, being set from variables that |
| 29 | + // we'll set up later |
| 30 | + groupId PUBLISH_GROUP_ID |
| 31 | + artifactId PUBLISH_ARTIFACT_ID |
| 32 | + version PUBLISH_VERSION |
| 33 | + |
| 34 | + // Two artifacts, the `aar` (or `jar`) and the sources |
| 35 | + if (project.plugins.findPlugin("com.android.library")) { |
| 36 | + from components.release |
| 37 | + } else { |
| 38 | + from components.java |
| 39 | + } |
| 40 | + |
| 41 | + artifact androidSourcesJar |
| 42 | + |
| 43 | + // Mostly self-explanatory metadata |
| 44 | + pom { |
| 45 | + name = PUBLISH_ARTIFACT_ID |
| 46 | + description = 'BottomSheetDialog wrapper for Jetpack Compose' |
| 47 | + url = 'https://github.com/holixfactory/bottomsheetdialog-compose' |
| 48 | + licenses { |
| 49 | + license { |
| 50 | + name = 'MIT License' |
| 51 | + url = 'https://github.com/holixfactory/bottomsheetdialog-compose/blob/main/LICENSE' |
| 52 | + } |
| 53 | + } |
| 54 | + developers { |
| 55 | + developer { |
| 56 | + id = 'workspace' |
| 57 | + name = 'Kimin Ryu' |
| 58 | + |
| 59 | + } |
| 60 | + developer { |
| 61 | + id = 'Heyday7' |
| 62 | + name = 'Taehyup Ko' |
| 63 | + |
| 64 | + } |
| 65 | + } |
| 66 | + scm { |
| 67 | + connection = 'scm:git:github.com/holixfactory/bottomsheetdialog-compose.git' |
| 68 | + developerConnection = 'scm:git:ssh://github.com/holixfactory/bottomsheetdialog-compose.git' |
| 69 | + url = 'https://github.com/holixfactory/bottomsheetdialog-compose/tree/main' |
| 70 | + } |
| 71 | + } |
| 72 | + } |
| 73 | + } |
| 74 | + } |
| 75 | +} |
| 76 | + |
| 77 | +signing { |
| 78 | + useInMemoryPgpKeys( |
| 79 | + rootProject.ext["signing.keyId"], |
| 80 | + rootProject.ext["signing.key"], |
| 81 | + rootProject.ext["signing.password"], |
| 82 | + ) |
| 83 | + sign publishing.publications |
| 84 | +} |
0 commit comments