Unify dependency licenses task configuration (#58116) (#58274)

- Remove duplicate dependency configuration
- Use task avoidance api accross the build
- Remove redundant licensesCheck config
This commit is contained in:
Rene Groeschke 2020-06-18 08:15:50 +02:00 committed by GitHub
parent c57a3f3e60
commit abc72c1a27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
51 changed files with 46 additions and 108 deletions

View File

@ -51,7 +51,7 @@ run.executable = "${BuildParams.runtimeJavaHome}/bin/java"
disableTasks('forbiddenApisMain') disableTasks('forbiddenApisMain')
// No licenses for our benchmark deps (we don't ship benchmarks) // No licenses for our benchmark deps (we don't ship benchmarks)
dependencyLicenses.enabled = false tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false dependenciesInfo.enabled = false
thirdPartyAudit.ignoreViolations( thirdPartyAudit.ignoreViolations(

View File

@ -176,7 +176,7 @@ if (project != rootProject) {
groovydoc.enabled = false groovydoc.enabled = false
// build-tools is not ready for primetime with these... // build-tools is not ready for primetime with these...
dependencyLicenses.enabled = false tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false dependenciesInfo.enabled = false
disableTasks('forbiddenApisMain', 'forbiddenApisMinimumRuntime', disableTasks('forbiddenApisMain', 'forbiddenApisMinimumRuntime',
'forbiddenApisTest', 'forbiddenApisIntegTest', 'forbiddenApisTestFixtures') 'forbiddenApisTest', 'forbiddenApisIntegTest', 'forbiddenApisTestFixtures')

View File

@ -47,5 +47,5 @@ dependencies {
} }
// No licenses for our benchmark deps (we don't ship benchmarks) // No licenses for our benchmark deps (we don't ship benchmarks)
dependencyLicenses.enabled = false tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false dependenciesInfo.enabled = false

View File

@ -30,7 +30,7 @@ esplugin {
// Not published so no need to assemble // Not published so no need to assemble
assemble.enabled = false assemble.enabled = false
dependencyLicenses.enabled = false tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false dependenciesInfo.enabled = false
// no unit tests // no unit tests

View File

@ -62,14 +62,6 @@ processTestResources {
from(project(':client:rest-high-level').file('src/test/resources')) from(project(':client:rest-high-level').file('src/test/resources'))
} }
dependencyLicenses {
// Don't check licenses for dependency that are part of the elasticsearch project
// But any other dependency should have its license/notice/sha1
dependencies = project.configurations.runtime.fileCollection {
it.group.startsWith('org.elasticsearch') == false
}
}
tasks.named('forbiddenApisMain').configure { tasks.named('forbiddenApisMain').configure {
// core does not depend on the httpclient for compile so we add the signatures here. We don't add them for test as they are already // core does not depend on the httpclient for compile so we add the signatures here. We don't add them for test as they are already
// specified // specified

View File

@ -53,7 +53,7 @@ tasks.named('forbiddenApisTest').configure {
replaceSignatureFiles 'jdk-signatures' replaceSignatureFiles 'jdk-signatures'
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /http.*/, to: 'httpclient' mapping from: /http.*/, to: 'httpclient'
mapping from: /commons-.*/, to: 'commons' mapping from: /commons-.*/, to: 'commons'
} }
@ -71,13 +71,6 @@ testingConventions {
} }
} }
dependencyLicenses {
dependencies = project.configurations.runtime.fileCollection {
it.group.startsWith('org.elasticsearch') == false
}
}
thirdPartyAudit.ignoreMissingClasses( thirdPartyAudit.ignoreMissingClasses(
//commons-logging optional dependencies //commons-logging optional dependencies
'org.apache.avalon.framework.logger.Logger', 'org.apache.avalon.framework.logger.Logger',

View File

@ -48,7 +48,7 @@ tasks.named('forbiddenApisTest').configure {
jarHell.enabled = false jarHell.enabled = false
// TODO: should we have licenses for our test deps? // TODO: should we have licenses for our test deps?
dependencyLicenses.enabled = false tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false dependenciesInfo.enabled = false
//we aren't releasing this jar //we aren't releasing this jar

View File

@ -31,7 +31,7 @@ dependencies {
testRuntimeOnly 'com.google.guava:guava:18.0' testRuntimeOnly 'com.google.guava:guava:18.0'
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /bc.*/, to: 'bouncycastle' mapping from: /bc.*/, to: 'bouncycastle'
} }

View File

@ -51,7 +51,7 @@ thirdPartyAudit.ignoreMissingClasses(
'com.fasterxml.jackson.databind.cfg.MapperBuilder' 'com.fasterxml.jackson.databind.cfg.MapperBuilder'
) )
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /jackson-.*/, to: 'jackson' mapping from: /jackson-.*/, to: 'jackson'
} }

