This is an automated email from the ASF dual-hosted git repository.
bchapuis pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git
The following commit(s) were added to refs/heads/main by this push:
new ba2790e1 Group third-party dependencies by license (#759)
ba2790e1 is described below
commit ba2790e14e3c6788766fa7156af9267d91068bba
Author: Perdjesk <[email protected]>
AuthorDate: Wed Aug 30 22:46:18 2023 +0200
Group third-party dependencies by license (#759)
---
baremaps-cli/licenseBundledDeps.ftl | 56 +++++++++++++++++++++++++++++++++++++
baremaps-cli/pom.xml | 24 ++++++++++++++--
2 files changed, 78 insertions(+), 2 deletions(-)
diff --git a/baremaps-cli/licenseBundledDeps.ftl
b/baremaps-cli/licenseBundledDeps.ftl
new file mode 100644
index 00000000..3d301307
--- /dev/null
+++ b/baremaps-cli/licenseBundledDeps.ftl
@@ -0,0 +1,56 @@
+<#-- Adapted from
+
https://github.com/mojohaus/license-maven-plugin/blob/eb6a29e568691e981627cc619e10c91c8a1cc661/src/main/resources/org/codehaus/mojo/license/third-party-file-groupByMultiLicense.ftl
+-->
+
+<#-- Format artifact "name (groupId:artifactId:version - url)" -->
+<#function artifactFormat artifact>
+ <#if artifact.name?index_of('Unnamed') > -1>
+ <#return artifact.artifactId + " (" + artifact.groupId + ":" +
artifact.artifactId + ":" + artifact.version + " - " + (artifact.url!"no url
defined") + ")">
+ <#else>
+ <#return artifact.name + " (" + artifact.groupId + ":" +
artifact.artifactId + ":" + artifact.version + " - " + (artifact.url!"no url
defined") + ")">
+ </#if>
+</#function>
+
+<#-- Create a key from provided licenses list, ordered alphabetically:
"license A, license B, license C" -->
+<#function licensesKey licenses>
+ <#local result = "">
+ <#list licenses?sort as license>
+ <#local result=result + " ; " + license>
+ </#list>
+ <#return result?substring(3)>
+</#function>
+
+<#-- Aggregate dependencies map for generated license key (support for
multi-license) and convert artifacts to string -->
+<#function aggregateLicenses dependencies>
+ <#assign aggregate = {}>
+ <#list dependencyMap as entry>
+ <#assign project = artifactFormat(entry.getKey())/>
+ <#assign licenses = entry.getValue()/>
+ <#assign key = licensesKey(licenses)/>
+ <#if aggregate[key]?? >
+ <#assign replacement = aggregate[key] + [project] />
+ <#assign aggregate = aggregate + {key:replacement} />
+ <#else>
+ <#assign aggregate = aggregate + {key:[project]} />
+ </#if>
+ </#list>
+ <#return aggregate>
+</#function>
+
+This product bundles the following dependencies grouped by their license type:
+
+<#if dependencyMap?size == 0>
+ The project has no dependencies.
+<#else>
+<#assign aggregate = aggregateLicenses(dependencyMap)>
+ <#-- Print sorted aggregate licenses -->
+ <#list aggregate?keys?sort as licenses>
+ <#assign projects = aggregate[licenses]/>
+
+${licenses}
+ <#-- Print sorted projects -->
+ <#list projects?sort as project>
+ * ${project}
+ </#list>
+ </#list>
+</#if>
diff --git a/baremaps-cli/pom.xml b/baremaps-cli/pom.xml
index 4e7efbe7..5e9ae9d2 100644
--- a/baremaps-cli/pom.xml
+++ b/baremaps-cli/pom.xml
@@ -154,10 +154,30 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
- <version>2.1.0</version>
+ <version>2.2.0</version>
<configuration>
+ <force>true</force>
<thirdPartyFilename>THIRD-PARTY</thirdPartyFilename>
- <excludedScopes>test</excludedScopes>
+ <!-- Template to group by license with handling of multi licensing
-->
+ <fileTemplate>${basedir}/licenseBundledDeps.ftl</fileTemplate>
+ <!-- Only bundled bits matters
https://infra.apache.org/licensing-howto.html#bundled-vs-non-bundled -->
+ <excludedScopes>test,provided</excludedScopes>
+ <!-- If true enforces excluding transitive dependencies of the
excluded artifacts in the reactor;
+ otherwise only artifacts that match exclude filters are excluded.
+ It excludes all transitives dependencies of excludedScopes
dependencies. -->
+ <excludeTransitiveDependencies>true</excludeTransitiveDependencies>
+ <licenseMerges>
+ <licenseMerge>Apache License, Version 2.0|Apache 2|Apache 2.0
|Apache License 2.0|Apache License V2.0
+ |Apache License v2.0|Apache License, 2.0|Apache Software
License, version 2.0
+ |The Apache License, Version 2.0|The Apache Software License,
Version 2.0|The Apache Software License, version 2.0</licenseMerge>
+ <licenseMerge>BSD-2-Clause|BSD 2-Clause</licenseMerge>
+ <licenseMerge>Eclipse Distribution License - v 1.0|EDL
1.0</licenseMerge>
+ <licenseMerge>Eclipse Public License - v 2.0|EPL 2.0|Eclipse
Public License v2.0|Eclipse Public License, Version 2.0</licenseMerge>
+ <licenseMerge>MIT License|MIT license|The MIT License|The MIT
License (MIT)</licenseMerge>
+ <licenseMerge>GNU General Public License (GPL), version 2, with
the Classpath exception
+ |GPL2 w/ CPE
+ |The GNU General Public License (GPL), Version 2, With Classpath
Exception</licenseMerge>
+ </licenseMerges>
</configuration>
<executions>
<execution>