RussellSpitzer commented on code in PR #16543:
URL: https://github.com/apache/iceberg/pull/16543#discussion_r3866434160


##########
aws-bundle/build.gradle:
##########
@@ -60,6 +60,15 @@ project(":iceberg-aws-bundle") {
       include 'NOTICE'
     }
 
+    // exclude dependency-provided LICENSE/NOTICE files in favor of the 
bundled Iceberg ones
+    exclude 'META-INF/LICENSE*'
+    exclude 'META-INF/NOTICE*'
+
+    // dependencies that ship a root LICENSE/NOTICE would place a second copy 
next to the
+    // bundled ones above, so drop every root copy that is not read from the 
project directory
+    def bundledNotices = [file('LICENSE'), file('NOTICE')]

Review Comment:
   Why not do this programmatically instead of copying?
   
   ```groovy
   plugins.withId('com.gradleup.shadow') {
     tasks.named('shadowJar').configure { jar ->
       // keep Iceberg's aggregated LICENSE/NOTICE at the jar root
       jar.from(project.projectDir) {
         include 'LICENSE'
         include 'NOTICE'
       }
       // drop LICENSE/NOTICE that shaded dependencies put under META-INF/
       jar.exclude 'META-INF/LICENSE*'
       jar.exclude 'META-INF/NOTICE*'
       // drop a second root LICENSE/NOTICE that came out of a dependency jar.
       // entries copied from projectDir have a real File; archive entries do 
not,
       // so `it.file in bundledNotices` keeps the Iceberg pair and drops the 
rest.
       def bundledNotices = [project.file('LICENSE'), project.file('NOTICE')]
       jar.exclude { it.relativePath.pathString in ['LICENSE', 'NOTICE'] && 
!(it.file in bundledNotices) }
     }
   }
   ``` 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to