From 54f0d928fb205c9377f448aad618f6e3768df299 Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Thu, 9 Nov 2023 19:52:41 +0100 Subject: [PATCH 1/8] Building animal sniffer signatures directly from android corelib --- animal-sniffer/build.gradle.kts | 54 +++++++++++++++++++ .../otel.animalsniffer-conventions.gradle.kts | 2 +- settings.gradle.kts | 1 + 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 animal-sniffer/build.gradle.kts diff --git a/animal-sniffer/build.gradle.kts b/animal-sniffer/build.gradle.kts new file mode 100644 index 00000000000..84092bb19c9 --- /dev/null +++ b/animal-sniffer/build.gradle.kts @@ -0,0 +1,54 @@ +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") +} + +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) + +repositories { + mavenCentral() + google() +} + +dependencies { + signature("com.toasttab.android:gummy-bears-api-21:0.6.1@signature") + signatureJar("com.android.tools:desugar_jdk_libs:2.0.4") +} + +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..36b9e895169 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", configuration = "generatedSignature")) } animalsniffer { diff --git a/settings.gradle.kts b/settings.gradle.kts index 735cc2f5ccf..2826cf4ea55 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -64,6 +64,7 @@ include(":sdk-extensions:autoconfigure-spi") include(":sdk-extensions:incubator") include(":sdk-extensions:jaeger-remote-sampler") include(":testing-internal") +include(":animal-sniffer") val gradleEnterpriseServer = "https://ge.opentelemetry.io" val isCI = System.getenv("CI") != null From c0a1e628092cc25ebab50cb60552dbaae2374251 Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Fri, 10 Nov 2023 10:22:33 +0100 Subject: [PATCH 2/8] Adding description and moduleName --- animal-sniffer/build.gradle.kts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/animal-sniffer/build.gradle.kts b/animal-sniffer/build.gradle.kts index 84092bb19c9..0d024ed02d4 100644 --- a/animal-sniffer/build.gradle.kts +++ b/animal-sniffer/build.gradle.kts @@ -6,6 +6,9 @@ plugins { id("ru.vyarus.animalsniffer") } +description = "Compilation utility to generate the Android animal sniffer signature" +otelJava.moduleName.set("io.opentelemetry.internal.animalsniffer") + val signatureJar = configurations.create("signatureJar") { isCanBeConsumed = false isCanBeResolved = false From 2b73634243326416d9dd8a54ffd2357a918aa914 Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Fri, 10 Nov 2023 10:37:14 +0100 Subject: [PATCH 3/8] Updated description --- animal-sniffer/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/animal-sniffer/build.gradle.kts b/animal-sniffer/build.gradle.kts index 0d024ed02d4..75ef7a94c00 100644 --- a/animal-sniffer/build.gradle.kts +++ b/animal-sniffer/build.gradle.kts @@ -6,7 +6,7 @@ plugins { id("ru.vyarus.animalsniffer") } -description = "Compilation utility to generate the Android animal sniffer signature" +description = "Build tool to generate the Android animal sniffer signature" otelJava.moduleName.set("io.opentelemetry.internal.animalsniffer") val signatureJar = configurations.create("signatureJar") { From 865df7676cc827ced72d3e5662e246358fe4c46c Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Fri, 10 Nov 2023 10:37:53 +0100 Subject: [PATCH 4/8] Spotless --- animal-sniffer/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/animal-sniffer/build.gradle.kts b/animal-sniffer/build.gradle.kts index 75ef7a94c00..9c1529d5667 100644 --- a/animal-sniffer/build.gradle.kts +++ b/animal-sniffer/build.gradle.kts @@ -51,7 +51,7 @@ artifacts { } // Utility task to show what's in the signature file -tasks.register( "printSignature", SignatureInfoTask::class.java) { +tasks.register("printSignature", SignatureInfoTask::class.java) { signature = signatureBuilderTask.get().outputFiles depth = 1 } From 843284404f29cab85f236ed4070493a1ccb4373f Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Fri, 10 Nov 2023 10:40:44 +0100 Subject: [PATCH 5/8] Updating the description --- animal-sniffer/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/animal-sniffer/build.gradle.kts b/animal-sniffer/build.gradle.kts index 9c1529d5667..c1a648a80a2 100644 --- a/animal-sniffer/build.gradle.kts +++ b/animal-sniffer/build.gradle.kts @@ -6,7 +6,7 @@ plugins { id("ru.vyarus.animalsniffer") } -description = "Build tool to generate the Android animal sniffer signature" +description = "Build tool to generate the Animal Sniffer Android signature" otelJava.moduleName.set("io.opentelemetry.internal.animalsniffer") val signatureJar = configurations.create("signatureJar") { From 1729c59e11534493fc99f659abdf950ce16024bb Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 20 Nov 2023 10:07:50 +0100 Subject: [PATCH 6/8] Renaming animal-sniffer module to animal-sniffer-signature --- {animal-sniffer => animal-sniffer-signature}/build.gradle.kts | 0 .../src/main/kotlin/otel.animalsniffer-conventions.gradle.kts | 2 +- settings.gradle.kts | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename {animal-sniffer => animal-sniffer-signature}/build.gradle.kts (100%) diff --git a/animal-sniffer/build.gradle.kts b/animal-sniffer-signature/build.gradle.kts similarity index 100% rename from animal-sniffer/build.gradle.kts rename to animal-sniffer-signature/build.gradle.kts diff --git a/buildSrc/src/main/kotlin/otel.animalsniffer-conventions.gradle.kts b/buildSrc/src/main/kotlin/otel.animalsniffer-conventions.gradle.kts index 36b9e895169..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 { - signature(project(path = ":animal-sniffer", configuration = "generatedSignature")) + signature(project(path = ":animal-sniffer-signature", configuration = "generatedSignature")) } animalsniffer { diff --git a/settings.gradle.kts b/settings.gradle.kts index 2826cf4ea55..8c8ec55db11 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -64,7 +64,7 @@ include(":sdk-extensions:autoconfigure-spi") include(":sdk-extensions:incubator") include(":sdk-extensions:jaeger-remote-sampler") include(":testing-internal") -include(":animal-sniffer") +include(":animal-sniffer-signature") val gradleEnterpriseServer = "https://ge.opentelemetry.io" val isCI = System.getenv("CI") != null From 2495a9f8958e97f1bd751c24619e3875faf2c35a Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 20 Nov 2023 10:14:31 +0100 Subject: [PATCH 7/8] Adding google repo to settings.gradle.kts --- animal-sniffer-signature/build.gradle.kts | 5 ----- settings.gradle.kts | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/animal-sniffer-signature/build.gradle.kts b/animal-sniffer-signature/build.gradle.kts index c1a648a80a2..44c2feeb0db 100644 --- a/animal-sniffer-signature/build.gradle.kts +++ b/animal-sniffer-signature/build.gradle.kts @@ -26,11 +26,6 @@ configurations.add(signatureJar) configurations.add(signatureJarClasspath) configurations.add(generatedSignature) -repositories { - mavenCentral() - google() -} - dependencies { signature("com.toasttab.android:gummy-bears-api-21:0.6.1@signature") signatureJar("com.android.tools:desugar_jdk_libs:2.0.4") diff --git a/settings.gradle.kts b/settings.gradle.kts index 8c8ec55db11..5599100fcd8 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -16,6 +16,7 @@ plugins { dependencyResolutionManagement { repositories { mavenCentral() + google() mavenLocal() } } From a06a0acd8cc2de187eced6f11530e64aa5abfab9 Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 20 Nov 2023 10:26:34 +0100 Subject: [PATCH 8/8] Moving android desugar lib version to dependencyManagement/build.gradle.kts --- animal-sniffer-signature/build.gradle.kts | 2 +- dependencyManagement/build.gradle.kts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/animal-sniffer-signature/build.gradle.kts b/animal-sniffer-signature/build.gradle.kts index 44c2feeb0db..2f835c559aa 100644 --- a/animal-sniffer-signature/build.gradle.kts +++ b/animal-sniffer-signature/build.gradle.kts @@ -28,7 +28,7 @@ configurations.add(generatedSignature) dependencies { signature("com.toasttab.android:gummy-bears-api-21:0.6.1@signature") - signatureJar("com.android.tools:desugar_jdk_libs:2.0.4") + signatureJar("com.android.tools:desugar_jdk_libs") } val signatureSimpleName = "android.signature" 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 {