-
Notifications
You must be signed in to change notification settings - Fork 25.5k
[Gradle] Configure transitive dependencies via ComponentMetadataRules #134169
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
Changes from 22 commits
8751472
59264a2
5f1b804
20f416d
14593b8
814a9d2
0c1a829
5d5bb2f
648215a
a2a9662
f33bd6e
d65134f
67bbdb1
40a5310
39037a0
e60b844
0583229
b71a256
7da2a33
9421e1b
46320da
07b823f
11e1d48
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,10 @@ gradlePlugin { | |
id = 'elasticsearch.build-complete' | ||
implementationClass = 'org.elasticsearch.gradle.internal.ElasticsearchBuildCompletePlugin' | ||
} | ||
componentMetadataRules { | ||
id = 'elasticsearch.component-metadata-rules' | ||
implementationClass = 'org.elasticsearch.gradle.internal.dependencies.rules.ComponentMetadataRulesPlugin' | ||
} | ||
distro { | ||
id = 'elasticsearch.distro' | ||
implementationClass = 'org.elasticsearch.gradle.internal.distribution.ElasticsearchDistributionPlugin' | ||
|
@@ -281,6 +285,9 @@ dependencies { | |
testImplementation buildLibs.asm | ||
integTestImplementation buildLibs.asm | ||
api(buildLibs.snakeyaml) | ||
api("org.slf4j:slf4j-api:2.0.6") { | ||
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. as part of this I tried to get rid of some of the 8 slf4j-api dependencies we use in our build by aligning some versions used in the build tools and third party plugins |
||
because("Align with what we use in production") | ||
} | ||
} | ||
// Forcefully downgrade the jackson platform as used in production | ||
api enforcedPlatform(buildLibs.jackson.platform) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
import org.gradle.api.artifacts.result.ResolvedComponentResult; | ||
import org.gradle.api.artifacts.result.ResolvedDependencyResult; | ||
import org.gradle.api.attributes.LibraryElements; | ||
import org.gradle.api.attributes.Usage; | ||
import org.gradle.api.file.FileCollection; | ||
import org.gradle.api.logging.Logger; | ||
import org.gradle.api.plugins.JavaPlugin; | ||
|
@@ -75,12 +76,13 @@ void configureCompileModulePath(Project project) { | |
it.extendsFrom(compileClasspath); | ||
it.setCanBeResolved(true); | ||
it.setCanBeConsumed(false); // we don't want this configuration used by dependent projects | ||
it.attributes( | ||
attrs -> attrs.attribute( | ||
it.attributes(attrs -> { | ||
attrs.attribute( | ||
LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, | ||
project.getObjects().named(LibraryElements.class, LibraryElements.CLASSES) | ||
) | ||
); | ||
); | ||
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. Ensure the module compile classpath is actually resolves |
||
attrs.attribute(Usage.USAGE_ATTRIBUTE, project.getObjects().named(Usage.class, Usage.JAVA_API)); | ||
}); | ||
}).getIncoming().artifactView(it -> { | ||
it.componentFilter(cf -> { | ||
var visited = new HashSet<ComponentIdentifier>(); | ||
|
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.
we share these common applied rules as plugin for serverless to reuse them