View File

@ -35,7 +35,7 @@ restResources {
} }
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene' mapping from: /lucene-.*/, to: 'lucene'
mapping from: /asm-.*/, to: 'asm' mapping from: /asm-.*/, to: 'asm'
} }

View File

@ -42,7 +42,7 @@ dependencies {
compile project('spi') compile project('spi')
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /asm-.*/, to: 'asm' mapping from: /asm-.*/, to: 'asm'
} }
@ -193,4 +193,3 @@ task regen {
} }
} }
} }

View File

@ -45,10 +45,3 @@ restResources {
includeCore '_common', 'indices', 'index', 'search', 'msearch' includeCore '_common', 'indices', 'index', 'search', 'msearch'
} }
} }
dependencyLicenses {
// Don't check the client's license. We know it.
dependencies = project.configurations.runtime.fileCollection {
it.group.startsWith('org.elasticsearch') == false
} - project.configurations.compileOnly
}

View File

@ -50,7 +50,7 @@ restResources {
} }
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /netty-.*/, to: 'netty' mapping from: /netty-.*/, to: 'netty'
} }

View File

@ -42,7 +42,6 @@ restResources {
} }
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene' mapping from: /lucene-.*/, to: 'lucene'
} }

View File

@ -32,7 +32,7 @@ restResources {
} }
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene' mapping from: /lucene-.*/, to: 'lucene'
} }

View File

@ -31,7 +31,6 @@ restResources {
includeCore '_common', 'indices', 'index', 'search' includeCore '_common', 'indices', 'index', 'search'
} }
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene' mapping from: /lucene-.*/, to: 'lucene'
} }

View File

@ -33,6 +33,6 @@ restResources {
} }
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene' mapping from: /lucene-.*/, to: 'lucene'
} }

View File

@ -32,7 +32,7 @@ restResources {
} }
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene' mapping from: /lucene-.*/, to: 'lucene'
} }

View File

@ -32,6 +32,6 @@ restResources {
} }
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene' mapping from: /lucene-.*/, to: 'lucene'
} }

View File

@ -35,7 +35,7 @@ restResources {
} }
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene' mapping from: /lucene-.*/, to: 'lucene'
mapping from: /morfologik-.*/, to: 'lucene' mapping from: /morfologik-.*/, to: 'lucene'
} }

View File

@ -99,7 +99,7 @@ normalization {
} }
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /azure-.*/, to: 'azure' mapping from: /azure-.*/, to: 'azure'
mapping from: /jackson-.*/, to: 'jackson' mapping from: /jackson-.*/, to: 'jackson'
mapping from: /jersey-.*/, to: 'jersey' mapping from: /jersey-.*/, to: 'jersey'

View File

@ -46,7 +46,7 @@ restResources {
} }
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /aws-java-sdk-.*/, to: 'aws-java-sdk' mapping from: /aws-java-sdk-.*/, to: 'aws-java-sdk'
mapping from: /jackson-.*/, to: 'jackson' mapping from: /jackson-.*/, to: 'jackson'
} }

View File

@ -27,7 +27,7 @@ restResources {
} }
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /google-.*/, to: 'google' mapping from: /google-.*/, to: 'google'
} }

View File

@ -82,7 +82,7 @@ restResources {
} }
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /apache-mime4j-.*/, to: 'apache-mime4j' mapping from: /apache-mime4j-.*/, to: 'apache-mime4j'
} }

View File

@ -42,7 +42,7 @@ restResources {
} }
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /azure-.*/, to: 'azure' mapping from: /azure-.*/, to: 'azure'
mapping from: /jackson-.*/, to: 'jackson' mapping from: /jackson-.*/, to: 'jackson'
mapping from: /jersey-.*/, to: 'jersey' mapping from: /jersey-.*/, to: 'jersey'

View File

@ -72,7 +72,7 @@ restResources {
} }
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /google-cloud-.*/, to: 'google-cloud' mapping from: /google-cloud-.*/, to: 'google-cloud'
mapping from: /google-auth-.*/, to: 'google-auth' mapping from: /google-auth-.*/, to: 'google-auth'
mapping from: /google-http-.*/, to: 'google-http' mapping from: /google-http-.*/, to: 'google-http'

View File

@ -89,7 +89,7 @@ normalization {
} }
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /hadoop-.*/, to: 'hadoop' mapping from: /hadoop-.*/, to: 'hadoop'
} }

View File

@ -53,7 +53,7 @@ dependencies {
testImplementation project(':test:fixtures:s3-fixture') testImplementation project(':test:fixtures:s3-fixture')
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /aws-java-sdk-.*/, to: 'aws-java-sdk' mapping from: /aws-java-sdk-.*/, to: 'aws-java-sdk'
mapping from: /jmespath-java.*/, to: 'aws-java-sdk' mapping from: /jmespath-java.*/, to: 'aws-java-sdk'
mapping from: /jackson-.*/, to: 'jackson' mapping from: /jackson-.*/, to: 'jackson'

View File

@ -39,7 +39,7 @@ dependencies {
compile "io.netty:netty-transport:${versions.netty}" compile "io.netty:netty-transport:${versions.netty}"
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /netty-.*/, to: 'netty' mapping from: /netty-.*/, to: 'netty'
} }

View File

@ -52,7 +52,7 @@ tasks.test.enabled = false
testingConventions.enabled = false testingConventions.enabled = false
// this project doesn't get published // this project doesn't get published
tasks.dependencyLicenses.enabled = false tasks.named("dependencyLicenses").configure { it.enabled = false }
tasks.dependenciesInfo.enabled = false tasks.dependenciesInfo.enabled = false
tasks.thirdPartyAudit.ignoreMissingClasses() tasks.thirdPartyAudit.ignoreMissingClasses()

View File

@ -85,7 +85,7 @@ check.dependsOn integTest
test.enabled = false test.enabled = false
dependencyLicenses.enabled = false tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false dependenciesInfo.enabled = false
thirdPartyAudit.enabled = false thirdPartyAudit.enabled = false

View File

