Browse Source

Rename instrumentation-api builds to kotlin (#3446)

* Rename instrumentation-api builds to kotlin

* Migrate

* Small cleanup
Anuraag Agrawal 3 years ago
parent
commit
93632d3f27

+ 0 - 52
instrumentation-api-caching/build.gradle

@@ -1,52 +0,0 @@
-plugins {
-  id("com.github.johnrengelman.shadow")
-
-  id("otel.java-conventions")
-  id("otel.publish-conventions")
-}
-
-group = 'io.opentelemetry.instrumentation'
-
-configurations {
-  shadowInclude {
-    canBeResolved = true
-    canBeConsumed = false
-  }
-}
-
-dependencies {
-  compileOnly "com.github.ben-manes.caffeine:caffeine"
-  shadowInclude("com.github.ben-manes.caffeine:caffeine") {
-    exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
-    exclude group: 'org.checkerframework', module: 'checker-qual'
-  }
-
-  compileOnly "com.blogspot.mydailyjava:weak-lock-free"
-  shadowInclude "com.blogspot.mydailyjava:weak-lock-free"
-}
-
-shadowJar {
-  configurations = [project.configurations.shadowInclude]
-
-  archiveClassifier.set("")
-
-  relocate "com.github.benmanes.caffeine", "io.opentelemetry.instrumentation.api.internal.shaded.caffeine"
-  relocate "com.blogspot.mydailyjava.weaklockfree", "io.opentelemetry.instrumentation.api.internal.shaded.weaklockfree"
-
-  minimize()
-}
-
-jar {
-  enabled = false
-
-  dependsOn shadowJar
-}
-
-// Because shadow does not use default configurations
-publishing {
-  publications {
-    maven {
-      project.shadow.component(it)
-    }
-  }
-}

+ 54 - 0
instrumentation-api-caching/build.gradle.kts

@@ -0,0 +1,54 @@
+import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
+
+plugins {
+  id("com.github.johnrengelman.shadow")
+
+  id("otel.java-conventions")
+  id("otel.publish-conventions")
+}
+
+group = "io.opentelemetry.instrumentation"
+
+val shadowInclude by configurations.creating {
+  isCanBeResolved = true
+  isCanBeConsumed = false
+}
+
+dependencies {
+  compileOnly("com.github.ben-manes.caffeine:caffeine")
+  shadowInclude("com.github.ben-manes.caffeine:caffeine") {
+    exclude("com.google.errorprone", "error_prone_annotations")
+    exclude("org.checkerframework", "checker-qual")
+  }
+
+  compileOnly("com.blogspot.mydailyjava:weak-lock-free")
+  shadowInclude("com.blogspot.mydailyjava:weak-lock-free")
+}
+
+tasks {
+  named<ShadowJar>("shadowJar") {
+    configurations = listOf(shadowInclude)
+
+    archiveClassifier.set("")
+
+    relocate("com.github.benmanes.caffeine", "io.opentelemetry.instrumentation.api.internal.shaded.caffeine")
+    relocate("com.blogspot.mydailyjava.weaklockfree", "io.opentelemetry.instrumentation.api.internal.shaded.weaklockfree")
+
+    minimize()
+  }
+
+  named("jar") {
+    enabled = false
+
+    dependsOn(shadowJar)
+  }
+}
+
+// Because shadow does not use default configurations
+publishing {
+  publications {
+    named<MavenPublication>("maven") {
+      project.shadow.component(this)
+    }
+  }
+}

+ 0 - 40
instrumentation-api/build.gradle

@@ -1,40 +0,0 @@
-plugins {
-  id("org.xbib.gradle.plugin.jflex") version "1.5.0"
-
-  id("otel.java-conventions")
-  id("otel.jacoco-conventions")
-  id("otel.publish-conventions")
-}
-
-sourceSets {
-  main {
-    java {
-      // gradle-jflex-plugin has a bug in that it always looks for the last srcDir in this source
-      // set to generate into. By default it would be the src/main directory itself.
-      srcDir("${buildDir}/generated/sources/jflex")
-    }
-  }
-}
-
-group = "io.opentelemetry.instrumentation"
-
-dependencies {
-  api project(":instrumentation-api-caching")
-
-  api "io.opentelemetry:opentelemetry-api"
-  api "io.opentelemetry:opentelemetry-semconv"
-
-  implementation "io.opentelemetry:opentelemetry-api-metrics"
-  implementation "org.slf4j:slf4j-api"
-
-  compileOnly "com.google.auto.value:auto-value-annotations"
-  annotationProcessor "com.google.auto.value:auto-value"
-
-  testImplementation project(':testing-common')
-  testImplementation "org.mockito:mockito-core"
-  testImplementation "org.mockito:mockito-junit-jupiter"
-  testImplementation "org.assertj:assertj-core"
-  testImplementation "org.awaitility:awaitility"
-  testImplementation "io.opentelemetry:opentelemetry-sdk-metrics"
-  testImplementation "io.opentelemetry:opentelemetry-sdk-testing"
-}

+ 40 - 0
instrumentation-api/build.gradle.kts

@@ -0,0 +1,40 @@
+plugins {
+  id("org.xbib.gradle.plugin.jflex")
+
+  id("otel.java-conventions")
+  id("otel.jacoco-conventions")
+  id("otel.publish-conventions")
+}
+
+sourceSets {
+  main {
+    java {
+      // gradle-jflex-plugin has a bug in that it always looks for the last srcDir in this source
+      // set to generate into. By default it would be the src/main directory itself.
+      srcDir("${buildDir}/generated/sources/jflex")
+    }
+  }
+}
+
+group = "io.opentelemetry.instrumentation"
+
+dependencies {
+  api(project(":instrumentation-api-caching"))
+
+  api("io.opentelemetry:opentelemetry-api")
+  api("io.opentelemetry:opentelemetry-semconv")
+
+  implementation("io.opentelemetry:opentelemetry-api-metrics")
+  implementation("org.slf4j:slf4j-api")
+
+  compileOnly("com.google.auto.value:auto-value-annotations")
+  annotationProcessor("com.google.auto.value:auto-value")
+
+  testImplementation(project(":testing-common"))
+  testImplementation("org.mockito:mockito-core")
+  testImplementation("org.mockito:mockito-junit-jupiter")
+  testImplementation("org.assertj:assertj-core")
+  testImplementation("org.awaitility:awaitility")
+  testImplementation("io.opentelemetry:opentelemetry-sdk-metrics")
+  testImplementation("io.opentelemetry:opentelemetry-sdk-testing")
+}

+ 1 - 0
settings.gradle

@@ -6,6 +6,7 @@ pluginManagement {
     id "net.ltgt.nullaway" version "1.1.0"
     id 'org.jetbrains.kotlin.jvm' version '1.5.10'
     id 'org.unbroken-dome.test-sets' version '4.0.0'
+    id "org.xbib.gradle.plugin.jflex" version "1.5.0"
     id "nebula.release" version "15.3.1"
   }
 }