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
This commit is contained in:
Rene Groeschke 2020-07-20 08:52:30 +02:00 committed by GitHub
parent 3ffb20bdfc
commit e31ebc96f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 14 deletions

View File

@ -45,6 +45,7 @@ import org.gradle.jvm.tasks.Jar
import java.util.regex.Matcher import java.util.regex.Matcher
import java.util.regex.Pattern import java.util.regex.Pattern
/** /**
* Encapsulates build configuration for an Elasticsearch plugin. * Encapsulates build configuration for an Elasticsearch plugin.
*/ */
@ -147,7 +148,7 @@ class PluginBuildPlugin implements Plugin<Project> {
project.pluginManager.apply('nebula.maven-base-publish') project.pluginManager.apply('nebula.maven-base-publish')
// Only change Jar tasks, we don't want a -client zip so we can't change archivesBaseName // Only change Jar tasks, we don't want a -client zip so we can't change archivesBaseName
project.tasks.withType(Jar) { project.tasks.withType(Jar) {
baseName = baseName + "-client" archiveBaseName = archiveBaseName.get() + "-client"
} }
// always configure publishing for client jars // always configure publishing for client jars
project.publishing.publications.nebula(MavenPublication).artifactId(extension.name + "-client") project.publishing.publications.nebula(MavenPublication).artifactId(extension.name + "-client")
@ -236,7 +237,7 @@ class PluginBuildPlugin implements Plugin<Project> {
} }
} }
project.tasks.named(BasePlugin.ASSEMBLE_TASK_NAME).configure { 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) // also make the zip available as a configuration (used when depending on this project)

View File

@ -34,12 +34,6 @@ dependencies {
testImplementation "org.hamcrest:hamcrest:${versions.hamcrest}" testImplementation "org.hamcrest:hamcrest:${versions.hamcrest}"
} }
dependencyLicenses {
dependencies = project.configurations.runtime.fileCollection {
it.group.startsWith('org.elasticsearch') == false
}
}
forbiddenApisTest { forbiddenApisTest {
// we don't use the core test-framework, no lucene classes present so we don't want the es-test-signatures to // 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 // be pulled in

View File

@ -6,3 +6,6 @@ options.forkOptions.memoryMaximumSize=2g
# Disable duplicate project id detection # Disable duplicate project id detection
# See https://docs.gradle.org/current/userguide/upgrading_version_6.html#duplicate_project_names_may_cause_publication_to_fail # 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 systemProp.org.gradle.dependency.duplicate.project.detection=false
# Enforce the build to fail on deprecated gradle api usage
systemProp.org.gradle.warning.mode=fail

View File

@ -39,7 +39,7 @@ if (!isEclipse) {
} }
dependencies { dependencies {
java11Compile sourceSets.main.output java11Implementation sourceSets.main.output
} }
compileJava11Java { compileJava11Java {
@ -71,10 +71,6 @@ dependencies {
testImplementation "junit:junit:${versions.junit}" testImplementation "junit:junit:${versions.junit}"
testImplementation "org.hamcrest:hamcrest:${versions.hamcrest}" testImplementation "org.hamcrest:hamcrest:${versions.hamcrest}"
if (!isEclipse) {
java11Compile sourceSets.main.output
}
testImplementation(project(":test:framework")) { testImplementation(project(":test:framework")) {
exclude group: 'org.elasticsearch', module: 'elasticsearch-core' exclude group: 'org.elasticsearch', module: 'elasticsearch-core'
} }

View File

@ -79,6 +79,7 @@ ext.expansions = [
processTestResources { processTestResources {
from(sourceSets.test.resources.srcDirs) { from(sourceSets.test.resources.srcDirs) {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
include '**/*.yml' include '**/*.yml'
inputs.properties(expansions) inputs.properties(expansions)
MavenFilteringHack.filter(it, expansions) MavenFilteringHack.filter(it, expansions)

View File

@ -10,6 +10,7 @@ testFixtures.useFixture ":x-pack:test:smb-fixture"
// add test resources from security, so tests can use example certs // add test resources from security, so tests can use example certs
processTestResources { processTestResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from(project(xpackModule('core')).sourceSets.test.resources.srcDirs) from(project(xpackModule('core')).sourceSets.test.resources.srcDirs)
from(project(xpackModule('security')).sourceSets.test.resources.srcDirs) from(project(xpackModule('security')).sourceSets.test.resources.srcDirs)
} }

View File

@ -114,7 +114,7 @@ task buildTarArchive(dependsOn: copyRuntimeLibs, type: Tar) {
compression Compression.GZIP compression Compression.GZIP
archiveBaseName.set('snapshot-tool') archiveBaseName.set('snapshot-tool')
destinationDirectory.set(project.buildDir) destinationDirectory.set(project.buildDir)
into "snapshot-tool-${version}", { into "snapshot-tool-${archiveVersion.get()}", {
into "bin", { into "bin", {
from file("${project.projectDir}/src/bin") from file("${project.projectDir}/src/bin")
} }