Migrate api / sdk projects to build.gradle.kts (#2609)
This commit is contained in:
		
							parent
							
								
									3e341f9af5
								
							
						
					
					
						commit
						1a56b8b0d8
					
				|  | @ -1,20 +0,0 @@ | |||
| plugins { | ||||
|     id "java-library" | ||||
|     id "maven-publish" | ||||
| 
 | ||||
|     id "me.champeau.gradle.jmh" | ||||
|     id "ru.vyarus.animalsniffer" | ||||
| } | ||||
| 
 | ||||
| description = 'OpenTelemetry API' | ||||
| ext.moduleName = "io.opentelemetry.api" | ||||
| archivesBaseName = "opentelemetry-api" | ||||
| 
 | ||||
| dependencies { | ||||
|     api project(':api:context') | ||||
| 
 | ||||
|     annotationProcessor "com.google.auto.value:auto-value" | ||||
| 
 | ||||
|     testImplementation "edu.berkeley.cs.jqf:jqf-fuzz", | ||||
|             "com.google.guava:guava-testlib" | ||||
| } | ||||
|  | @ -0,0 +1,20 @@ | |||
| plugins { | ||||
|     id("java-library") | ||||
|     id("maven-publish") | ||||
| 
 | ||||
|     id("me.champeau.gradle.jmh") | ||||
|     id("ru.vyarus.animalsniffer") | ||||
| } | ||||
| 
 | ||||
| description = "OpenTelemetry API" | ||||
| extra["moduleName"] = "io.opentelemetry.api" | ||||
| base.archivesBaseName = "opentelemetry-api" | ||||
| 
 | ||||
| dependencies { | ||||
|     api(project(":api:context")) | ||||
| 
 | ||||
|     annotationProcessor("com.google.auto.value:auto-value") | ||||
| 
 | ||||
|     testImplementation("edu.berkeley.cs.jqf:jqf-fuzz") | ||||
|     testImplementation("com.google.guava:guava-testlib") | ||||
| } | ||||
|  | @ -1,52 +0,0 @@ | |||
| plugins { | ||||
|     id "java-library" | ||||
|     id "maven-publish" | ||||
| 
 | ||||
|     id "me.champeau.gradle.jmh" | ||||
|     id "org.unbroken-dome.test-sets" | ||||
|     id "ru.vyarus.animalsniffer" | ||||
| } | ||||
| 
 | ||||
| description = "OpenTelemetry Context (Incubator)" | ||||
| ext.moduleName = "io.opentelemetry.context" | ||||
| archivesBaseName = "opentelemetry-context" | ||||
| 
 | ||||
| testSets { | ||||
|     grpcInOtelTest | ||||
|     otelInGrpcTest | ||||
| 
 | ||||
|     braveInOtelTest | ||||
|     otelInBraveTest | ||||
|     otelAsBraveTest | ||||
| 
 | ||||
|     storageWrappersTest | ||||
| 
 | ||||
|     strictContextEnabledTest | ||||
| } | ||||
| 
 | ||||
| dependencies { | ||||
|     grpcInOtelTestImplementation "io.grpc:grpc-context" | ||||
|     otelInGrpcTestImplementation "io.grpc:grpc-context" | ||||
| 
 | ||||
|     braveInOtelTestImplementation "io.zipkin.brave:brave" | ||||
|     otelAsBraveTestImplementation "io.zipkin.brave:brave" | ||||
|     otelInBraveTestImplementation "io.zipkin.brave:brave" | ||||
| 
 | ||||
|     testImplementation "org.awaitility:awaitility" | ||||
|     testImplementation "com.google.guava:guava" | ||||
|     testImplementation "org.junit-pioneer:junit-pioneer" | ||||
| } | ||||
| 
 | ||||
| tasks.named("strictContextEnabledTest").configure { | ||||
|     jvmArgs "-Dio.opentelemetry.context.enableStrictContext=true" | ||||
| } | ||||
| 
 | ||||
| check.dependsOn( | ||||
|         grpcInOtelTest, | ||||
|         otelInGrpcTest, | ||||
|         braveInOtelTest, | ||||
|         otelInBraveTest, | ||||
|         otelAsBraveTest, | ||||
|         storageWrappersTest, | ||||
|         strictContextEnabledTest | ||||
| ) | ||||
|  | @ -0,0 +1,50 @@ | |||
| plugins { | ||||
|     id("java-library") | ||||
|     id("maven-publish") | ||||
| 
 | ||||
|     id("me.champeau.gradle.jmh") | ||||
|     id("org.unbroken-dome.test-sets") | ||||
|     id("ru.vyarus.animalsniffer") | ||||
| } | ||||
| 
 | ||||
| description = "OpenTelemetry Context (Incubator)" | ||||
| extra["moduleName"] = "io.opentelemetry.context" | ||||
| base.archivesBaseName = "opentelemetry-context" | ||||
| 
 | ||||
| testSets { | ||||
|     create("grpcInOtelTest") | ||||
|     create("otelInGrpcTest") | ||||
| 
 | ||||
|     create("braveInOtelTest") | ||||
|     create("otelInBraveTest") | ||||
|     create("otelAsBraveTest") | ||||
| 
 | ||||
|     create("storageWrappersTest") | ||||
| 
 | ||||
|     create("strictContextEnabledTest") | ||||
| } | ||||
| 
 | ||||
| dependencies { | ||||
|     add("grpcInOtelTestImplementation", "io.grpc:grpc-context") | ||||
|     add("otelInGrpcTestImplementation", "io.grpc:grpc-context") | ||||
| 
 | ||||
|     add("braveInOtelTestImplementation", "io.zipkin.brave:brave") | ||||
|     add("otelAsBraveTestImplementation", "io.zipkin.brave:brave") | ||||
|     add("otelInBraveTestImplementation", "io.zipkin.brave:brave") | ||||
| 
 | ||||
|     testImplementation("org.awaitility:awaitility") | ||||
|     testImplementation("com.google.guava:guava") | ||||
|     testImplementation("org.junit-pioneer:junit-pioneer") | ||||
| } | ||||
| 
 | ||||
| tasks { | ||||
|     named<Test>("strictContextEnabledTest") { | ||||
|         jvmArgs("-Dio.opentelemetry.context.enableStrictContext=true") | ||||
|     } | ||||
| 
 | ||||
|     named("check") { | ||||
|         dependsOn("grpcInOtelTest", "otelInGrpcTest", "braveInOtelTest", "otelInBraveTest", | ||||
|                 "otelAsBraveTest", "storageWrappersTest", "strictContextEnabledTest") | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | @ -1,19 +0,0 @@ | |||
| plugins { | ||||
|     id "java-library" | ||||
|     id "maven-publish" | ||||
| 
 | ||||
|     id "me.champeau.gradle.jmh" | ||||
|     id "ru.vyarus.animalsniffer" | ||||
| } | ||||
| 
 | ||||
| description = 'OpenTelemetry API' | ||||
| ext.moduleName = "io.opentelemetry.api.metrics" | ||||
| 
 | ||||
| dependencies { | ||||
|     api project(':api:all') | ||||
| 
 | ||||
|     annotationProcessor "com.google.auto.value:auto-value" | ||||
| 
 | ||||
|     testImplementation "edu.berkeley.cs.jqf:jqf-fuzz", | ||||
|             "com.google.guava:guava-testlib" | ||||
| } | ||||
|  | @ -0,0 +1,19 @@ | |||
| plugins { | ||||
|     id("java-library") | ||||
|     id("maven-publish") | ||||
| 
 | ||||
|     id("me.champeau.gradle.jmh") | ||||
|     id("ru.vyarus.animalsniffer") | ||||
| } | ||||
| 
 | ||||
| description = "OpenTelemetry API" | ||||
| extra["moduleName"] = "io.opentelemetry.api.metrics" | ||||
| 
 | ||||
| dependencies { | ||||
|     api(project(":api:all")) | ||||
| 
 | ||||
|     annotationProcessor("com.google.auto.value:auto-value") | ||||
| 
 | ||||
|     testImplementation("edu.berkeley.cs.jqf:jqf-fuzz") | ||||
|     testImplementation("com.google.guava:guava-testlib") | ||||
| } | ||||
|  | @ -58,6 +58,11 @@ val DEPENDENCY_SETS = listOf( | |||
|                 "org.mockito", | ||||
|                 "3.7.0", | ||||
|                 listOf("mockito-core", "mockito-junit-jupiter") | ||||
|         ), | ||||
|         DependencySet( | ||||
|                 "org.testcontainers", | ||||
|                 "1.15.1", | ||||
|                 listOf("testcontainers", "junit-jupiter") | ||||
|         ) | ||||
| ) | ||||
| 
 | ||||
|  | @ -84,8 +89,7 @@ val DEPENDENCIES = listOf( | |||
|         "org.curioswitch.curiostack:protobuf-jackson:1.1.0", | ||||
|         "org.junit-pioneer:junit-pioneer:1.1.0", | ||||
|         "org.skyscreamer:jsonassert:1.5.0", | ||||
|         "org.slf4j:slf4j-simple:1.7.30", | ||||
|         "org.testcontainers:junit-jupiter:1.15.1" | ||||
|         "org.slf4j:slf4j-simple:1.7.30" | ||||
| ) | ||||
| 
 | ||||
| javaPlatform { | ||||
|  |  | |||
|  | @ -1,47 +0,0 @@ | |||
| plugins { | ||||
|     id "java-library" | ||||
|     id "maven-publish" | ||||
| 
 | ||||
|     id "me.champeau.gradle.jmh" | ||||
|     id "ru.vyarus.animalsniffer" | ||||
| } | ||||
| 
 | ||||
| description = 'OpenTelemetry SDK' | ||||
| ext.moduleName = "io.opentelemetry.sdk" | ||||
| ext.propertiesDir = "build/generated/properties/io/opentelemetry/sdk" | ||||
| archivesBaseName = "opentelemetry-sdk" | ||||
| 
 | ||||
| dependencies { | ||||
|     api project(':api:all'), | ||||
|             project(':sdk:common'), | ||||
|             project(':sdk:trace') | ||||
| 
 | ||||
|     annotationProcessor "com.google.auto.value:auto-value" | ||||
| 
 | ||||
|     testAnnotationProcessor "com.google.auto.value:auto-value" | ||||
| 
 | ||||
|     testImplementation project(':sdk:testing') | ||||
|     testImplementation "org.junit-pioneer:junit-pioneer" | ||||
| } | ||||
| 
 | ||||
| sourceSets { | ||||
|     main { | ||||
|         output.dir("build/generated/properties", builtBy: 'generateVersionResource') | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| animalsniffer { | ||||
|     // Don't check sourceSets.jmh and sourceSets.test | ||||
|     sourceSets = [ | ||||
|             sourceSets.main | ||||
|     ] | ||||
| } | ||||
| 
 | ||||
| task generateVersionResource { | ||||
|     doLast { | ||||
|         def folder = file(propertiesDir) | ||||
|         folder.mkdirs() | ||||
|         def propertiesFile = new File(folder.getAbsolutePath(), "version.properties") | ||||
|         propertiesFile.write("sdk.version=${project.version}") | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,40 @@ | |||
| plugins { | ||||
|     id("java-library") | ||||
|     id("maven-publish") | ||||
| 
 | ||||
|     id("me.champeau.gradle.jmh") | ||||
|     id("ru.vyarus.animalsniffer") | ||||
| } | ||||
| 
 | ||||
| description = "OpenTelemetry SDK" | ||||
| extra["moduleName"] = "io.opentelemetry.sdk" | ||||
| base.archivesBaseName = "opentelemetry-sdk" | ||||
| 
 | ||||
| dependencies { | ||||
|     api(project(":api:all")) | ||||
|     api(project(":sdk:common")) | ||||
|     api(project(":sdk:trace")) | ||||
| 
 | ||||
|     annotationProcessor("com.google.auto.value:auto-value") | ||||
| 
 | ||||
|     testAnnotationProcessor("com.google.auto.value:auto-value") | ||||
| 
 | ||||
|     testImplementation(project(":sdk:testing")) | ||||
| } | ||||
| 
 | ||||
| sourceSets { | ||||
|     main { | ||||
|         output.dir("build/generated/properties", "builtBy" to "generateVersionResource") | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| tasks { | ||||
|     register("generateVersionResource") { | ||||
|         val propertiesDir = file("build/generated/properties/io/opentelemetry/sdk") | ||||
|         outputs.dir(propertiesDir) | ||||
| 
 | ||||
|         doLast { | ||||
|             File(propertiesDir, "version.properties").writeText("sdk.version=${project.version}") | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -1,97 +0,0 @@ | |||
| plugins { | ||||
|     id "java-library" | ||||
|     id "maven-publish" | ||||
| 
 | ||||
|     id "ru.vyarus.animalsniffer" | ||||
| } | ||||
| 
 | ||||
| description = 'OpenTelemetry SDK Common' | ||||
| ext.moduleName = "io.opentelemetry.sdk.common" | ||||
| ext.propertiesDir = "build/generated/properties/io/opentelemetry/sdk/common" | ||||
| 
 | ||||
| dependencies { | ||||
|     api project(':api:all') | ||||
|     api project(':semconv') | ||||
| 
 | ||||
|     annotationProcessor "com.google.auto.value:auto-value" | ||||
| 
 | ||||
|     testAnnotationProcessor "com.google.auto.value:auto-value" | ||||
| 
 | ||||
|     testImplementation project(':sdk:testing') | ||||
|     testImplementation "org.junit-pioneer:junit-pioneer", | ||||
|             "com.google.guava:guava-testlib" | ||||
| } | ||||
| 
 | ||||
| sourceSets { | ||||
|     main { | ||||
|         output.dir("build/generated/properties", builtBy: 'generateVersionResource') | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| animalsniffer { | ||||
|     // Don't check sourceSets.jmh and sourceSets.test | ||||
|     sourceSets = [ | ||||
|             sourceSets.main | ||||
|     ] | ||||
| } | ||||
| 
 | ||||
| configurations { | ||||
|     testClasses { | ||||
|         extendsFrom(testRuntime) | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| task testJar(type: Jar) { | ||||
|     archiveClassifier.set("test") | ||||
|     from sourceSets.test.output | ||||
| } | ||||
| 
 | ||||
| // add the jar generated by the testJar task to the testClasses dependency | ||||
| artifacts { | ||||
|     testClasses testJar | ||||
| } | ||||
| 
 | ||||
| task generateVersionResource { | ||||
|     doLast { | ||||
|         def folder = file(propertiesDir) | ||||
|         folder.mkdirs() | ||||
|         def propertiesFile = new File(folder.getAbsolutePath(), "version.properties") | ||||
|         propertiesFile.write("sdk.version=${project.version}") | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| def mrJarVersions = [9] | ||||
| 
 | ||||
| mrJarVersions.each { version-> | ||||
|     sourceSets { | ||||
|         "java${version}" { | ||||
|             java { | ||||
|                 srcDirs = ["src/main/java${version}"] | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     "compileJava${version}Java" { | ||||
|         sourceCompatibility = version | ||||
|         targetCompatibility = version | ||||
|         options.release = version | ||||
|     } | ||||
| 
 | ||||
|     configurations."java${version}Implementation".extendsFrom configurations.implementation | ||||
| 
 | ||||
|     dependencies { | ||||
|         // Common to reference classes in main sourceset from Java 9 one (e.g., to return a common interface) | ||||
|         "java${version}Implementation" files(sourceSets.main.output.classesDirs) { builtBy compileJava } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| tasks.withType(Jar) { | ||||
|     mrJarVersions.each { version-> | ||||
|         into("META-INF/versions/${version}") { | ||||
|             from sourceSets."java${version}".output | ||||
|         } | ||||
|     } | ||||
|     manifest.attributes( | ||||
|             'Multi-Release': 'true' | ||||
|     ) | ||||
| } | ||||
|  | @ -0,0 +1,82 @@ | |||
| plugins { | ||||
|     id("java-library") | ||||
|     id("maven-publish") | ||||
| 
 | ||||
|     id("ru.vyarus.animalsniffer") | ||||
| } | ||||
| 
 | ||||
| description = "OpenTelemetry SDK Common" | ||||
| extra["moduleName"] = "io.opentelemetry.sdk.common" | ||||
| 
 | ||||
| val mrJarVersions = listOf(9) | ||||
| 
 | ||||
| dependencies { | ||||
|     api(project(":api:all")) | ||||
|     api(project(":semconv")) | ||||
| 
 | ||||
|     annotationProcessor("com.google.auto.value:auto-value") | ||||
| 
 | ||||
|     testAnnotationProcessor("com.google.auto.value:auto-value") | ||||
| 
 | ||||
|     testImplementation(project(":sdk:testing")) | ||||
|     testImplementation("com.google.guava:guava-testlib") | ||||
| } | ||||
| 
 | ||||
| sourceSets { | ||||
|     main { | ||||
|         output.dir("build/generated/properties", "builtBy" to "generateVersionResource") | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| tasks { | ||||
|     register("generateVersionResource") { | ||||
|         val propertiesDir = file("build/generated/properties/io/opentelemetry/sdk/common") | ||||
|         outputs.dir(propertiesDir) | ||||
| 
 | ||||
|         doLast { | ||||
|             File(propertiesDir, "version.properties").writeText("sdk.version=${project.version}") | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| for (version in mrJarVersions) { | ||||
|     sourceSets { | ||||
|         create("java${version}") { | ||||
|             java { | ||||
|                 setSrcDirs(listOf("src/main/java${version}")) | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     tasks { | ||||
|         named<JavaCompile>("compileJava${version}Java") { | ||||
|             sourceCompatibility = "${version}" | ||||
|             targetCompatibility = "${version}" | ||||
|             options.release.set(version) | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     configurations { | ||||
|         named("java${version}Implementation") { | ||||
|             extendsFrom(configurations["implementation"]) | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     dependencies { | ||||
|         // Common to reference classes in main sourceset from Java 9 one (e.g., to return a common interface) | ||||
|         add("java${version}Implementation", files(sourceSets.main.get().output.classesDirs)) | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| tasks { | ||||
|     withType(Jar::class) { | ||||
|         for (version in mrJarVersions) { | ||||
|             into("META-INF/versions/${version}") { | ||||
|                 from(sourceSets["java${version}"].output) | ||||
|             } | ||||
|         } | ||||
|         manifest.attributes( | ||||
|                 "Multi-Release" to "true" | ||||
|         ) | ||||
|     } | ||||
| } | ||||
|  | @ -1,46 +0,0 @@ | |||
| plugins { | ||||
|     id "java-library" | ||||
|     id "maven-publish" | ||||
| 
 | ||||
|     id "me.champeau.gradle.jmh" | ||||
|     id "ru.vyarus.animalsniffer" | ||||
| } | ||||
| 
 | ||||
| description = 'OpenTelemetry SDK Metrics' | ||||
| ext.moduleName = "io.opentelemetry.sdk.metrics" | ||||
| ext.propertiesDir = "build/generated/properties/io/opentelemetry/sdk/metrics" | ||||
| 
 | ||||
| dependencies { | ||||
|     api project(':api:metrics'), | ||||
|             project(':sdk:common') | ||||
| 
 | ||||
|     annotationProcessor "com.google.auto.value:auto-value" | ||||
| 
 | ||||
|     testAnnotationProcessor "com.google.auto.value:auto-value" | ||||
| 
 | ||||
|     testImplementation "com.google.guava:guava" | ||||
|     testImplementation project(':sdk:testing') | ||||
|     testImplementation "org.junit-pioneer:junit-pioneer" | ||||
| } | ||||
| 
 | ||||
| sourceSets { | ||||
|     main { | ||||
|         output.dir("build/generated/properties", builtBy: 'generateVersionResource') | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| animalsniffer { | ||||
|     // Don't check sourceSets.jmh and sourceSets.test | ||||
|     sourceSets = [ | ||||
|             sourceSets.main | ||||
|     ] | ||||
| } | ||||
| 
 | ||||
| task generateVersionResource { | ||||
|     doLast { | ||||
|         def folder = file(propertiesDir) | ||||
|         folder.mkdirs() | ||||
|         def propertiesFile = new File(folder.getAbsolutePath(), "version.properties") | ||||
|         propertiesFile.write("sdk.version=${project.version}") | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,39 @@ | |||
| plugins { | ||||
|     id("java-library") | ||||
|     id("maven-publish") | ||||
| 
 | ||||
|     id("me.champeau.gradle.jmh") | ||||
|     id("ru.vyarus.animalsniffer") | ||||
| } | ||||
| 
 | ||||
| description = "OpenTelemetry SDK Metrics" | ||||
| extra["moduleName"] = "io.opentelemetry.sdk.metrics" | ||||
| 
 | ||||
| dependencies { | ||||
|     api(project(":api:metrics")) | ||||
|     api(project(":sdk:common")) | ||||
| 
 | ||||
|     annotationProcessor("com.google.auto.value:auto-value") | ||||
| 
 | ||||
|     testAnnotationProcessor("com.google.auto.value:auto-value") | ||||
| 
 | ||||
|     testImplementation(project(":sdk:testing")) | ||||
|     testImplementation("com.google.guava:guava") | ||||
| } | ||||
| 
 | ||||
| sourceSets { | ||||
|     main { | ||||
|         output.dir("build/generated/properties", "builtBy" to "generateVersionResource") | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| tasks { | ||||
|     register("generateVersionResource") { | ||||
|         val propertiesDir = file("build/generated/properties/io/opentelemetry/sdk/metrics") | ||||
|         outputs.dir(propertiesDir) | ||||
| 
 | ||||
|         doLast { | ||||
|             File(propertiesDir, "version.properties").writeText("sdk.version=${project.version}") | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -1,21 +0,0 @@ | |||
| plugins { | ||||
|     id "java-library" | ||||
|     id "maven-publish" | ||||
| } | ||||
| 
 | ||||
| description = 'OpenTelemetry SDK Testing utilities' | ||||
| ext.moduleName = 'io.opentelemetry.sdk.testing' | ||||
| 
 | ||||
| dependencies { | ||||
|     api project(':api:all') | ||||
|     api project(':sdk:all') | ||||
|     api project(':sdk:metrics') | ||||
| 
 | ||||
|     compileOnly "org.assertj:assertj-core" | ||||
|     compileOnly "junit:junit" | ||||
|     compileOnly "org.junit.jupiter:junit-jupiter-api" | ||||
| 
 | ||||
|     testImplementation "junit:junit" | ||||
| 
 | ||||
|     annotationProcessor "com.google.auto.value:auto-value" | ||||
| } | ||||
|  | @ -0,0 +1,21 @@ | |||
| plugins { | ||||
|     id("java-library") | ||||
|     id("maven-publish") | ||||
| } | ||||
| 
 | ||||
| description = "OpenTelemetry SDK Testing utilities" | ||||
| extra["moduleName"] = "io.opentelemetry.sdk.testing" | ||||
| 
 | ||||
| dependencies { | ||||
|     api(project(":api:all")) | ||||
|     api(project(":sdk:all")) | ||||
|     api(project(":sdk:metrics")) | ||||
| 
 | ||||
|     compileOnly("org.assertj:assertj-core") | ||||
|     compileOnly("junit:junit") | ||||
|     compileOnly("org.junit.jupiter:junit-jupiter-api") | ||||
| 
 | ||||
|     annotationProcessor("com.google.auto.value:auto-value") | ||||
| 
 | ||||
|     testImplementation("junit:junit") | ||||
| } | ||||
|  | @ -1,69 +0,0 @@ | |||
| plugins { | ||||
|     id "java-library" | ||||
|     id "maven-publish" | ||||
| 
 | ||||
|     id "me.champeau.gradle.jmh" | ||||
|     id "ru.vyarus.animalsniffer" | ||||
| } | ||||
| 
 | ||||
| description = 'OpenTelemetry SDK For Tracing' | ||||
| ext.moduleName = "io.opentelemetry.sdk.trace" | ||||
| ext.propertiesDir = "build/generated/properties/io/opentelemetry/sdk/trace" | ||||
| 
 | ||||
| dependencies { | ||||
|     api project(':api:all'), | ||||
|             project(':semconv'), | ||||
|             project(':sdk:common') | ||||
| 
 | ||||
|     implementation project(':api:metrics') | ||||
| 
 | ||||
|     annotationProcessor "com.google.auto.value:auto-value" | ||||
| 
 | ||||
|     testAnnotationProcessor "com.google.auto.value:auto-value" | ||||
| 
 | ||||
|     testImplementation "com.google.guava:guava" | ||||
|     testImplementation project(':sdk:testing') | ||||
|     testImplementation "org.junit-pioneer:junit-pioneer" | ||||
| 
 | ||||
|     jmh project(':sdk:metrics') | ||||
|     jmh(project(':sdk:testing')) { | ||||
|         // JMH doesn't handle dependencies that are duplicated between the main and jmh | ||||
|         // configurations properly, but luckily here it's simple enough to just exclude transitive | ||||
|         // dependencies. | ||||
|         transitive = false | ||||
|     } | ||||
|     jmh(project(':exporters:otlp:trace')) { | ||||
|         // The opentelemetry-exporter-otlp-trace depends on this project itself. So don't pull in | ||||
|         // the transitive dependencies. | ||||
|         transitive = false | ||||
|     } | ||||
|     // explicitly adding the opentelemetry-exporter-otlp dependencies | ||||
|     jmh(project(':sdk-extensions:otproto')) { transitive = false } | ||||
|     jmh(project(':proto')) | ||||
|     jmh("io.grpc:grpc-api") | ||||
|     jmh("io.grpc:grpc-netty-shaded") | ||||
|     jmh("org.testcontainers:testcontainers:1.15.1") // testContainer for OTLP collector | ||||
|     jmh "com.google.guava:guava" | ||||
| } | ||||
| 
 | ||||
| sourceSets { | ||||
|     main { | ||||
|         output.dir("build/generated/properties", builtBy: 'generateVersionResource') | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| animalsniffer { | ||||
|     // Don't check sourceSets.jmh and sourceSets.test | ||||
|     sourceSets = [ | ||||
|             sourceSets.main | ||||
|     ] | ||||
| } | ||||
| 
 | ||||
| task generateVersionResource { | ||||
|     doLast { | ||||
|         def folder = file(propertiesDir) | ||||
|         folder.mkdirs() | ||||
|         def propertiesFile = new File(folder.getAbsolutePath(), "version.properties") | ||||
|         propertiesFile.write("sdk.version=${project.version}") | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,65 @@ | |||
| plugins { | ||||
|     id("java-library") | ||||
|     id("maven-publish") | ||||
| 
 | ||||
|     id("me.champeau.gradle.jmh") | ||||
|     id("ru.vyarus.animalsniffer") | ||||
| } | ||||
| 
 | ||||
| description = "OpenTelemetry SDK For Tracing" | ||||
| extra["moduleName"] = "io.opentelemetry.sdk.trace" | ||||
| 
 | ||||
| dependencies { | ||||
|     api(project(":api:all")) | ||||
|     api(project(":semconv")) | ||||
|     api(project(":sdk:common")) | ||||
| 
 | ||||
|     implementation(project(":api:metrics")) | ||||
| 
 | ||||
|     annotationProcessor("com.google.auto.value:auto-value") | ||||
| 
 | ||||
|     testAnnotationProcessor("com.google.auto.value:auto-value") | ||||
| 
 | ||||
|     testImplementation(project(":sdk:testing")) | ||||
|     testImplementation("com.google.guava:guava") | ||||
| 
 | ||||
|     jmh(project(":sdk:metrics")) | ||||
|     jmh(project(":sdk:testing")) { | ||||
|         // JMH doesn"t handle dependencies that are duplicated between the main and jmh | ||||
|         // configurations properly, but luckily here it"s simple enough to just exclude transitive | ||||
|         // dependencies. | ||||
|         isTransitive = false | ||||
|     } | ||||
|     jmh(project(":exporters:otlp:trace")) { | ||||
|         // The opentelemetry-exporter-otlp-trace depends on this project itself. So don"t pull in | ||||
|         // the transitive dependencies. | ||||
|         isTransitive = false | ||||
|     } | ||||
|     // explicitly adding the opentelemetry-exporter-otlp dependencies | ||||
|     jmh(project(":sdk-extensions:otproto")) { | ||||
|         isTransitive = false | ||||
|     } | ||||
|     jmh(project(":proto")) | ||||
| 
 | ||||
|     jmh("com.google.guava:guava") | ||||
|     jmh("io.grpc:grpc-api") | ||||
|     jmh("io.grpc:grpc-netty-shaded") | ||||
|     jmh("org.testcontainers:testcontainers") // testContainer for OTLP collector | ||||
| } | ||||
| 
 | ||||
| sourceSets { | ||||
|     main { | ||||
|         output.dir("build/generated/properties", "builtBy" to "generateVersionResource") | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| tasks { | ||||
|     register("generateVersionResource") { | ||||
|         val propertiesDir = file("build/generated/properties/io/opentelemetry/sdk/trace") | ||||
|         outputs.dir(propertiesDir) | ||||
| 
 | ||||
|         doLast { | ||||
|             File(propertiesDir, "version.properties").writeText("sdk.version=${project.version}") | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Loading…
	
		Reference in New Issue