1
0
Эх сурвалжийг харах

Build: Fix dependency licenses check to correctly skip projects without dependencies

Ryan Ernst 10 жил өмнө
parent
commit
f8026ed8fd

+ 7 - 8
buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/DependencyLicensesTask.groovy

@@ -106,16 +106,15 @@ public class DependencyLicensesTask extends DefaultTask {
 
     @TaskAction
     public void checkDependencies() {
-        // TODO REMOVE THIS DIRTY FIX FOR #15168
-        if (licensesDir.exists() == false) {
-            return
-        }
-        if (licensesDir.exists() == false && dependencies.isEmpty() == false) {
+        if (dependencies.isEmpty()) {
+            if (licensesDir.exists()) {
+                throw new GradleException("Licenses dir ${licensesDir} exists, but there are no dependencies")
+            }
+            return // no dependencies to check
+        } else if (licensesDir.exists() == false) {
             throw new GradleException("Licences dir ${licensesDir} does not exist, but there are dependencies")
         }
-        if (licensesDir.exists() && dependencies.isEmpty()) {
-            throw new GradleException("Licenses dir ${licensesDir} exists, but there are no dependencies")
-        }
+
 
         // order is the same for keys and values iteration since we use a linked hashmap
         List<String> mapped = new ArrayList<>(mappings.values())

+ 4 - 0
test-framework/build.gradle

@@ -43,3 +43,7 @@ forbiddenApisMain {
   signaturesURLs = [PrecommitTasks.getResource('/forbidden/all-signatures.txt'),
                     PrecommitTasks.getResource('/forbidden/test-signatures.txt')]
 }
+
+// TODO: should we have licenses for our test deps?
+dependencyLicenses.enabled = false
+