|
| 1 | +apply plugin: 'maven-publish' |
| 2 | + |
| 3 | +def LIB_GROUP_ID = 'com.github.triniwiz' |
| 4 | +def LIB_ARTIFACT_ID = 'canvas' |
| 5 | +def LIB_VERSION = '0.9.16' |
| 6 | + |
| 7 | +task sourceJar(type: Jar) { |
| 8 | + from android.sourceSets.main.java.srcDirs |
| 9 | + classifier "sources" |
| 10 | +} |
| 11 | + |
| 12 | +def properties = new Properties() |
| 13 | +properties.load(new FileInputStream(project.rootProject.file('local.properties'))) |
| 14 | + |
| 15 | +afterEvaluate { |
| 16 | + publishing { |
| 17 | + repositories { |
| 18 | + maven { |
| 19 | + name = "GithubPackages" |
| 20 | + url = uri("https://maven.pkg.github.com/NativeScript/canvas") |
| 21 | + credentials { |
| 22 | + username = properties.getProperty("GITHUB_USER") |
| 23 | + password = properties.getProperty("GITHUB_PERSONAL_ACCESS_TOKEN") |
| 24 | + } |
| 25 | + } |
| 26 | + maven { |
| 27 | + name = 'CustomMavenRepo' |
| 28 | + url = "file://${buildDir}/repo" |
| 29 | + } |
| 30 | + } |
| 31 | + publications { |
| 32 | + canvas(MavenPublication) { |
| 33 | + groupId LIB_GROUP_ID |
| 34 | + artifactId LIB_ARTIFACT_ID |
| 35 | + version LIB_VERSION |
| 36 | + artifact("$buildDir/outputs/aar/canvas-release.aar") |
| 37 | + artifact(sourceJar) |
| 38 | + |
| 39 | + pom.withXml { |
| 40 | + def dependenciesNode = asNode().appendNode('dependencies') |
| 41 | + |
| 42 | + //Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each |
| 43 | + configurations.api.allDependencies.each { |
| 44 | + def dependencyNode = dependenciesNode.appendNode('dependency') |
| 45 | + dependencyNode.appendNode('groupId', it.group) |
| 46 | + dependencyNode.appendNode('artifactId', it.name) |
| 47 | + dependencyNode.appendNode('version', it.version) |
| 48 | + } |
| 49 | + } |
| 50 | + } |
| 51 | + } |
| 52 | + } |
| 53 | +} |
0 commit comments