From e31ebc96f96a28e59c9eb7bfd447b13182b7f308 Mon Sep 17 00:00:00 2001 From: Rene Groeschke Date: Mon, 20 Jul 2020 08:52:30 +0200 Subject: [PATCH] Enforce fail on deprecated gradle usage (7.x backport) (#59758) * Enforce fail on deprecated gradle usage (#59598) * Fix branch specific deprecated gradle api usages * Fix archiveVersion property usage --- .../elasticsearch/gradle/plugin/PluginBuildPlugin.groovy | 5 +++-- client/transport/build.gradle | 6 ------ gradle.properties | 3 +++ libs/core/build.gradle | 6 +----- x-pack/qa/smoke-test-plugins-ssl/build.gradle | 1 + x-pack/qa/third-party/active-directory/build.gradle | 1 + x-pack/snapshot-tool/build.gradle | 2 +- 7 files changed, 10 insertions(+), 14 deletions(-) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy index af6e12fc9f0..d39f3d3857f 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy @@ -45,6 +45,7 @@ import org.gradle.jvm.tasks.Jar import java.util.regex.Matcher import java.util.regex.Pattern + /** * Encapsulates build configuration for an Elasticsearch plugin. */ @@ -147,7 +148,7 @@ class PluginBuildPlugin implements Plugin { project.pluginManager.apply('nebula.maven-base-publish') // Only change Jar tasks, we don't want a -client zip so we can't change archivesBaseName project.tasks.withType(Jar) { - baseName = baseName + "-client" + archiveBaseName = archiveBaseName.get() + "-client" } // always configure publishing for client jars project.publishing.publications.nebula(MavenPublication).artifactId(extension.name + "-client") @@ -236,7 +237,7 @@ class PluginBuildPlugin implements Plugin { } } project.tasks.named(BasePlugin.ASSEMBLE_TASK_NAME).configure { - dependsOn(bundle) + dependsOn(bundle) } // also make the zip available as a configuration (used when depending on this project) diff --git a/client/transport/build.gradle b/client/transport/build.gradle index aa21a3b2fa9..5ce23c17db0 100644 --- a/client/transport/build.gradle +++ b/client/transport/build.gradle @@ -34,12 +34,6 @@ dependencies { testImplementation "org.hamcrest:hamcrest:${versions.hamcrest}" } -dependencyLicenses { - dependencies = project.configurations.runtime.fileCollection { - it.group.startsWith('org.elasticsearch') == false - } -} - forbiddenApisTest { // we don't use the core test-framework, no lucene classes present so we don't want the es-test-signatures to // be pulled in diff --git a/gradle.properties b/gradle.properties index 8c689aef44f..0eb391db94d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,3 +6,6 @@ options.forkOptions.memoryMaximumSize=2g # Disable duplicate project id detection # See https://docs.gradle.org/current/userguide/upgrading_version_6.html#duplicate_project_names_may_cause_publication_to_fail systemProp.org.gradle.dependency.duplicate.project.detection=false + +# Enforce the build to fail on deprecated gradle api usage +systemProp.org.gradle.warning.mode=fail diff --git a/libs/core/build.gradle b/libs/core/build.gradle index 184b5e62ed6..fabeda9b7fb 100644 --- a/libs/core/build.gradle +++ b/libs/core/build.gradle @@ -39,7 +39,7 @@ if (!isEclipse) { } dependencies { - java11Compile sourceSets.main.output + java11Implementation sourceSets.main.output } compileJava11Java { @@ -71,10 +71,6 @@ dependencies { testImplementation "junit:junit:${versions.junit}" testImplementation "org.hamcrest:hamcrest:${versions.hamcrest}" - if (!isEclipse) { - java11Compile sourceSets.main.output - } - testImplementation(project(":test:framework")) { exclude group: 'org.elasticsearch', module: 'elasticsearch-core' } diff --git a/x-pack/qa/smoke-test-plugins-ssl/build.gradle b/x-pack/qa/smoke-test-plugins-ssl/build.gradle index be7408573c0..d555db7d222 100644 --- a/x-pack/qa/smoke-test-plugins-ssl/build.gradle +++ b/x-pack/qa/smoke-test-plugins-ssl/build.gradle @@ -79,6 +79,7 @@ ext.expansions = [ processTestResources { from(sourceSets.test.resources.srcDirs) { + duplicatesStrategy = DuplicatesStrategy.INCLUDE include '**/*.yml' inputs.properties(expansions) MavenFilteringHack.filter(it, expansions) diff --git a/x-pack/qa/third-party/active-directory/build.gradle b/x-pack/qa/third-party/active-directory/build.gradle index c85c392c09c..e27acb61ce0 100644 --- a/x-pack/qa/third-party/active-directory/build.gradle +++ b/x-pack/qa/third-party/active-directory/build.gradle @@ -10,6 +10,7 @@ testFixtures.useFixture ":x-pack:test:smb-fixture" // add test resources from security, so tests can use example certs processTestResources { + duplicatesStrategy = DuplicatesStrategy.INCLUDE from(project(xpackModule('core')).sourceSets.test.resources.srcDirs) from(project(xpackModule('security')).sourceSets.test.resources.srcDirs) } diff --git a/x-pack/snapshot-tool/build.gradle b/x-pack/snapshot-tool/build.gradle index c80157feff6..69bc93ecd36 100644 --- a/x-pack/snapshot-tool/build.gradle +++ b/x-pack/snapshot-tool/build.gradle @@ -114,7 +114,7 @@ task buildTarArchive(dependsOn: copyRuntimeLibs, type: Tar) { compression Compression.GZIP archiveBaseName.set('snapshot-tool') destinationDirectory.set(project.buildDir) - into "snapshot-tool-${version}", { + into "snapshot-tool-${archiveVersion.get()}", { into "bin", { from file("${project.projectDir}/src/bin") }