You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2019/12/13 12:31:40 UTC

[lucene-solr] 07/07: Consolidating versions between gradle and ant.

This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch gradle-master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 4500f0e3272030544a92e1f3cbf35742a75b8092
Author: Dawid Weiss <dw...@apache.org>
AuthorDate: Fri Dec 13 13:31:23 2019 +0100

    Consolidating versions between gradle and ant.
---
 gradle/validation/jar-checks.gradle | 41 +++++++++++++++++++++++++++++++++++--
 solr/core/build.gradle              |  4 +---
 solr/solrj/build.gradle             |  4 +++-
 versions.lock                       |  6 ++----
 versions.props                      |  1 -
 5 files changed, 45 insertions(+), 11 deletions(-)

diff --git a/gradle/validation/jar-checks.gradle b/gradle/validation/jar-checks.gradle
index 29f14d3..c642ece 100644
--- a/gradle/validation/jar-checks.gradle
+++ b/gradle/validation/jar-checks.gradle
@@ -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 ->
diff --git a/solr/core/build.gradle b/solr/core/build.gradle
index 2ddddb4..09af2b9 100644
--- a/solr/core/build.gradle
+++ b/solr/core/build.gradle
@@ -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'
 }
 
diff --git a/solr/solrj/build.gradle b/solr/solrj/build.gradle
index c77d2dc..48ddd65 100644
--- a/solr/solrj/build.gradle
+++ b/solr/solrj/build.gradle
@@ -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', {
diff --git a/versions.lock b/versions.lock
index 6dffa9e..ba99073 100644
--- a/versions.lock
+++ b/versions.lock
@@ -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)
diff --git a/versions.props b/versions.props
index 25ffdf0..72c70b9 100644
--- a/versions.props
+++ b/versions.props
@@ -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