Skip to content

Instantly share code, notes, and snippets.

@rockaport
Created September 12, 2017 00:17
Show Gist options
  • Save rockaport/65f9476f8858ee983de03f4b788dc3ad to your computer and use it in GitHub Desktop.
Save rockaport/65f9476f8858ee983de03f4b788dc3ad to your computer and use it in GitHub Desktop.
task sourceJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier "source"
}
android.libraryVariants.all { variant ->
variant.outputs.all { output ->
println variant.name + " " + output.name
publishing.publications.create(variant.name, MavenPublication) {
artifact sourceJar
artifact source: output.outputFile, classifier: output.name
configurations.all {
println it.name
println it.allDependencies
}
}
}
}
tasks.all { task ->
if (task instanceof AbstractPublishToMaven) {
task.dependsOn assemble
}
}
//publishing {
// publications {
// aar(MavenPublication) {
// artifact Jar {
// from android.sourceSets.main.java.srcDirs
// classifier "source"
// }
// artifact("$buildDir/outputs/aar/library-release.aar")
// }
// }
// repositories {
// maven {
// // change to point to your repo, e.g. http://my.org/repo
// url "s3://"
// credentials(AwsCredentials) {
// accessKey ""
// secretKey ""
// }
// }
// }
//}
//
//task printShit {
// doLast {
// android.libraryVariants.all { variant ->
// variant.outputs.all { output ->
// println output.outputFile.absolutePath
//// println groovy.json.JsonOutput.toJson(out)
// }
// }
// }
//}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment