Skip to content

Commit 29053d2

Browse files
committed
Fix DRA dependenciesInfo task dependency resolution
With tweaking sourcesJar and javadoc generation in elastic#128659 we broke variant selection for dependenciesInfo information as there are now multiple artifacts available with category "documentation". This fixes the resolution by adding the explicit usage attribute to allow distinguishing.
1 parent 98e9514 commit 29053d2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/DependenciesInfoPlugin.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@
1515
import org.gradle.api.Project;
1616
import org.gradle.api.artifacts.Configuration;
1717
import org.gradle.api.attributes.Category;
18+
import org.gradle.api.attributes.Usage;
1819
import org.gradle.api.plugins.JavaPlugin;
1920

2021
public class DependenciesInfoPlugin implements Plugin<Project> {
22+
23+
public static String USAGE_ATTRIBUTE = "DependenciesInfo";
24+
2125
@Override
2226
public void apply(final Project project) {
2327
project.getPlugins().apply(CompileOnlyResolvePlugin.class);
@@ -43,6 +47,12 @@ public void apply(final Project project) {
4347
)
4448
);
4549

50+
dependenciesInfoFilesConfiguration.attributes(
51+
attributes -> attributes.attribute(
52+
Usage.USAGE_ATTRIBUTE,
53+
project.getObjects().named(Usage.class, USAGE_ATTRIBUTE)
54+
)
55+
);
4656
project.getArtifacts().add("dependenciesInfoFiles", depsInfo);
4757

4858
}

distribution/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ configurations {
3131
attributes {
3232
attribute(Category.CATEGORY_ATTRIBUTE, project.getObjects().named(Category.class, Category.DOCUMENTATION))
3333
}
34+
attributes {
35+
attribute(Usage.USAGE_ATTRIBUTE, project.getObjects().named(Usage.class, DependenciesInfoPlugin.USAGE_ATTRIBUTE))
36+
}
3437
}
3538
featuresMetadata {
3639
attributes {

0 commit comments

Comments
 (0)