Skip to content

Commit

Permalink
Unify dependency licenses task configuration (elastic#58116)
Browse files Browse the repository at this point in the history
- Remove duplicate dependency configuration
- Use task avoidance api accross the build
- Remove redundant licensesCheck config
  • Loading branch information
breskeby committed Jun 17, 2020
1 parent 204bc0e commit 5f9d1f1
Show file tree
Hide file tree
Showing 51 changed files with 46 additions and 107 deletions.
2 changes: 1 addition & 1 deletion benchmarks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ run.executable = "${BuildParams.runtimeJavaHome}/bin/java"
disableTasks('forbiddenApisMain')

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

thirdPartyAudit.ignoreViolations(
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ if (project != rootProject) {
groovydoc.enabled = false

// build-tools is not ready for primetime with these...
dependencyLicenses.enabled = false
tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false
disableTasks('forbiddenApisMain', 'forbiddenApisMinimumRuntime',
'forbiddenApisTest', 'forbiddenApisIntegTest', 'forbiddenApisTestFixtures')
Expand Down
2 changes: 1 addition & 1 deletion client/benchmark/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ dependencies {
}

// No licenses for our benchmark deps (we don't ship benchmarks)
dependencyLicenses.enabled = false
tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false
2 changes: 1 addition & 1 deletion client/client-benchmark-noop-api-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ esplugin {
// Not published so no need to assemble
assemble.enabled = false

dependencyLicenses.enabled = false
tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false

// no unit tests
Expand Down
8 changes: 0 additions & 8 deletions client/rest-high-level/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ processTestResources {
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 {
// 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
Expand Down
8 changes: 1 addition & 7 deletions client/sniffer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ tasks.named('forbiddenApisTest').configure {
replaceSignatureFiles 'jdk-signatures'
}

dependencyLicenses {
tasks.named("dependencyLicenses").configure {
mapping from: /http.*/, to: 'httpclient'
mapping from: /commons-.*/, to: 'commons'
}
Expand All @@ -71,12 +71,6 @@ testingConventions {
}
}

dependencyLicenses {
dependencies = project.configurations.runtime.fileCollection {
it.group.startsWith('org.elasticsearch') == false
}
}

thirdPartyAudit.ignoreMissingClasses(
//commons-logging optional dependencies
'org.apache.avalon.framework.logger.Logger',
Expand Down
2 changes: 1 addition & 1 deletion client/test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ tasks.named('forbiddenApisTest').configure {
jarHell.enabled = false

// TODO: should we have licenses for our test deps?
dependencyLicenses.enabled = false
tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false

//we aren't releasing this jar
Expand Down
2 changes: 1 addition & 1 deletion distribution/tools/plugin-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies {
testRuntimeOnly 'com.google.guava:guava:18.0'
}

dependencyLicenses {
tasks.named("dependencyLicenses").configure {
mapping from: /bc.*/, to: 'bouncycastle'
}

Expand Down
2 changes: 1 addition & 1 deletion libs/x-content/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ thirdPartyAudit.ignoreMissingClasses(
'com.fasterxml.jackson.databind.cfg.MapperBuilder'
)

dependencyLicenses {
tasks.named("dependencyLicenses").configure {
mapping from: /jackson-.*/, to: 'jackson'
}

Expand Down
2 changes: 1 addition & 1 deletion modules/lang-expression/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ restResources {
}
}

dependencyLicenses {
tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene'
mapping from: /asm-.*/, to: 'asm'
}
Expand Down
3 changes: 1 addition & 2 deletions modules/lang-painless/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies {
compile project('spi')
}

dependencyLicenses {
tasks.named("dependencyLicenses").configure {
mapping from: /asm-.*/, to: 'asm'
}

Expand Down Expand Up @@ -193,4 +193,3 @@ task regen {
}
}
}

7 changes: 0 additions & 7 deletions modules/percolator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,3 @@ restResources {
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
}
2 changes: 1 addition & 1 deletion modules/transport-netty4/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ restResources {
}
}

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

Expand Down
3 changes: 1 addition & 2 deletions plugins/analysis-icu/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ restResources {
}
}

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

2 changes: 1 addition & 1 deletion plugins/analysis-kuromoji/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ restResources {
}
}

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

3 changes: 1 addition & 2 deletions plugins/analysis-nori/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ restResources {
includeCore '_common', 'indices', 'index', 'search'
}
}
dependencyLicenses {
tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene'
}

2 changes: 1 addition & 1 deletion plugins/analysis-phonetic/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ restResources {
}
}

dependencyLicenses {
tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene'
}
2 changes: 1 addition & 1 deletion plugins/analysis-smartcn/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ restResources {
}
}

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

2 changes: 1 addition & 1 deletion plugins/analysis-stempel/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ restResources {
}
}

dependencyLicenses {
tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene'
}
2 changes: 1 addition & 1 deletion plugins/analysis-ukrainian/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ restResources {
}
}

dependencyLicenses {
tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene'
mapping from: /morfologik-.*/, to: 'lucene'
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/discovery-azure-classic/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ normalization {
}
}

