Skip to content
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

Merged
merged 3 commits into from
Aug 4, 2021

Conversation

breskeby
Copy link
Contributor

@breskeby breskeby commented Aug 2, 2021

simplifies build logic and avoids custom creation of test artifacts

@breskeby breskeby self-assigned this Aug 2, 2021
@breskeby breskeby added :Delivery/Build Build or test infrastructure >enhancement Team:Delivery Meta label for Delivery team v7.15.0 v8.0.0 labels Aug 2, 2021
@breskeby breskeby force-pushed the use-internal-test-artifact-plugin branch from 6ae3f0d to bd21695 Compare August 2, 2021 10:48
@breskeby breskeby force-pushed the use-internal-test-artifact-plugin branch from bd21695 to b93993a Compare August 2, 2021 13:39
@breskeby breskeby marked this pull request as ready for review August 2, 2021 14:46
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-delivery (Team:Delivery)

artifacts {
testArtifacts testJar
}

subprojects {
// Use tests from the root security qa project in subprojects
configurations.create('testArtifacts')
Copy link
Contributor

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?

Copy link
Contributor Author

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

/**
* 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
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

@mark-vieira mark-vieira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@breskeby
Copy link
Contributor Author

breskeby commented Aug 4, 2021

@elasticmachine update branch

@breskeby breskeby merged commit 2d7d3bd into elastic:master Aug 4, 2021
breskeby added a commit to breskeby/elasticsearch that referenced this pull request Aug 5, 2021
Make use of test artifact plugin and avoid using custom test jars created manually.

Co-authored-by: Elastic Machine <[email protected]>
elasticsearchmachine pushed a commit that referenced this pull request Aug 5, 2021
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure >enhancement Team:Delivery Meta label for Delivery team v7.15.0 v8.0.0-alpha2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants