-
Notifications
You must be signed in to change notification settings - Fork 355
Apply Java convention from remaining projects #12331
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
Open
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
build-logic/conventions/src/main/kotlin/dd-trace-java.conventions.testing.kotlin.gradle.kts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import org.gradle.api.artifacts.VersionCatalogsExtension | ||
| import org.gradle.api.file.SourceDirectorySet | ||
| import org.gradle.api.plugins.jvm.JvmTestSuite | ||
| import org.gradle.api.tasks.SourceSet | ||
| import org.gradle.api.tasks.SourceSetContainer | ||
| import org.gradle.api.tasks.compile.GroovyCompile | ||
| import org.gradle.api.tasks.compile.JavaCompile | ||
| import org.gradle.kotlin.dsl.getByType | ||
| import org.gradle.kotlin.dsl.named | ||
| import org.gradle.kotlin.dsl.withType | ||
| import org.gradle.testing.base.TestingExtension | ||
|
|
||
| val libs = extensions.getByType<VersionCatalogsExtension>().named("libs") | ||
|
|
||
| // Make compiled Kotlin classes visible to Groovy/Spock tests. | ||
| fun wireKotlinOutputToGroovy(sourceSet: SourceSet) { | ||
| val compileKotlin = tasks.named(sourceSet.getCompileTaskName("kotlin")) | ||
| tasks.named<GroovyCompile>(sourceSet.getCompileTaskName("groovy")) { | ||
| // Task-backed outputs avoid a Kotlin Gradle plugin API dependency and retain task ordering. | ||
| classpath += files(compileKotlin) | ||
| } | ||
| } | ||
|
|
||
| pluginManager.withPlugin("org.jetbrains.kotlin.jvm") { | ||
| val sourceSets = extensions.getByType<SourceSetContainer>() | ||
|
|
||
| // Having Groovy, Kotlin and Java in the same project is a bit problematic. | ||
| // Remove Kotlin from main to avoid compilation issues. | ||
| sourceSets.named(SourceSet.MAIN_SOURCE_SET_NAME) { | ||
| val kotlin = extensions.getByName("kotlin") as SourceDirectorySet | ||
| kotlin.setSrcDirs(emptyList<Any>()) | ||
| java.setSrcDirs(listOf("src/main/java")) | ||
| } | ||
|
|
||
| // Create Kotlin output directories to make JavaCompile tasks work. | ||
| val createKotlinDirs = tasks.register("createKotlinDirs") { | ||
| val dirsToCreate = listOf(layout.buildDirectory.dir("classes/kotlin/main")) | ||
| doFirst { | ||
| dirsToCreate.forEach { it.get().asFile.mkdirs() } | ||
| } | ||
| outputs.dirs(dirsToCreate) | ||
| } | ||
|
|
||
| tasks.withType<JavaCompile>().configureEach { | ||
| inputs.files(createKotlinDirs) | ||
| } | ||
|
|
||
| // Prevent Kotlin libraries from being included in the tracer JAR. | ||
| dependencies.add("compileOnly", libs.findLibrary("kotlin").get()) | ||
|
|
||
| pluginManager.withPlugin("groovy") { | ||
| pluginManager.withPlugin("jvm-test-suite") { | ||
| extensions.getByType<TestingExtension>().suites.withType<JvmTestSuite>().configureEach { | ||
| wireKotlinOutputToGroovy(sources) | ||
| } | ||
| } | ||
|
|
||
| pluginManager.withPlugin("java-test-fixtures") { | ||
| sourceSets.named("testFixtures") { | ||
| wireKotlinOutputToGroovy(this) | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,10 @@ | ||
| apply from: "$rootDir/gradle/java.gradle" | ||
| plugins { | ||
| id 'dd-trace-java.conventions.java' | ||
| } | ||
|
|
||
| description = 'Integration Level Agent benchmarks.' | ||
|
|
||
| java { | ||
| sourceCompatibility = JavaVersion.VERSION_1_8 | ||
| targetCompatibility = JavaVersion.VERSION_1_8 | ||
| } | ||
|
|
||
| subprojects { sub -> | ||
| sub.apply plugin: 'com.gradleup.shadow' | ||
| sub.apply from: "$rootDir/gradle/java.gradle" | ||
| } |
5 changes: 5 additions & 0 deletions
5
dd-java-agent/benchmark-integration/jetty-perftest/build.gradle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
dd-java-agent/benchmark-integration/play-perftest/build.gradle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| plugins { | ||
| id 'com.gradleup.shadow' | ||
| id 'dd-trace-java.conventions.java' | ||
| id 'org.gradle.playframework' | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: The java convention for this module might be too large, but this follows what's existing today.
In the future, a proper convention should be created
dd-trace-java.module.distributable.agentfor agent jar, this might help to have multiple kind of agent jar distribution (modularization).The following aspects appears to be needed
Some other "features" may not be needed.