dependencyLicenses {
tasks.named("dependencyLicenses").configure {
mapping from: /azure-.*/, to: 'azure'
mapping from: /jackson-.*/, to: 'jackson'
mapping from: /jersey-.*/, to: 'jersey'
Expand Down
2 changes: 1 addition & 1 deletion plugins/discovery-ec2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ restResources {
}
}

dependencyLicenses {
tasks.named("dependencyLicenses").configure {
mapping from: /aws-java-sdk-.*/, to: 'aws-java-sdk'
mapping from: /jackson-.*/, to: 'jackson'
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/discovery-gce/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ restResources {
}
}

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

Expand Down
2 changes: 1 addition & 1 deletion plugins/ingest-attachment/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ restResources {
}
}

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

Expand Down
2 changes: 1 addition & 1 deletion plugins/repository-azure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ restResources {
}
}

dependencyLicenses {
tasks.named("dependencyLicenses").configure {
mapping from: /azure-.*/, to: 'azure'
mapping from: /jackson-.*/, to: 'jackson'
mapping from: /jersey-.*/, to: 'jersey'
Expand Down
2 changes: 1 addition & 1 deletion plugins/repository-gcs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ restResources {
}
}

dependencyLicenses {
tasks.named("dependencyLicenses").configure {
mapping from: /google-cloud-.*/, to: 'google-cloud'
mapping from: /google-auth-.*/, to: 'google-auth'
mapping from: /google-http-.*/, to: 'google-http'
Expand Down
2 changes: 1 addition & 1 deletion plugins/repository-hdfs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ normalization {
}
}

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

Expand Down
2 changes: 1 addition & 1 deletion plugins/repository-s3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ dependencies {
testImplementation project(':test:fixtures:s3-fixture')
}

dependencyLicenses {
tasks.named("dependencyLicenses").configure {
mapping from: /aws-java-sdk-.*/, to: 'aws-java-sdk'
mapping from: /jmespath-java.*/, to: 'aws-java-sdk'
mapping from: /jackson-.*/, to: 'jackson'
Expand Down
2 changes: 1 addition & 1 deletion plugins/transport-nio/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dependencies {
compile "io.netty:netty-transport:${versions.netty}"
}

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

Expand Down
2 changes: 1 addition & 1 deletion qa/os/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ tasks.test.enabled = false
testingConventions.enabled = false

// this project doesn't get published
tasks.dependencyLicenses.enabled = false
tasks.named("dependencyLicenses").configure { it.enabled = false }
tasks.dependenciesInfo.enabled = false

tasks.thirdPartyAudit.ignoreMissingClasses()
Expand Down
2 changes: 1 addition & 1 deletion qa/wildfly/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ check.dependsOn integTest

test.enabled = false

dependencyLicenses.enabled = false
tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false

thirdPartyAudit.enabled = false
Expand Down
2 changes: 1 addition & 1 deletion server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ thirdPartyAudit.ignoreMissingClasses(

thirdPartyAudit.ignoreMissingClasses 'javax.xml.bind.DatatypeConverter'

dependencyLicenses {
tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene'
dependencies = project.configurations.runtime.fileCollection {
it.group.startsWith('org.elasticsearch') == false ||
Expand Down
2 changes: 1 addition & 1 deletion test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ subprojects {
apply plugin: 'elasticsearch.publish'

// TODO: should we have licenses for our test deps?
dependencyLicenses.enabled = false
tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false

// TODO: why is the test framework pulled in...
Expand Down
2 changes: 1 addition & 1 deletion test/framework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ tasks.named('forbiddenApisMain').configure {
}

// TODO: should we have licenses for our test deps?
dependencyLicenses.enabled = false
tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false

thirdPartyAudit.ignoreMissingClasses(
Expand Down
2 changes: 1 addition & 1 deletion x-pack/license-tools/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ project.forbiddenPatterns {
exclude '**/*.key'
}

dependencyLicenses.enabled = false
tasks.named("dependencyLicenses").configure { it.enabled = false }

task buildZip(type: Zip, dependsOn: jar) {
String parentDir = "license-tools-${version}"
Expand Down
4 changes: 0 additions & 4 deletions x-pack/plugin/async-search/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,5 @@ dependencies {
testImplementation project(path: xpackModule('async'))
}

dependencyLicenses {
ignoreSha 'x-pack-core'
}

integTest.enabled = false

4 changes: 0 additions & 4 deletions x-pack/plugin/ccr/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ dependencies {
testImplementation project(path: xpackModule('monitoring'), configuration: 'testArtifacts')
}

dependencyLicenses {
ignoreSha 'x-pack-core'
}

testingConventions.naming {
IT {
baseClass "org.elasticsearch.xpack.CcrIntegTestCase"
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugin/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ esplugin {
requiresKeystore false
}

dependencyLicenses {
tasks.named("dependencyLicenses").configure {
mapping from: /http.*/, to: 'httpclient' // pulled in by rest client
mapping from: /commons-.*/, to: 'commons' // pulled in by rest client
}
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugin/identity-provider/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ dependencies {
compileJava.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: /http.*/, to: 'httpclient'
}
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugin/monitoring/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ artifacts {
testArtifacts testJar
}

dependencyLicenses {
tasks.named("dependencyLicenses").configure {
mapping from: /http.*/, to: 'httpclient' // pulled in by rest client
mapping from: /commons-.*/, to: 'commons' // pulled in by rest client
}
Expand Down
Loading

0 comments on commit 5f9d1f1

Please sign in to comment.