-
Notifications
You must be signed in to change notification settings - Fork 313
Update apache instrumentation build.gradle files to kotlin #9551
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import groovy.lang.Closure | ||
|
||
plugins { | ||
`java-library` | ||
} | ||
|
||
muzzle { | ||
pass { | ||
group = "org.apache.httpcomponents" | ||
module = "httpasyncclient" | ||
versions = "[4.0,)" | ||
assertInverse = true | ||
} | ||
} | ||
|
||
apply(from = "$rootDir/gradle/java.gradle") | ||
|
||
// Helper extension for custom method from Groovy DSL | ||
fun addTestSuiteForDir(name: String, dirName: String) { | ||
(project.extra["addTestSuiteForDir"] as? Closure<*>)?.call(name, dirName) | ||
} | ||
|
||
addTestSuiteForDir("latestDepTest", "test") | ||
|
||
dependencies { | ||
compileOnly("org.apache.httpcomponents:httpasyncclient:4.0") | ||
|
||
testImplementation("org.apache.httpcomponents:httpasyncclient:4.0") | ||
|
||
// Kotlin accessors are not generated if not created by a plugin or explicitly declared | ||
add("latestDepTestImplementation", "org.apache.httpcomponents:httpasyncclient:+") | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import groovy.lang.Closure | ||
|
||
plugins { | ||
`java-library` | ||
} | ||
|
||
muzzle { | ||
fail { | ||
group = "commons-httpclient" | ||
module = "commons-httpclient" | ||
versions = "[,4.0)" | ||
skipVersions += "3.1-jenkins-1" | ||
skipVersions += "2.0-final" // broken metadata on maven central | ||
} | ||
pass { | ||
group = "org.apache.httpcomponents" | ||
module = "httpclient" | ||
versions = "[4.0,5)" | ||
assertInverse = true | ||
} | ||
pass { | ||
// We want to support the dropwizard clients too. | ||
group = "io.dropwizard" | ||
module = "dropwizard-client" | ||
versions = "[,3)" // dropwizard-client 3+ uses httpclient5 | ||
} | ||
} | ||
|
||
apply(from = "$rootDir/gradle/java.gradle") | ||
|
||
// Helper extensions for custom methods from Groovy DSL | ||
fun addTestSuite(name: String) { | ||
(project.extra["addTestSuite"] as? Closure<*>)?.call(name) | ||
} | ||
fun addTestSuiteForDir(name: String, dirName: String) { | ||
(project.extra["addTestSuiteForDir"] as? Closure<*>)?.call(name, dirName) | ||
} | ||
fun addTestSuiteExtendingForDir(testSuiteName: String, parentSuiteName: String, dirName: String) { | ||
(project.extra["addTestSuiteExtendingForDir"] as? Closure<*>)?.call(testSuiteName, parentSuiteName, dirName) | ||
} | ||
Comment on lines
+31
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: Having these is actually why I'm holding off on migrating every build gradle to kotlin. That doesn't mean it shouldn't happen there as now we have an example of some pain points. Ideally, our
E.g.g this comment => Now as I'm mentioning convention plugins, the idea is to identify conventions and name them, for example instrumenqation projects could have a convention plugin
Everything Resources:
Note those link are referring to the 8.14.3, but script plugins are barely mentioned in Gradle 9, apart that they are not recommended, meaning it's likely Gradle will phase out these. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see, thanks for all of the context! |
||
|
||
addTestSuiteForDir("latestDepTest", "test") | ||
addTestSuite("iastIntegrationTest") | ||
addTestSuiteExtendingForDir("v41IastIntegrationTest", "iastIntegrationTest", "iastIntegrationTest") | ||
addTestSuiteExtendingForDir("v42IastIntegrationTest", "iastIntegrationTest", "iastIntegrationTest") | ||
addTestSuiteExtendingForDir("v43IastIntegrationTest", "iastIntegrationTest", "iastIntegrationTest") | ||
addTestSuiteExtendingForDir("v44IastIntegrationTest", "iastIntegrationTest", "iastIntegrationTest") | ||
addTestSuiteExtendingForDir("v45IastIntegrationTest", "iastIntegrationTest", "iastIntegrationTest") | ||
|
||
dependencies { | ||
compileOnly("org.apache.httpcomponents:httpclient:4.0") | ||
testImplementation(project(":dd-java-agent:agent-iast:iast-test-fixtures")) | ||
testImplementation("org.apache.httpcomponents:httpclient:4.0") | ||
testImplementation(project(":dd-java-agent:instrumentation:apache-httpclient:apache-httpasyncclient-4.0")) | ||
// to instrument the integration test | ||
"iastIntegrationTestImplementation"(project(":dd-java-agent:agent-iast:iast-test-fixtures")) | ||
"iastIntegrationTestImplementation"("org.apache.httpcomponents:httpclient:4.0") | ||
"iastIntegrationTestRuntimeOnly"(project(":dd-java-agent:instrumentation:jetty:jetty-server:jetty-server-9.0")) | ||
"iastIntegrationTestRuntimeOnly"(project(":dd-java-agent:instrumentation:apache-httpcore:apache-httpcore-4.0")) | ||
"iastIntegrationTestRuntimeOnly"(project(":dd-java-agent:instrumentation:servlet")) | ||
"iastIntegrationTestRuntimeOnly"(project(":dd-java-agent:instrumentation:java-lang")) | ||
"iastIntegrationTestRuntimeOnly"(project(":dd-java-agent:instrumentation:java-net")) | ||
"iastIntegrationTestRuntimeOnly"(project(":dd-java-agent:instrumentation:iast-instrumenter")) | ||
Comment on lines
+56
to
+63
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: This code is an example of the kotlin's invoke operator:
So "iastIntegrationTestRuntimeOnly"(project(":dd-java-agent:instrumentation:iast-instrumenter")) is actually : "iastIntegrationTestRuntimeOnly".invoke(project(":dd-java-agent:instrumentation:iast-instrumenter")) which is nice since it allows you to see the method, and access its definition and javadoc. Also, note that since add("iastIntegrationTestRuntimeOnly", project(":dd-java-agent:instrumentation:iast-instrumenter")) |
||
|
||
"v41IastIntegrationTestImplementation"("org.apache.httpcomponents:httpclient:4.1") | ||
"v42IastIntegrationTestImplementation"("org.apache.httpcomponents:httpclient:4.2") | ||
"v43IastIntegrationTestImplementation"("org.apache.httpcomponents:httpclient:4.3") | ||
"v44IastIntegrationTestImplementation"("org.apache.httpcomponents:httpclient:4.4") | ||
"v45IastIntegrationTestImplementation"("org.apache.httpcomponents:httpclient:4.5") | ||
|
||
// Kotlin accessors are not generated if not created by a plugin or explicitly declared | ||
add("latestDepTestImplementation", "org.apache.httpcomponents:httpclient:+") | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import groovy.lang.Closure | ||
|
||
plugins { | ||
`java-library` | ||
} | ||
|
||
muzzle { | ||
pass { | ||
group = "org.apache.httpcomponents.client5" | ||
module = "httpclient5" | ||
versions = "[5.0,)" | ||
assertInverse = true | ||
} | ||
} | ||
|
||
apply(from = "$rootDir/gradle/java.gradle") | ||
|
||
// Helper extension for custom method from Groovy DSL | ||
fun addTestSuiteForDir(name: String, dirName: String) { | ||
(project.extra["addTestSuiteForDir"] as? Closure<*>)?.call(name, dirName) | ||
} | ||
|
||
addTestSuiteForDir("latestDepTest", "test") | ||
|
||
dependencies { | ||
compileOnly("org.apache.httpcomponents.client5:httpclient5:5.0") | ||
|
||
testImplementation("org.apache.httpcomponents.client5:httpclient5:5.0") | ||
|
||
// Kotlin accessors are not generated if not created by a plugin or explicitly declared | ||
add("latestDepTestImplementation", "org.apache.httpcomponents.client5:httpclient5:+") | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import groovy.lang.Closure | ||
|
||
plugins { | ||
`java-library` | ||
} | ||
|
||
muzzle { | ||
pass { | ||
group = "org.apache.httpcomponents" | ||
module = "httpcore" | ||
versions = "[4.0,5)" | ||
assertInverse = true | ||
} | ||
} | ||
|
||
apply(from = "$rootDir/gradle/java.gradle") | ||
|
||
// Helper extensions for custom methods from Groovy DSL | ||
fun addTestSuiteForDir(name: String, dirName: String) { | ||
(project.extra["addTestSuiteForDir"] as? Closure<*>)?.call(name, dirName) | ||
} | ||
|
||
addTestSuiteForDir("latestDepTest", "test") | ||
|
||
dependencies { | ||
compileOnly("org.apache.httpcomponents:httpcore:4.0") | ||
|
||
testImplementation("org.apache.httpcomponents:httpcore:4.0") | ||
|
||
// Kotlin accessors are not generated if not created by a plugin or explicitly declared | ||
add("latestDepTestImplementation", "org.apache.httpcomponents:httpcore:+") | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import groovy.lang.Closure | ||
|
||
plugins { | ||
`java-library` | ||
} | ||
|
||
muzzle { | ||
pass { | ||
group = "org.apache.httpcomponents.core5" | ||
module = "httpcore5" | ||
versions = "[5.0,)" | ||
assertInverse = true | ||
} | ||
} | ||
|
||
apply(from = "$rootDir/gradle/java.gradle") | ||
|
||
// Helper extensions for custom methods from Groovy DSL | ||
fun addTestSuiteForDir(name: String, dirName: String) { | ||
(project.extra["addTestSuiteForDir"] as? Closure<*>)?.call(name, dirName) | ||
} | ||
|
||
addTestSuiteForDir("latestDepTest", "test") | ||
|
||
dependencies { | ||
compileOnly("org.apache.httpcomponents.core5:httpcore5:5.0") | ||
|
||
testImplementation("org.apache.httpcomponents.core5:httpcore5:5.0") | ||
|
||
// Kotlin accessors are not generated if not created by a plugin or explicitly declared | ||
add("latestDepTestImplementation", "org.apache.httpcomponents.core5:httpcore5:+") | ||
} |
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.
Probably Kotlin alternative should be something like:
See: https://github.com/unbroken-dome/gradle-testsets-plugin
Here and other similar places.
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.
@AlexeyKuznetsov-DD That's an interesting plugin, but I'd rather hold until we have a discussion on conventions plugins.