diff --git a/animal-sniffer-signature/build.gradle.kts b/animal-sniffer-signature/build.gradle.kts new file mode 100644 index 00000000000..2f835c559aa --- /dev/null +++ b/animal-sniffer-signature/build.gradle.kts @@ -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 +} diff --git a/buildSrc/src/main/kotlin/otel.animalsniffer-conventions.gradle.kts b/buildSrc/src/main/kotlin/otel.animalsniffer-conventions.gradle.kts index 9680996fcc8..73bbf0dd2d7 100644 --- a/buildSrc/src/main/kotlin/otel.animalsniffer-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/otel.animalsniffer-conventions.gradle.kts @@ -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 { diff --git a/dependencyManagement/build.gradle.kts b/dependencyManagement/build.gradle.kts index c7a8aa61f5a..03b62a6e2a7 100644 --- a/dependencyManagement/build.gradle.kts +++ b/dependencyManagement/build.gradle.kts @@ -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 { diff --git a/settings.gradle.kts b/settings.gradle.kts index 735cc2f5ccf..5599100fcd8 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -16,6 +16,7 @@ plugins { dependencyResolutionManagement { repositories { mavenCentral() + google() mavenLocal() } } @@ -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