Consolidating versions between gradle and ant.

This commit is contained in:
Dawid Weiss 2019-12-13 13:31:23 +01:00
parent 25fc0487a1
commit 4500f0e327
5 changed files with 45 additions and 11 deletions

View File

@ -55,12 +55,15 @@ subprojects {
jarValidation
}
// For Java projects, add runtime and classpath to jarValidation
// For Java projects, add all dependencies from the following configurations
// to jar validation
plugins.withType(JavaPlugin) {
configurations {
jarValidation {
extendsFrom runtimeClasspath
extendsFrom compileClasspath
extendsFrom testRuntimeClasspath
extendsFrom testCompileClasspath
}
}
}
@ -88,7 +91,10 @@ subprojects {
jarName: file.toPath().getFileName().toString(),
path: file,
module: resolvedArtifact.moduleVersion,
checksum: new DigestUtils(MessageDigestAlgorithms.SHA_1).digestAsHex(file)
checksum: new DigestUtils(MessageDigestAlgorithms.SHA_1).digestAsHex(file),
// We keep count of the files referenced by this dependency (sha, license, notice, etc.)
// so that we can determine unused files later on.
referencedFiles: []
]
}
}
@ -107,6 +113,7 @@ subprojects {
if (!expectedChecksumFile.exists()) {
errors << "Dependency checksum missing ('${dep.module}'), expected it at: ${expectedChecksumFile}"
} else {
dep.referencedFiles += expectedChecksumFile
def expected = expectedChecksumFile.getText("UTF-8").trim()
def actual = dep.checksum.trim()
if (expected.compareToIgnoreCase(actual) != 0) {
@ -161,6 +168,7 @@ subprojects {
errors << "Multiple license files matching for ('${dep.module}'): ${found.join(", ")}"
} else {
def licenseFile = found.get(0)
dep.referencedFiles += licenseFile
def m = (licenseFile.name =~ /LICENSE-(.+)\.txt$/)
if (!m) throw new GradleException("License file name doesn't contain license type?: ${licenseFile.name}")
@ -174,6 +182,7 @@ subprojects {
// Look for sibling NOTICE file.
def noticeFile = file(licenseFile.path.replaceAll(/\-LICENSE-.+/, "-NOTICE.txt"))
if (noticeFile.exists()) {
dep.referencedFiles += noticeFile
logger.log(LogLevel.INFO, "Dependency notice file OK ('${dep.module}'): " + noticeFile)
} else if (!licenseType.noticeOptional) {
errors << "Notice file missing for ('${dep.module}'), expected it at: ${noticeFile}"
@ -200,6 +209,34 @@ subprojects {
check.dependsOn(validateJars)
}
// Check for dangling files in the licenses folder.
configure([project(":solr"), project(":lucene"), ]) {
def validationTasks = subprojects.collect { it.tasks.matching { it.name == "validateJars" } }
task validateUnusedLicenseFiles() {
dependsOn validationTasks
doFirst {
def allReferenced = validationTasks.collectMany { task ->
task.project.jarInfos.collectMany { it.referencedFiles }
}
.collect { it.toString() }
def allExisting = licensesDir.listFiles()
.collect { it.toString() }
.collect { it.toString() }
def dangling = (allExisting - allReferenced)
if (dangling) {
gradle.buildFinished {
logger.warn("WARNING: there were unreferenced files under license folder:\n - ${dangling.join("\n - ")}")
}
}
}
}
}
// Disable validation for these projects (should it be disabled?)
configure(project(":solr:solr-ref-guide")) {
[validateJarLicenses, validateJarChecksums].each { task ->

View File

@ -117,14 +117,12 @@ dependencies {
testImplementation ('org.apache.kerby:kerb-admin') { transitive = false }
testImplementation ('org.apache.kerby:kerby-kdc') { transitive = false }
testImplementation ('com.sun.jersey:jersey-servlet:1.19.4') { transitive = false }
testImplementation ('com.sun.jersey:jersey-servlet') { transitive = false }
testImplementation 'com.google.protobuf:protobuf-java'
testImplementation 'commons-logging:commons-logging'
testImplementation('org.mockito:mockito-core', {
exclude group: "net.bytebuddy", module: "byte-buddy-agent"
})
testRuntimeOnly 'org.slf4j:log4j-over-slf4j'
}

View File

@ -42,7 +42,9 @@ dependencies {
testImplementation project(':solr:test-framework')
testImplementation 'org.eclipse.jetty:jetty-webapp'
testImplementation 'org.eclipse.jetty:jetty-alpn-java-server'
testImplementation ('org.eclipse.jetty:jetty-alpn-java-server', {
exclude group: "org.eclipse.jetty.alpn", module: "alpn-api"
})
testImplementation 'org.restlet.jee:org.restlet.ext.servlet'
testImplementation 'org.objenesis:objenesis'
testImplementation('org.mockito:mockito-core', {

View File

@ -179,7 +179,6 @@ org.eclipse.jetty:jetty-servlets:9.4.19.v20190610 (1 constraints: 8007517d)
org.eclipse.jetty:jetty-util:9.4.19.v20190610 (7 constraints: 77648009)
org.eclipse.jetty:jetty-webapp:9.4.19.v20190610 (2 constraints: 72178fc0)
org.eclipse.jetty:jetty-xml:9.4.19.v20190610 (3 constraints: 56274720)
org.eclipse.jetty.alpn:alpn-api:1.1.3.v20160715 (1 constraints: 6513848a)
org.eclipse.jetty.http2:http2-client:9.4.19.v20190610 (2 constraints: 4d1ff83f)
org.eclipse.jetty.http2:http2-common:9.4.19.v20190610 (3 constraints: 242bc31f)
org.eclipse.jetty.http2:http2-hpack:9.4.19.v20190610 (2 constraints: 50198f5c)
@ -203,7 +202,7 @@ org.restlet.jee:org.restlet:2.3.0 (2 constraints: e3159ee6)
org.restlet.jee:org.restlet.ext.servlet:2.3.0 (1 constraints: 0705fe35)
org.rrd4j:rrd4j:3.5 (1 constraints: ac04252c)
org.slf4j:jcl-over-slf4j:1.7.24 (1 constraints: 4005473b)
org.slf4j:slf4j-api:1.7.24 (19 constraints: a7ff2521)
org.slf4j:slf4j-api:1.7.24 (18 constraints: 66f4afd8)
org.slf4j:slf4j-simple:1.7.24 (1 constraints: 4005473b)
org.tallison:jmatio:1.5 (1 constraints: aa041f2c)
org.tukaani:xz:1.8 (1 constraints: ad04222c)
@ -211,7 +210,7 @@ ua.net.nlp:morfologik-ukrainian-search:3.9.0 (1 constraints: 0e051536)
xerces:xercesImpl:2.9.1 (2 constraints: f613d869)
[Test dependencies]
com.sun.jersey:jersey-servlet:1.19.4 (1 constraints: 4105483b)
com.sun.jersey:jersey-servlet:1.19 (1 constraints: df04fa30)
net.bytebuddy:byte-buddy:1.9.3 (2 constraints: 2510faaf)
org.apache.derby:derby:10.9.1.0 (1 constraints: 9b054946)
org.apache.hadoop:hadoop-hdfs:3.2.0 (1 constraints: 07050036)
@ -227,4 +226,3 @@ org.hsqldb:hsqldb:2.4.0 (1 constraints: 08050136)
org.locationtech.jts:jts-core:1.15.0 (1 constraints: 3905383b)
org.mockito:mockito-core:2.23.4 (1 constraints: 3d05403b)
org.objenesis:objenesis:2.6 (2 constraints: 5f0ffb79)
org.slf4j:log4j-over-slf4j:1.7.24 (1 constraints: 4005473b)

View File

@ -22,7 +22,6 @@ com.lmax:disruptor=3.4.2
com.pff:java-libpst=0.8.1
com.rometools:*=1.5.1
com.sun.jersey:*=1.19
com.sun.jersey:jersey-json=1.19.4
com.sun.mail:*=1.5.1
com.tdunning:t-digest=3.1
com.vaadin.external.google:android-json=0.0.20131108.vaadin1