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

toulmean pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git


The following commit(s) were added to refs/heads/master by this push:
     new a3e8d68  Add a different NOTICE for binary distrib
     new aa47fe7  Merge pull request #171 from 
atoulme/add_notice_for_binary_distrib
a3e8d68 is described below

commit a3e8d689fbc5e96a4d92504cabb85aadda9bdd22
Author: Antoine Toulme <anto...@lunar-ocean.com>
AuthorDate: Sun Nov 22 00:33:28 2020 -0800

    Add a different NOTICE for binary distrib
---
 dist/build.gradle            |  7 ++++++-
 gradle/check-licenses.gradle | 26 ++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/dist/build.gradle b/dist/build.gradle
index 91d04dd..c4f00f3 100644
--- a/dist/build.gradle
+++ b/dist/build.gradle
@@ -27,7 +27,6 @@ static def mandatoryFiles(CopySpec spec) {
     from ".."
     include 'DISCLAIMER'
     include 'LICENSE'
-    include 'NOTICE'
   }
   spec.into('licenses') { from '../build/reports/license' }
 }
@@ -55,6 +54,7 @@ asfNexusPassword=
 }
 
 assemble.dependsOn builtGradleProperties
+assemble.dependsOn rootProject.createNotice
 
 distributions {
   main {
@@ -65,6 +65,10 @@ distributions {
         from ".."
         include 'README.md'
       }
+      into('') {
+        from "../build/reports/notice"
+        include 'NOTICE'
+      }
       def libs = []
       def sources = []
       rootProject.subprojects.each { s ->
@@ -102,6 +106,7 @@ distributions {
       mandatoryFiles(it)
       into('') {
         from ".."
+        include 'NOTICE'
         include 'README.md'
         include 'build.sh'
         include 'build.bat'
diff --git a/gradle/check-licenses.gradle b/gradle/check-licenses.gradle
index 300bb37..f251b91 100644
--- a/gradle/check-licenses.gradle
+++ b/gradle/check-licenses.gradle
@@ -193,3 +193,29 @@ task checkLicenses {
     }
   }
 }
+
+task createNotice {
+  description "Create a NOTICE file with all dependencies"
+  dependsOn ':downloadLicenses'
+
+  doLast {
+    def xml = new 
XmlParser().parse("$rootProject.buildDir/reports/license/license-dependency.xml")
+    new File("$rootProject.buildDir/reports/notice").mkdirs()
+    def binaryNoticeFile = new 
File("$rootProject.buildDir/reports/notice/NOTICE")
+    binaryNoticeFile.write(new File("$rootProject.projectDir/NOTICE").text)
+    def lines = []
+    def maxLength = 0
+    xml.each { license ->
+      license.dependency.each {
+        def line = it.text() + " is bundled with this distribution under " + 
license.@name + "."
+        maxLength = Math.max(maxLength, line.size())
+        lines << line
+      }
+    }
+    for (line in lines) {
+      binaryNoticeFile.append("=".repeat(maxLength) + "\n")
+      binaryNoticeFile.append(line + "\n")
+    }
+    binaryNoticeFile.append("=".repeat(maxLength) + "\n")
+  }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@tuweni.apache.org
For additional commands, e-mail: commits-h...@tuweni.apache.org

Reply via email to