From dc944a8d0975f8ef2679ecea329ed3b5ee489608 Mon Sep 17 00:00:00 2001 From: Rene Groeschke Date: Thu, 9 Oct 2025 21:14:04 +0200 Subject: [PATCH] Fix dependency reporting (#136209) This has been broken since 9.0.3. likely due to some swallowed api change in Gradle. This fixes and adds test coverage to dependency reporting used in DRA artifacts building Fix interdependency to Licenses task (cherry picked from commit f74406d4b1c94db769a0260f0918eb8be0bf4146) # Conflicts: # x-pack/plugin/core/build.gradle --- .../internal/BuildPluginFuncTest.groovy | 25 ++++++++++- .../internal/AbstractDependenciesTask.java | 44 +++++++++++++++++++ .../internal/DependenciesInfoPlugin.java | 7 +-- .../gradle/internal/DependenciesInfoTask.java | 25 +++++------ .../precommit/DependencyLicensesTask.java | 37 ++-------------- .../internal/util/DependenciesUtils.java | 11 ++++- client/sniffer/build.gradle | 3 +- distribution/build.gradle | 5 +++ modules/ingest-geoip/build.gradle | 6 ++- modules/repository-s3/build.gradle | 3 +- plugins/analysis-ukrainian/build.gradle | 4 +- plugins/discovery-ec2/build.gradle | 5 ++- .../es-opensaml-security-api/build.gradle | 4 +- x-pack/plugin/core/build.gradle | 3 +- x-pack/plugin/identity-provider/build.gradle | 4 +- x-pack/plugin/inference/build.gradle | 4 +- x-pack/plugin/security/build.gradle | 4 +- 17 files changed, 131 insertions(+), 63 deletions(-) create mode 100644 build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/AbstractDependenciesTask.java diff --git a/build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/BuildPluginFuncTest.groovy b/build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/BuildPluginFuncTest.groovy index b223546623a00..a6b4cce5e9657 100644 --- a/build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/BuildPluginFuncTest.groovy +++ b/build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/BuildPluginFuncTest.groovy @@ -151,7 +151,11 @@ class BuildPluginFuncTest extends AbstractGradleFuncTest { tasks.named('checkstyleMain').configure { enabled = false } tasks.named('loggerUsageCheck').configure { enabled = false } // tested elsewhere - tasks.named('thirdPartyAudit').configure { enabled = false } + tasks.named('thirdPartyAudit').configure { + getRuntimeJavaVersion().set(JavaVersion.VERSION_21) + getTargetCompatibility().set(JavaVersion.VERSION_21) + enabled = false + } """ when: def result = gradleRunner("check").build() @@ -167,6 +171,25 @@ class BuildPluginFuncTest extends AbstractGradleFuncTest { result.task(":loggerUsageCheck").outcome == TaskOutcome.SKIPPED } + def "can generate dependency infos file"() { + given: + repository.generateJar("junit", "junit", "4.12", 'org.acme.JunitMock') + repository.configureBuild(buildFile) + file("licenses/junit-4.12.jar.sha1").text = "2973d150c0dc1fefe998f834810d68f278ea58ec" + file("licenses/junit-LICENSE.txt").text = EXAMPLE_LICENSE + file("licenses/junit-NOTICE.txt").text = "mock notice" + buildFile << """ + dependencies { + api "junit:junit:4.12" + } + """ + when: + def result = gradleRunner("dependenciesInfo").build() + then: + result.task(":dependenciesInfo").outcome == TaskOutcome.SUCCESS + file("build/reports/dependencies/dependencies.csv").text == "junit:junit,4.12,https://repo1.maven.org/maven2/junit/junit/4.12,BSD-3-Clause,\n" + } + def assertValidJar(File jar) { try (ZipFile zipFile = new ZipFile(jar)) { ZipEntry licenseEntry = zipFile.getEntry("META-INF/LICENSE.txt") diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/AbstractDependenciesTask.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/AbstractDependenciesTask.java new file mode 100644 index 0000000000000..141ea7ed5d6a7 --- /dev/null +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/AbstractDependenciesTask.java @@ -0,0 +1,44 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +package org.elasticsearch.gradle.internal; + +import org.gradle.api.DefaultTask; +import org.gradle.api.InvalidUserDataException; +import org.gradle.api.provider.MapProperty; +import org.gradle.api.tasks.Input; +import org.gradle.api.tasks.Optional; + +import java.util.Map; + +public abstract class AbstractDependenciesTask extends DefaultTask { + + @Input + @Optional + public abstract MapProperty getMappings(); + + /** + * Add a mapping from a regex pattern for the jar name, to a prefix to find + * the LICENSE and NOTICE file for that jar. + */ + public void mapping(Map props) { + String from = props.get("from"); + if (from == null) { + throw new InvalidUserDataException("Missing \"from\" setting for license name mapping"); + } + String to = props.get("to"); + if (to == null) { + throw new InvalidUserDataException("Missing \"to\" setting for license name mapping"); + } + if (props.size() > 2) { + throw new InvalidUserDataException("Unknown properties for mapping on dependencyLicenses: " + props.keySet()); + } + getMappings().put(from, to); + } +} diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/DependenciesInfoPlugin.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/DependenciesInfoPlugin.java index 669d1b5078dab..9e45ec978be8c 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/DependenciesInfoPlugin.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/DependenciesInfoPlugin.java @@ -17,6 +17,8 @@ import org.gradle.api.attributes.Usage; import org.gradle.api.plugins.JavaPlugin; +import static org.elasticsearch.gradle.internal.util.DependenciesUtils.createNonTransitiveArtifactsView; + public class DependenciesInfoPlugin implements Plugin { public static String USAGE_ATTRIBUTE = "DependenciesInfo"; @@ -25,16 +27,15 @@ public class DependenciesInfoPlugin implements Plugin { public void apply(final Project project) { project.getPlugins().apply(CompileOnlyResolvePlugin.class); var depsInfo = project.getTasks().register("dependenciesInfo", DependenciesInfoTask.class); - depsInfo.configure(t -> { var runtimeConfiguration = project.getConfigurations().getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME); - t.getRuntimeArtifacts().set(project.getProviders().provider(() -> runtimeConfiguration.getIncoming().getArtifacts())); + t.getRuntimeArtifacts() + .set(project.getProviders().provider(() -> createNonTransitiveArtifactsView(runtimeConfiguration).getArtifacts())); t.getClasspath().from(runtimeConfiguration); var compileOnlyConfiguration = project.getConfigurations() .getByName(CompileOnlyResolvePlugin.RESOLVEABLE_COMPILE_ONLY_CONFIGURATION_NAME); t.getCompileOnlyArtifacts().set(project.getProviders().provider(() -> compileOnlyConfiguration.getIncoming().getArtifacts())); t.getClasspath().from(compileOnlyConfiguration); - }); Configuration dependenciesInfoFilesConfiguration = project.getConfigurations().create("dependenciesInfoFiles"); dependenciesInfoFilesConfiguration.setCanBeResolved(false); diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/DependenciesInfoTask.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/DependenciesInfoTask.java index 90154d22e87f0..00c69ca081fd1 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/DependenciesInfoTask.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/DependenciesInfoTask.java @@ -17,19 +17,21 @@ import org.gradle.api.file.ConfigurableFileCollection; import org.gradle.api.file.DirectoryProperty; import org.gradle.api.file.ProjectLayout; -import org.gradle.api.internal.ConventionTask; import org.gradle.api.model.ObjectFactory; -import org.gradle.api.provider.MapProperty; import org.gradle.api.provider.Property; import org.gradle.api.provider.Provider; import org.gradle.api.provider.ProviderFactory; +import org.gradle.api.tasks.CacheableTask; +import org.gradle.api.tasks.Classpath; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.InputDirectory; -import org.gradle.api.tasks.InputFiles; import org.gradle.api.tasks.Internal; import org.gradle.api.tasks.Optional; import org.gradle.api.tasks.OutputFile; +import org.gradle.api.tasks.PathSensitive; +import org.gradle.api.tasks.PathSensitivity; import org.gradle.api.tasks.TaskAction; +import org.gradle.internal.component.external.model.ModuleComponentArtifactIdentifier; import java.io.File; import java.io.IOException; @@ -55,7 +57,8 @@ *
  • license: SPDX license identifier, custom license or UNKNOWN.
  • * */ -public abstract class DependenciesInfoTask extends ConventionTask { +@CacheableTask +public abstract class DependenciesInfoTask extends AbstractDependenciesTask { @Inject public abstract ProviderFactory getProviderFactory(); @@ -86,7 +89,7 @@ public Provider> getCompileOnlyModules() { * artifact transforms that might be applied and fail due to missing task dependency to jar * generating tasks. * */ - @InputFiles + @Classpath abstract ConfigurableFileCollection getClasspath(); private Provider> mapToModuleComponentIdentifiers(ArtifactCollection artifacts) { @@ -94,8 +97,9 @@ private Provider> mapToModuleComponentIdentifiers () -> artifacts.getArtifacts() .stream() .map(r -> r.getId()) - .filter(id -> id instanceof ModuleComponentIdentifier) - .map(id -> (ModuleComponentIdentifier) id) + .filter(mcaId -> mcaId instanceof ModuleComponentArtifactIdentifier) + .map(mcaId -> (ModuleComponentArtifactIdentifier) mcaId) + .map(it -> it.getComponentIdentifier()) .collect(Collectors.toSet()) ); } @@ -111,6 +115,7 @@ private Provider> mapToModuleComponentIdentifiers * Directory to read license files */ @Optional + @PathSensitive(PathSensitivity.RELATIVE) @InputDirectory public File getLicensesDir() { File asFile = licensesDir.get().getAsFile(); @@ -143,7 +148,6 @@ public DependenciesInfoTask(ProjectLayout projectLayout, ObjectFactory objectFac @TaskAction public void generateDependenciesInfo() throws IOException { - final Set compileOnlyIds = getCompileOnlyModules().map( set -> set.stream() .map(id -> id.getModuleIdentifier().getGroup() + ":" + id.getModuleIdentifier().getName() + ":" + id.getVersion()) @@ -166,7 +170,6 @@ public void generateDependenciesInfo() throws IOException { final String url = createURL(dep.getGroup(), moduleName, dep.getVersion()); final String dependencyName = DependencyLicensesTask.getDependencyName(mappings, moduleName); getLogger().info("mapped dependency " + dep.getGroup() + ":" + moduleName + " to " + dependencyName + " for license info"); - final String licenseType = getLicenseType(dep.getGroup(), dependencyName); output.append(dep.getGroup() + ":" + moduleName + "," + dep.getVersion() + "," + url + "," + licenseType + "\n"); } @@ -174,10 +177,6 @@ public void generateDependenciesInfo() throws IOException { Files.writeString(outputFile.toPath(), output.toString(), StandardOpenOption.CREATE); } - @Input - @Optional - public abstract MapProperty getMappings(); - /** * Create an URL on Maven Central * based on dependency coordinates. diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/DependencyLicensesTask.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/DependencyLicensesTask.java index e9efee4fa157d..75ae9997bda4d 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/DependencyLicensesTask.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/DependencyLicensesTask.java @@ -8,10 +8,9 @@ */ package org.elasticsearch.gradle.internal.precommit; +import org.elasticsearch.gradle.internal.AbstractDependenciesTask; import org.elasticsearch.gradle.internal.precommit.LicenseAnalyzer.LicenseInfo; -import org.gradle.api.DefaultTask; import org.gradle.api.GradleException; -import org.gradle.api.InvalidUserDataException; import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.component.ComponentIdentifier; import org.gradle.api.file.Directory; @@ -39,7 +38,6 @@ import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; -import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; @@ -94,7 +92,7 @@ * comply with the license terms. */ @CacheableTask -public abstract class DependencyLicensesTask extends DefaultTask { +public abstract class DependencyLicensesTask extends AbstractDependenciesTask { private final Pattern regex = Pattern.compile("-v?\\d+.*"); @@ -112,11 +110,6 @@ public abstract class DependencyLicensesTask extends DefaultTask { */ private final DirectoryProperty licensesDir; - /** - * A map of patterns to prefix, used to find the LICENSE and NOTICE file. - */ - private Map mappings = new LinkedHashMap<>(); - /** * Names of dependencies whose shas should not exist. */ @@ -128,25 +121,6 @@ public abstract class DependencyLicensesTask extends DefaultTask { private LinkedHashSet ignoreFiles = new LinkedHashSet<>(); private ProjectLayout projectLayout; - /** - * Add a mapping from a regex pattern for the jar name, to a prefix to find - * the LICENSE and NOTICE file for that jar. - */ - public void mapping(Map props) { - String from = props.get("from"); - if (from == null) { - throw new InvalidUserDataException("Missing \"from\" setting for license name mapping"); - } - String to = props.get("to"); - if (to == null) { - throw new InvalidUserDataException("Missing \"to\" setting for license name mapping"); - } - if (props.size() > 2) { - throw new InvalidUserDataException("Unknown properties for mapping on dependencyLicenses: " + props.keySet()); - } - mappings.put(from, to); - } - @Inject public DependencyLicensesTask(ObjectFactory objects, ProjectLayout projectLayout) { this.projectLayout = projectLayout; @@ -267,7 +241,7 @@ private void checkDependencies(Map licenses, Map getIgnoreFiles() { return new LinkedHashSet<>(ignoreFiles); } - @Input - public LinkedHashMap getMappings() { - return new LinkedHashMap<>(mappings); - } - /** * Convencience method for configuring dependencies to be checked and ignoring transitive dependencies for now. * */ diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/util/DependenciesUtils.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/util/DependenciesUtils.java index 7120a5f907ddb..59e4829376552 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/util/DependenciesUtils.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/util/DependenciesUtils.java @@ -11,6 +11,7 @@ import com.github.jengelman.gradle.plugins.shadow.ShadowBasePlugin; +import org.gradle.api.artifacts.ArtifactView; import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.ResolvableDependencies; import org.gradle.api.artifacts.component.ComponentIdentifier; @@ -31,6 +32,14 @@ public static FileCollection createFileCollectionFromNonTransitiveArtifactsView( Configuration configuration, Spec componentFilter ) { + return createNonTransitiveArtifactsView(configuration, componentFilter).getFiles(); + } + + public static ArtifactView createNonTransitiveArtifactsView(Configuration configuration) { + return createNonTransitiveArtifactsView(configuration, identifier -> true); + } + + public static ArtifactView createNonTransitiveArtifactsView(Configuration configuration, Spec componentFilter) { ResolvableDependencies incoming = configuration.getIncoming(); return incoming.artifactView(viewConfiguration -> { Provider> firstLevelDependencyComponents = incoming.getResolutionResult() @@ -47,7 +56,7 @@ public static FileCollection createFileCollectionFromNonTransitiveArtifactsView( viewConfiguration.componentFilter( new AndSpec<>(identifier -> firstLevelDependencyComponents.get().contains(identifier), componentFilter) ); - }).getFiles(); + }); } /** diff --git a/client/sniffer/build.gradle b/client/sniffer/build.gradle index 38fc949a5c7c8..0c3e044f239e6 100644 --- a/client/sniffer/build.gradle +++ b/client/sniffer/build.gradle @@ -17,6 +17,7 @@ * under the License. */ import org.elasticsearch.gradle.internal.conventions.precommit.LicenseHeadersTask +import org.elasticsearch.gradle.internal.AbstractDependenciesTask apply plugin: 'elasticsearch.build' apply plugin: 'elasticsearch.publish' @@ -67,7 +68,7 @@ tasks.named('forbiddenApisTest').configure { replaceSignatureFiles 'jdk-signatures' } -tasks.named("dependencyLicenses").configure { +tasks.withType(AbstractDependenciesTask).configureEach { mapping from: /http.*/, to: 'httpclient' mapping from: /commons-.*/, to: 'commons' } diff --git a/distribution/build.gradle b/distribution/build.gradle index e13449f4036bf..5fe8620390e10 100644 --- a/distribution/build.gradle +++ b/distribution/build.gradle @@ -83,6 +83,11 @@ tasks.register("generateDependenciesReport", ConcatFilesTask) { 'https://oss-dependencies.elastic.co/red-hat-universal-base-image-minimal/9/ubi-minimal-9-source.tar.gz' ] additionalLines << rhelUbiFields.join(',') + doLast { + if(target.text.readLines().size() < 100) { + throw new GradleException("Suspiciously low number of dependencies. Double check.") + } + } } /***************************************************************************** diff --git a/modules/ingest-geoip/build.gradle b/modules/ingest-geoip/build.gradle index bdda4872fb4dc..cc1bae5c9d5f1 100644 --- a/modules/ingest-geoip/build.gradle +++ b/modules/ingest-geoip/build.gradle @@ -8,6 +8,7 @@ */ import org.elasticsearch.gradle.OS +import org.elasticsearch.gradle.internal.AbstractDependenciesTask apply plugin: 'elasticsearch.internal-yaml-rest-test' apply plugin: 'elasticsearch.yaml-rest-compat-test' @@ -78,10 +79,13 @@ tasks.named("forbiddenPatterns").configure { exclude '**/*.mmdb' } -tasks.named("dependencyLicenses").configure { +tasks.withType(AbstractDependenciesTask).configureEach { mapping from: /geoip.*/, to: 'maxmind-geolite2-eula' mapping from: /maxmind-db.*/, to: 'maxmind-db-reader' mapping from: /jackson.*/, to: 'jackson' +} + +tasks.named("dependencyLicenses").configure { ignoreFile 'elastic-geoip-database-service-agreement-LICENSE.txt' } diff --git a/modules/repository-s3/build.gradle b/modules/repository-s3/build.gradle index aef6e96f4a8f0..55974565edcfa 100644 --- a/modules/repository-s3/build.gradle +++ b/modules/repository-s3/build.gradle @@ -8,6 +8,7 @@ */ import org.apache.tools.ant.filters.ReplaceTokens import org.elasticsearch.gradle.internal.test.InternalClusterTestPlugin +import org.elasticsearch.gradle.internal.AbstractDependenciesTask apply plugin: 'elasticsearch.internal-yaml-rest-test' apply plugin: 'elasticsearch.internal-cluster-test' @@ -89,7 +90,7 @@ restResources { } } -tasks.named("dependencyLicenses").configure { +tasks.withType(AbstractDependenciesTask).configureEach { mapping from: 'annotations', to: 'aws-sdk-2' mapping from: 'apache-client', to: 'aws-sdk-2' mapping from: 'arns', to: 'aws-sdk-2' diff --git a/plugins/analysis-ukrainian/build.gradle b/plugins/analysis-ukrainian/build.gradle index a6414ae673e2c..b30e18ab578dd 100644 --- a/plugins/analysis-ukrainian/build.gradle +++ b/plugins/analysis-ukrainian/build.gradle @@ -6,6 +6,8 @@ * your election, the "Elastic License 2.0", the "GNU Affero General Public * License v3.0 only", or the "Server Side Public License, v 1". */ +import org.elasticsearch.gradle.internal.AbstractDependenciesTask + apply plugin: 'elasticsearch.internal-yaml-rest-test' apply plugin: 'elasticsearch.yaml-rest-compat-test' @@ -27,7 +29,7 @@ restResources { } } -tasks.named("dependencyLicenses").configure { +tasks.withType(AbstractDependenciesTask).configureEach { mapping from: /lucene-.*/, to: 'lucene' mapping from: /morfologik-.*/, to: 'lucene' } diff --git a/plugins/discovery-ec2/build.gradle b/plugins/discovery-ec2/build.gradle index f4eb1d3a90f01..a11673cdb7bdd 100644 --- a/plugins/discovery-ec2/build.gradle +++ b/plugins/discovery-ec2/build.gradle @@ -6,6 +6,8 @@ * your election, the "Elastic License 2.0", the "GNU Affero General Public * License v3.0 only", or the "Server Side Public License, v 1". */ +import org.elasticsearch.gradle.internal.AbstractDependenciesTask + apply plugin: 'elasticsearch.internal-cluster-test' apply plugin: 'elasticsearch.internal-java-rest-test' apply plugin: 'elasticsearch.internal-cluster-test' @@ -16,7 +18,6 @@ esplugin { } dependencies { - implementation "software.amazon.awssdk:annotations:${versions.awsv2sdk}" implementation "software.amazon.awssdk:apache-client:${versions.awsv2sdk}" implementation "software.amazon.awssdk:auth:${versions.awsv2sdk}" @@ -67,7 +68,7 @@ dependencies { internalClusterTestImplementation project(':test:fixtures:ec2-imds-fixture') } -tasks.named("dependencyLicenses").configure { +tasks.withType(AbstractDependenciesTask).configureEach { mapping from: 'annotations', to: 'aws-sdk-2' mapping from: 'apache-client', to: 'aws-sdk-2' mapping from: 'auth', to: 'aws-sdk-2' diff --git a/x-pack/libs/es-opensaml-security-api/build.gradle b/x-pack/libs/es-opensaml-security-api/build.gradle index 3b4434ec5d9e5..f3b69561e9af7 100644 --- a/x-pack/libs/es-opensaml-security-api/build.gradle +++ b/x-pack/libs/es-opensaml-security-api/build.gradle @@ -5,6 +5,8 @@ * 2.0. */ +import org.elasticsearch.gradle.internal.AbstractDependenciesTask + apply plugin: 'elasticsearch.build' apply plugin: 'elasticsearch.publish' apply plugin: 'com.gradleup.shadow' @@ -20,7 +22,7 @@ dependencies { } } -tasks.named("dependencyLicenses").configure { +tasks.withType(AbstractDependenciesTask).configureEach { mapping from: /opensaml-.*/, to: 'shibboleth' } diff --git a/x-pack/plugin/core/build.gradle b/x-pack/plugin/core/build.gradle index 6a17216946d1a..621edf2a08099 100644 --- a/x-pack/plugin/core/build.gradle +++ b/x-pack/plugin/core/build.gradle @@ -8,6 +8,7 @@ import org.apache.tools.ant.filters.ReplaceTokens import org.elasticsearch.gradle.Version import java.nio.file.Paths +import org.elasticsearch.gradle.internal.AbstractDependenciesTask apply plugin: 'elasticsearch.internal-es-plugin' apply plugin: 'elasticsearch.publish' @@ -29,7 +30,7 @@ esplugin { requiresKeystore =false } -tasks.named("dependencyLicenses").configure { +tasks.withType(AbstractDependenciesTask).configureEach { mapping from: /http.*/, to: 'httpclient' // pulled in by rest client mapping from: /commons-.*/, to: 'commons' // pulled in by rest client } diff --git a/x-pack/plugin/identity-provider/build.gradle b/x-pack/plugin/identity-provider/build.gradle index 42cf78886fa54..701cd97289d5c 100644 --- a/x-pack/plugin/identity-provider/build.gradle +++ b/x-pack/plugin/identity-provider/build.gradle @@ -5,6 +5,8 @@ * 2.0. */ +import org.elasticsearch.gradle.internal.AbstractDependenciesTask + apply plugin: 'elasticsearch.internal-es-plugin' apply plugin: 'elasticsearch.internal-cluster-test' esplugin { @@ -66,7 +68,7 @@ dependencies { } -tasks.named("dependencyLicenses").configure { +tasks.withType(AbstractDependenciesTask).configureEach { mapping from: /java-support|opensaml-.*/, to: 'shibboleth' mapping from: /http.*/, to: 'httpclient' mapping from: /bc.*/, to: 'bouncycastle' diff --git a/x-pack/plugin/inference/build.gradle b/x-pack/plugin/inference/build.gradle index 9486d239e5de5..81205bf609738 100644 --- a/x-pack/plugin/inference/build.gradle +++ b/x-pack/plugin/inference/build.gradle @@ -5,6 +5,8 @@ * 2.0. */ +import org.elasticsearch.gradle.internal.AbstractDependenciesTask + apply plugin: 'elasticsearch.internal-es-plugin' apply plugin: 'elasticsearch.internal-cluster-test' apply plugin: 'elasticsearch.internal-yaml-rest-test' @@ -111,7 +113,7 @@ dependencies { runtimeOnly "org.slf4j:slf4j-nop:${versions.slf4j}" } -tasks.named("dependencyLicenses").configure { +tasks.withType(AbstractDependenciesTask).configureEach { mapping from: /google-auth-.*/, to: 'google-auth' mapping from: /google-http-.*/, to: 'google-http' mapping from: /opencensus.*/, to: 'opencensus' diff --git a/x-pack/plugin/security/build.gradle b/x-pack/plugin/security/build.gradle index 0b45aac9af65d..9a832204e7228 100644 --- a/x-pack/plugin/security/build.gradle +++ b/x-pack/plugin/security/build.gradle @@ -1,3 +1,5 @@ +import org.elasticsearch.gradle.internal.AbstractDependenciesTask + apply plugin: 'elasticsearch.internal-es-plugin' apply plugin: 'elasticsearch.publish' apply plugin: 'elasticsearch.internal-cluster-test' @@ -172,7 +174,7 @@ tasks.named('assemble').configure { dependsOn tasks.named('jar') } -tasks.named("dependencyLicenses").configure { +tasks.withType(AbstractDependenciesTask).configureEach { mapping from: /java-support|opensaml-.*/, to: 'shibboleth' mapping from: /http.*/, to: 'httpclient' mapping from: /bc.*/, to: 'bouncycastle'