-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Use TestArtifact plugin instead of custom test jar tasks #75931
Use TestArtifact plugin instead of custom test jar tasks #75931
Conversation
6ae3f0d
to
bd21695
Compare
bd21695
to
b93993a
Compare
Pinging @elastic/es-delivery (Team:Delivery) |
artifacts { | ||
testArtifacts testJar | ||
} | ||
|
||
subprojects { | ||
// Use tests from the root security qa project in subprojects | ||
configurations.create('testArtifacts') |
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.
Shouldn't the plugin create this configuration?
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.
no. this is the consuming project. the plugin is just for providing the artifact. for consuming we only added the testArtifact
convenience method see
Lines 57 to 74 in fd6d966
/** | |
* This is a convenient method for declaring test artifact dependencies provided by the internal | |
* test artifact plugin. It replaces basically the longer dependency notation with explicit capability | |
* declaration like this: | |
* | |
* testImplementation(project(xpackModule('repositories-metering-api'))) { | |
* capabilities { | |
* requireCapability("org.elasticsearch.gradle:repositories-metering-api-test-artifacts") | |
* } | |
* } | |
* | |
* */ | |
ext.testArtifact = { p, String name = "test" -> | |
def projectDependency = p.dependencies.create(p) | |
projectDependency.capabilities { | |
requireCapabilities("org.elasticsearch.gradle:${projectDependency.name}-${name}-artifacts") | |
}; | |
} |
@@ -24,7 +15,9 @@ subprojects { | |||
|
|||
dependencies { | |||
testImplementation project(":x-pack:plugin:core") | |||
testArtifacts project(path: mainProject.path, configuration: 'testArtifacts') | |||
testArtifacts(testArtifact(project(mainProject.path))) { | |||
transitive = false |
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.
Why do we have to disable transitive dependencies here? Couldn't we do this on the configuration?
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.
true. changed to be done on the configuration
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.
👍
@elasticmachine update branch |
Make use of test artifact plugin and avoid using custom test jars created manually. Co-authored-by: Elastic Machine <[email protected]>
…6189) Make use of test artifact plugin and avoid using custom test jars created manually. Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
simplifies build logic and avoids custom creation of test artifacts