Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to deploy specific preinstrumented jars to maven #7602

Merged
merged 1 commit into from
Sep 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 13 additions & 4 deletions preinstrumented/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ task instrumentAll {
doLast {
def androidAllMavenLocal = "${System.getProperty('user.home')}/.m2/repository/org/robolectric/android-all"

AndroidSdk.ALL_SDKS.each { androidSdk ->
sdksToInstrument().each { androidSdk ->
println("Instrumenting ${androidSdk.coordinates}")
def inputPath = "${androidAllMavenLocal}/${androidSdk.version}/${androidSdk.jarFileName}"
def outputPath = "${buildDir}/${androidSdk.preinstrumentedJarFileName}"
Expand Down Expand Up @@ -55,7 +55,7 @@ if (System.getenv('PUBLISH_PREINSTRUMENTED_JARS') == "true") {

publishing {
publications {
AndroidSdk.ALL_SDKS.each { androidSdk ->
sdksToInstrument().each { androidSdk ->
"sdk${androidSdk.apiLevel}"(MavenPublication) {
artifact "${buildDir}/${androidSdk.preinstrumentedJarFileName}"
artifactId 'android-all-instrumented'
Expand Down Expand Up @@ -105,14 +105,23 @@ if (System.getenv('PUBLISH_PREINSTRUMENTED_JARS') == "true") {
}

signing {
AndroidSdk.ALL_SDKS.each { androidSdk ->
sdksToInstrument().each { androidSdk ->
sign publishing.publications."sdk${androidSdk.apiLevel}"
}
}
}

def sdksToInstrument() {
var result = AndroidSdk.ALL_SDKS
var sdkFilter = (System.getenv('PREINSTRUMENTED_SDK_VERSIONS') ?: "").split(",").collect { it as Integer }
if (sdkFilter.size > 0) {
result = result.findAll { sdkFilter.contains(it.apiLevel) }
}
return result
}

clean.doFirst {
AndroidSdk.ALL_SDKS.each { androidSdk ->
delete "${buildDir}/${androidSdk.preinstrumentedJarFileName}"
}
}
}