@ -322,7 +322,7 @@ if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_1_8) {
thirdPartyAudit.ignoreMissingClasses 'javax.xml.bind.DatatypeConverter' thirdPartyAudit.ignoreMissingClasses 'javax.xml.bind.DatatypeConverter'
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene' mapping from: /lucene-.*/, to: 'lucene'
dependencies = project.configurations.runtime.fileCollection { dependencies = project.configurations.runtime.fileCollection {
it.group.startsWith('org.elasticsearch') == false || it.group.startsWith('org.elasticsearch') == false ||

View File

@ -26,7 +26,7 @@ subprojects {
apply plugin: 'elasticsearch.publish' apply plugin: 'elasticsearch.publish'
// TODO: should we have licenses for our test deps? // TODO: should we have licenses for our test deps?
dependencyLicenses.enabled = false tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false dependenciesInfo.enabled = false
// TODO: why is the test framework pulled in... // TODO: why is the test framework pulled in...

View File

@ -44,7 +44,7 @@ tasks.named('forbiddenApisMain').configure {
} }
// TODO: should we have licenses for our test deps? // TODO: should we have licenses for our test deps?
dependencyLicenses.enabled = false tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false dependenciesInfo.enabled = false
thirdPartyAudit.ignoreMissingClasses( thirdPartyAudit.ignoreMissingClasses(

View File

@ -10,7 +10,7 @@ project.forbiddenPatterns {
exclude '**/*.key' exclude '**/*.key'
} }
dependencyLicenses.enabled = false tasks.named("dependencyLicenses").configure { it.enabled = false }
task buildZip(type: Zip, dependsOn: jar) { task buildZip(type: Zip, dependsOn: jar) {
String parentDir = "license-tools-${version}" String parentDir = "license-tools-${version}"

View File

@ -30,9 +30,5 @@ dependencies {
testImplementation project(path: xpackModule('ilm')) testImplementation project(path: xpackModule('ilm'))
} }
dependencyLicenses {
ignoreSha 'x-pack-core'
}
integTest.enabled = false integTest.enabled = false

View File

@ -46,10 +46,6 @@ dependencies {
testImplementation project(path: xpackModule('monitoring'), configuration: 'testArtifacts') testImplementation project(path: xpackModule('monitoring'), configuration: 'testArtifacts')
} }
dependencyLicenses {
ignoreSha 'x-pack-core'
}
testingConventions.naming { testingConventions.naming {
IT { IT {
baseClass "org.elasticsearch.xpack.CcrIntegTestCase" baseClass "org.elasticsearch.xpack.CcrIntegTestCase"

View File

@ -18,7 +18,7 @@ esplugin {
requiresKeystore false requiresKeystore false
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /http.*/, to: 'httpclient' // pulled in by rest client mapping from: /http.*/, to: 'httpclient' // pulled in by rest client
mapping from: /commons-.*/, to: 'commons' // pulled in by rest client mapping from: /commons-.*/, to: 'commons' // pulled in by rest client
} }

View File

@ -57,7 +57,7 @@ dependencies {
compileJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked" compileJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked"
compileTestJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked" compileTestJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked"
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /java-support|opensaml-.*/, to: 'shibboleth' mapping from: /java-support|opensaml-.*/, to: 'shibboleth'
mapping from: /http.*/, to: 'httpclient' mapping from: /http.*/, to: 'httpclient'
} }

View File

@ -38,7 +38,7 @@ artifacts {
testArtifacts testJar testArtifacts testJar
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /http.*/, to: 'httpclient' // pulled in by rest client mapping from: /http.*/, to: 'httpclient' // pulled in by rest client
mapping from: /commons-.*/, to: 'commons' // pulled in by rest client mapping from: /commons-.*/, to: 'commons' // pulled in by rest client
} }

View File

@ -11,7 +11,6 @@ esplugin {
} }
archivesBaseName = 'x-pack-searchbusinessrules' archivesBaseName = 'x-pack-searchbusinessrules'
integTest.enabled = false integTest.enabled = false
dependencies { dependencies {
@ -20,8 +19,3 @@ dependencies {
testImplementation project(":test:framework") testImplementation project(":test:framework")
} }
// copied from CCR
dependencyLicenses {
ignoreSha 'x-pack-core'
}

View File

@ -155,7 +155,7 @@ artifacts {
testArtifacts testJar testArtifacts testJar
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /java-support|opensaml-.*/, to: 'shibboleth' mapping from: /java-support|opensaml-.*/, to: 'shibboleth'
mapping from: /http.*/, to: 'httpclient' mapping from: /http.*/, to: 'httpclient'
} }

View File

@ -19,7 +19,7 @@ dependencies {
testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /bc.*/, to: 'bouncycastle' mapping from: /bc.*/, to: 'bouncycastle'
} }

View File

@ -30,14 +30,8 @@ dependencies {
testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /sql-proto.*/, to: 'elasticsearch'
mapping from: /sql-client.*/, to: 'elasticsearch'
mapping from: /jackson-.*/, to: 'jackson' mapping from: /jackson-.*/, to: 'jackson'
mapping from: /elasticsearch-core.*/, to: 'elasticsearch'
ignoreSha 'sql-proto'
ignoreSha 'sql-client'
ignoreSha 'elasticsearch'
} }
shadowJar { shadowJar {

View File

@ -15,7 +15,7 @@ dependencies {
* other qa projects. */ * other qa projects. */
test.enabled = false test.enabled = false
dependencyLicenses.enabled = false tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false dependenciesInfo.enabled = false
// the main files are actually test files, so use the appropriate forbidden api sigs // the main files are actually test files, so use the appropriate forbidden api sigs

View File

@ -37,7 +37,7 @@ dependencies {
* other qa projects. */ * other qa projects. */
test.enabled = false test.enabled = false
dependencyLicenses.enabled = false tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false dependenciesInfo.enabled = false
// just a test fixture: we aren't using this jars in releases and H2GIS requires disabling a lot of checks // just a test fixture: we aren't using this jars in releases and H2GIS requires disabling a lot of checks

View File

@ -33,12 +33,9 @@ tasks.named('forbiddenApisMain').configure {
replaceSignatureFiles 'jdk-signatures' replaceSignatureFiles 'jdk-signatures'
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /elasticsearch-core.*/, to: 'elasticsearch'
mapping from: /jackson-.*/, to: 'jackson' mapping from: /jackson-.*/, to: 'jackson'
mapping from: /lucene-.*/, to: 'lucene' mapping from: /lucene-.*/, to: 'lucene'
ignoreSha 'elasticsearch'
ignoreSha 'elasticsearch-core'
} }
thirdPartyAudit.ignoreMissingClasses( thirdPartyAudit.ignoreMissingClasses(

View File

@ -34,19 +34,12 @@ dependencies {
testImplementation project(":test:framework") testImplementation project(":test:framework")
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /elasticsearch-cli.*/, to: 'elasticsearch'
mapping from: /elasticsearch-core.*/, to: 'elasticsearch'
mapping from: /jackson-.*/, to: 'jackson' mapping from: /jackson-.*/, to: 'jackson'
mapping from: /lucene-.*/, to: 'lucene' mapping from: /lucene-.*/, to: 'lucene'
mapping from: /sql-action.*/, to: 'elasticsearch' mapping from: /sql-action.*/, to: 'elasticsearch'
mapping from: /sql-client.*/, to: 'elasticsearch' mapping from: /sql-client.*/, to: 'elasticsearch'
mapping from: /jline-.*/, to: 'jline' mapping from: /jline-.*/, to: 'jline'
ignoreSha 'elasticsearch-cli'
ignoreSha 'elasticsearch-core'
ignoreSha 'elasticsearch'
ignoreSha 'sql-action'
ignoreSha 'sql-client'
} }
shadowJar { shadowJar {

View File

@ -13,12 +13,8 @@ dependencies {
testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /jackson-.*/, to: 'jackson' mapping from: /jackson-.*/, to: 'jackson'
mapping from: /sql-proto.*/, to: 'elasticsearch'
mapping from: /elasticsearch-cli.*/, to: 'elasticsearch'
mapping from: /elasticsearch-core.*/, to: 'elasticsearch'
ignoreSha 'elasticsearch-core'
} }
tasks.named('forbiddenApisMain').configure { tasks.named('forbiddenApisMain').configure {

View File

@ -23,8 +23,6 @@ tasks.named('forbiddenApisMain').configure {
replaceSignatureFiles 'jdk-signatures' replaceSignatureFiles 'jdk-signatures'
} }
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /elasticsearch-core.*/, to: 'elasticsearch'
mapping from: /jackson-.*/, to: 'jackson' mapping from: /jackson-.*/, to: 'jackson'
ignoreSha 'elasticsearch-core'
} }

View File

@ -19,9 +19,8 @@ ext.compactProfile = 'full'
compileJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked" compileJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked"
compileTestJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked" compileTestJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked"
dependencyLicenses { tasks.named("dependencyLicenses").configure {
mapping from: /owasp-java-html-sanitizer.*/, to: 'owasp-java-html-sanitizer' mapping from: /owasp-java-html-sanitizer.*/, to: 'owasp-java-html-sanitizer'
ignoreSha 'x-pack-core'
} }
dependencies { dependencies {