You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2022/04/14 09:12:00 UTC

[groovy] 02/02: remove duplicate entries in jars warnings

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

paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 90ec9d2652ee2a88b8d7e58df09a96e7304bf58b
Author: Paul King <pa...@asert.com.au>
AuthorDate: Thu Apr 14 19:11:50 2022 +1000

    remove duplicate entries in jars warnings
---
 build.gradle                                       |  3 ++-
 .../src/main/groovy/org.apache.groovy-base.gradle  | 27 +++++++++++-----------
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/build.gradle b/build.gradle
index e7de4b7de1..4ee61d3ddd 100644
--- a/build.gradle
+++ b/build.gradle
@@ -183,7 +183,7 @@ configurations {
 
 allprojects {
     tasks.withType(AbstractCopyTask).configureEach {
-        it.duplicatesStrategy = DuplicatesStrategy.WARN
+        it.duplicatesStrategy = DuplicatesStrategy.FAIL
     }
 }
 
@@ -198,6 +198,7 @@ tasks.named('jar') {
         from("$projectDir/notices/NOTICE-JARJAR")
         rename '^([A-Z]+)-([^.]*)', '$1'
     }
+    exclude '**/package-info.class'
 }
 
 
diff --git a/buildSrc/src/main/groovy/org.apache.groovy-base.gradle b/buildSrc/src/main/groovy/org.apache.groovy-base.gradle
index 2f1ef85ba0..06b3719779 100644
--- a/buildSrc/src/main/groovy/org.apache.groovy-base.gradle
+++ b/buildSrc/src/main/groovy/org.apache.groovy-base.gradle
@@ -149,25 +149,26 @@ tasks.withType(AbstractArchiveTask) {
     reproducibleFileOrder = true
 }
 
-tasks.withType(Jar).configureEach {
+tasks.withType(Jar).configureEach {jar ->
     metaInf {
-        if (file("${projectDir}/LICENSE").exists()) {
-            from "${projectDir}/LICENSE"
-        } else {
-            from("${rootProject.projectDir}/licenses/LICENSE-BASE") {
-                rename 'LICENSE-BASE', 'LICENSE'
+        if (jar.name == 'sourcesJar') {
+            if (file("${projectDir}/LICENSE").exists()) {
+                from "${projectDir}/LICENSE"
+            } else {
+                from("${rootProject.projectDir}/licenses/LICENSE-BASE") {
+                    rename 'LICENSE-BASE', 'LICENSE'
+                }
             }
-        }
-        if (file("${projectDir}/NOTICE").exists()) {
-            from "${projectDir}/NOTICE"
-        } else {
-            from("${rootProject.projectDir}/notices/NOTICE-BASE") {
-                rename 'NOTICE-BASE', 'NOTICE'
+            if (file("${projectDir}/NOTICE").exists()) {
+                from "${projectDir}/NOTICE"
+            } else {
+                from("${rootProject.projectDir}/notices/NOTICE-BASE") {
+                    rename 'NOTICE-BASE', 'NOTICE'
+                }
             }
         }
         from generateReleaseInfo
     }
-    exclude '**/package-info.class'
 }
 
 tasks.register("jarjar", JarJarTask) {