|
| 1 | +apply plugin: 'com.android.library' |
| 2 | +apply plugin: 'kotlin-android' |
| 3 | +apply plugin: 'maven-publish' |
| 4 | + |
| 5 | + |
| 6 | +archivesBaseName = 'groupie-ktx' |
| 7 | + |
| 8 | + |
| 9 | +android { |
| 10 | + compileSdkVersion rootProject.sdkVersion |
| 11 | + |
| 12 | + |
| 13 | + defaultConfig { |
| 14 | + minSdkVersion rootProject.minimumSdkVersion |
| 15 | + targetSdkVersion rootProject.sdkVersion |
| 16 | + versionCode 20 |
| 17 | + versionName "1.0" |
| 18 | + } |
| 19 | + |
| 20 | + signingConfigs { |
| 21 | + release { |
| 22 | + } |
| 23 | + } |
| 24 | + buildTypes { |
| 25 | + release { |
| 26 | + signingConfig signingConfigs.release |
| 27 | + minifyEnabled false |
| 28 | + } |
| 29 | + } |
| 30 | + |
| 31 | +} |
| 32 | + |
| 33 | +dependencies { |
| 34 | + implementation project(':library') |
| 35 | + implementation "androidx.recyclerview:recyclerview:1.2.1" |
| 36 | +} |
| 37 | + |
| 38 | +tasks.withType(Javadoc).all { |
| 39 | + enabled = false |
| 40 | +} |
| 41 | + |
| 42 | + |
| 43 | +group = "com.github.lisawray.groupie" |
| 44 | +version = "2.10.1" |
| 45 | + |
| 46 | +task javadoc(type: Javadoc) { |
| 47 | + configurations.implementation.canBeResolved(true) |
| 48 | + configurations.api.canBeResolved(true) |
| 49 | + |
| 50 | + failOnError false |
| 51 | + |
| 52 | + source = android.sourceSets.main.java.srcDirs |
| 53 | + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) |
| 54 | + //destinationDir = file("../javadoc/") |
| 55 | + classpath += configurations.api |
| 56 | +} |
| 57 | + |
| 58 | +task sourcesJar(type: Jar) { |
| 59 | + from android.sourceSets.main.java.srcDirs |
| 60 | + archiveClassifier = "sources" |
| 61 | +} |
| 62 | + |
| 63 | +task javadocJar(type: Jar, dependsOn: javadoc) { |
| 64 | + classifier = 'javadoc' |
| 65 | + from javadoc.destinationDir |
| 66 | +} |
| 67 | + |
| 68 | +artifacts { |
| 69 | + archives sourcesJar |
| 70 | + archives javadocJar |
| 71 | +} |
| 72 | + |
| 73 | +// Because the components are created only during the afterEvaluate phase, you must |
| 74 | +// configure your publications using the afterEvaluate() lifecycle method. |
| 75 | +afterEvaluate { |
| 76 | + publishing { |
| 77 | + publications { |
| 78 | + // Creates a Maven publication called "release". |
| 79 | + release(MavenPublication) { |
| 80 | + // Applies the component for the release build variant. |
| 81 | + from components.release |
| 82 | + artifact(sourcesJar) |
| 83 | + |
| 84 | + // You can then customize attributes of the publication as shown below. |
| 85 | + groupId = 'com.github.lisawray.groupie' |
| 86 | + artifactId = 'groupie-ktx' |
| 87 | + version = '2.10.1' |
| 88 | + |
| 89 | + pom.withXml { |
| 90 | + def dependenciesNode = (asNode().get("dependencies") as groovy.util.NodeList).get(0) as groovy.util.Node |
| 91 | + def configurationNames = ["implementation", "api"] |
| 92 | + |
| 93 | + configurationNames.forEach { configurationName -> |
| 94 | + configurations[configurationName].allDependencies.forEach { |
| 95 | + if (it.group != null && it.version != "unspecified") { |
| 96 | + def dependencyNode = dependenciesNode.appendNode("dependency") |
| 97 | + dependencyNode.appendNode("groupId", it.group) |
| 98 | + dependencyNode.appendNode("artifactId", it.name) |
| 99 | + dependencyNode.appendNode("version", it.version) |
| 100 | + // dependencyNode.appendNode("scope", configurationName) |
| 101 | + } |
| 102 | + } |
| 103 | + } |
| 104 | + } |
| 105 | + } |
| 106 | + } |
| 107 | + } |
| 108 | +} |
| 109 | + |
| 110 | + |
| 111 | + |
0 commit comments