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

Building animal sniffer signatures directly from android corelib #5973

Merged
merged 8 commits into from
Nov 20, 2023
52 changes: 52 additions & 0 deletions animal-sniffer-signature/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import ru.vyarus.gradle.plugin.animalsniffer.info.SignatureInfoTask
import ru.vyarus.gradle.plugin.animalsniffer.signature.BuildSignatureTask

plugins {
id("otel.java-conventions")
id("ru.vyarus.animalsniffer")
}

description = "Build tool to generate the Animal Sniffer Android signature"
otelJava.moduleName.set("io.opentelemetry.internal.animalsniffer")

val signatureJar = configurations.create("signatureJar") {
isCanBeConsumed = false
isCanBeResolved = false
}
val signatureJarClasspath = configurations.create("signatureJarClasspath") {
isCanBeConsumed = false
isCanBeResolved = true
extendsFrom(signatureJar)
}
val generatedSignature = configurations.create("generatedSignature") {
isCanBeConsumed = true
isCanBeResolved = false
}
configurations.add(signatureJar)
configurations.add(signatureJarClasspath)
configurations.add(generatedSignature)

dependencies {
signature("com.toasttab.android:gummy-bears-api-21:0.6.1@signature")
signatureJar("com.android.tools:desugar_jdk_libs")
}

val signatureSimpleName = "android.signature"
val signatureBuilderTask = tasks.register("buildSignature", BuildSignatureTask::class.java) {
files(signatureJarClasspath) // All the jar files here will be added to the signature file.
signatures(configurations.signature) // We'll extend from the existing signatures added to this config.
outputName = signatureSimpleName // Name for the generated signature file.
}

// Exposing the "generatedSignature" consumable config to be used in other subprojects
artifacts {
add("generatedSignature", project.provider { File(signatureBuilderTask.get().outputs.files.singleFile, signatureSimpleName) }) {
builtBy(signatureBuilderTask)
}
}

// Utility task to show what's in the signature file
tasks.register("printSignature", SignatureInfoTask::class.java) {
signature = signatureBuilderTask.get().outputFiles
depth = 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

dependencies {
add("signature", "com.toasttab.android:gummy-bears-api-21:0.3.0:coreLib@signature")
signature(project(path = ":animal-sniffer-signature", configuration = "generatedSignature"))
}

animalsniffer {
Expand Down
1 change: 1 addition & 0 deletions dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ val DEPENDENCIES = listOf(
"org.jctools:jctools-core:4.0.1",
"org.junit-pioneer:junit-pioneer:1.9.1",
"org.skyscreamer:jsonassert:1.5.1",
"com.android.tools:desugar_jdk_libs:2.0.4",
)

javaPlatform {
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ plugins {
dependencyResolutionManagement {
repositories {
mavenCentral()
google()
mavenLocal()
}
}
Expand Down Expand Up @@ -64,6 +65,7 @@ include(":sdk-extensions:autoconfigure-spi")
include(":sdk-extensions:incubator")
include(":sdk-extensions:jaeger-remote-sampler")
include(":testing-internal")
include(":animal-sniffer-signature")

val gradleEnterpriseServer = "https://ge.opentelemetry.io"
val isCI = System.getenv("CI") != null
Expand Down