diff options
author | 2020-08-01 17:04:07 +0800 | |
---|---|---|
committer | 2020-08-01 23:17:55 +0800 | |
commit | 1c7018663e04e676f4ff74a9604913a81ddbfbf4 (patch) | |
tree | 61ef7daf765e30bd9966454563a26fd689b9c979 | |
parent | initial effort to make java-ebuilder parse licenses from pom.xml (diff) | |
download | java-ebuilder-1c7018663e04e676f4ff74a9604913a81ddbfbf4.tar.gz java-ebuilder-1c7018663e04e676f4ff74a9604913a81ddbfbf4.tar.bz2 java-ebuilder-1c7018663e04e676f4ff74a9604913a81ddbfbf4.zip |
Use Set instead of List for storing Licenses, update license map
Signed-off-by: zongyu <zzy2529420793@gmail.com>
3 files changed, 161 insertions, 6 deletions
diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenLicenses.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenLicenses.java index e2db62c..f2f4f9a 100644 --- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenLicenses.java +++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenLicenses.java @@ -51,7 +51,8 @@ public class MavenLicenses { * @return license identifier that works with Portage */ public String getEquivalentLicense(String licenseName) { - final String portageLicense = licenseMap.get(licenseName); + final String portageLicense = + licenseMap.get(licenseName.toLowerCase()); if (portageLicense == null) { return "!!!equivalentPortageLicenseName-not-found!!!"; diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java index fa4958d..2fd88de 100644 --- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java +++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java @@ -4,7 +4,9 @@ import java.io.PrintWriter; import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; +import java.util.HashSet; import java.util.List; +import java.util.Set; /** * Contains information about maven project collected from pom.xml. @@ -44,7 +46,7 @@ public class MavenProject { /** * Lisences. */ - private List<String> licenses = new ArrayList<>(10); + private Set<String> licenses = new HashSet<>(10); /** * Homepage URL. */ @@ -113,8 +115,12 @@ public class MavenProject { * * @param license {@link #licenses} */ - public void addLicense(final String license) { - licenses.add(license); + public void addLicense(final String portageLicenses) { + final String[] parts = portageLicenses.split(":"); + + for (String eachLicense: parts) { + licenses.add(eachLicense); + } } /** diff --git a/src/main/resources/licenseMap.properties b/src/main/resources/licenseMap.properties index fe9262a..5cd2e5d 100644 --- a/src/main/resources/licenseMap.properties +++ b/src/main/resources/licenseMap.properties @@ -1,2 +1,150 @@ -#Fri Jul 31 23:28:29 CST 2020 -Apache\ License,\ Version\ 2.0=Apache-2.0 +#Sat Aug 01 15:44:04 CST 2020 +# A properties file that maps license name of pom.xml to +# portage compatible names. +# +# If the name indicates multiple licenses, please record +# the license like: +#@CODE +# name\ from\ pom.xml=GPL-2:MIT:BSD +#@CODE +# +# If it indicates multiple choices of licenses, please +# record the license like: +#@CODE +# name\ from\ pom.xml=||\ (\ GPL-2\ MIT\ ) +#@CODE +# +# according to dev-java/bcpkix::gentoo +bouncy\ castle\ licence=BSD +# according to dev-lang/scala::gentoo +bsd-like=BSD +# +3-clause\ bsd\ license=BSD +apache\ 2=Apache-2.0 +apache\ 2.0=Apache-2.0 +apache-2.0=Apache-2.0 +apache\ 2.0\ license=Apache-2.0 +apache\ license=Apache +apache\ license\ 2=Apache-2.0 +apache\ license\ 2.0=Apache-2.0 +apache\ license,\ 2.0=Apache-2.0 +apache\ license\ v2.0=Apache-2.0 +apache\ license\ version\ 2=Apache-2.0 +apache\ license,\ version\ 2.0=Apache-2.0 +apache\ license\ version\ 2.0=Apache-2.0 +apache\ license,\ version\ 2.0=Apache-2.0 +apache\ public\ license\ 2.0=Apache-2.0 +apache\ software\ license,\ version\ 1.1=Apache-1.1 +apache\ software\ license\ -\ version\ 2.0=Apache-2.0 +apache\ v2=Apache-2.0 +asf\ 2.0=Apache-2.0 +asl=Apache-2.0 +asl\ 2.0=Apache-2.0 +asl,\ version\ 2=Apache-2.0 +bsd=BSD-1 +bsd\ 2-clause=BSD-2 +bsd-2-clause=BSD-2 +bsd\ 2-clause\ license=BSD-2 +bsd\ 3-clause=BSD +bsd-3-clause=BSD +bsd\ licence=BSD-1 +bsd\ license=BSD-1 +bsd\ style=BSD +cc0=CC0-1.0 +cddl\ 1.0=CDDL +cddl\ 1.1=CDDL-1.1 +cddl+gpl\ license=CDDL:GPL-1 +cddl/gplv2+ce=||\ (\ CDDL\ GPL-2-with-classpath-exception\ ) +cddl\ +\ gplv2\ with\ classpath\ exception=CDDL:GPL-2-with-classpath-exception +cddl\ license=CDDL +cddl\ v1.1\ /\ gpl\ v2\ dual\ license=CDDL-1.1:GPL-2 +common\ development\ and\ distribution\ license=CDDL +common\ development\ and\ distribution\ license\ (cddl)\ plus\ gpl=CDDL:GPL +common\ development\ and\ distribution\ license\ (cddl)\ v1.0=CDDL +common\ development\ and\ distribution\ license\ (cddl)\ version\ 1.0=CDDL +common\ public\ license\ -\ v\ 1.0=CPL-1.0 +common\ public\ license\ version\ 1.0=CPL-1.0 +dual\ license\ consisting\ of\ the\ cddl\ v1.1\ and\ gpl\ v2=CDDL-1.1:GPL-2 +eclipse\ distribution\ license\ (edl),\ version\ 1.0=EPL-1.0 +eclipse\ distribution\ license\ -\ v\ 1.0=EPL-1.0 +eclipse\ distribution\ license\ v.\ 1.0=EPL-1.0 +eclipse\ public\ license=EPL-1.0 +eclipse\ public\ license\ 1.0=EPL-1.0 +eclipse\ public\ license\ 2.0=EPL-2.0 +eclipse\ public\ license\ (epl),\ version\ 1.0=EPL-1.0 +eclipse\ public\ license\ -\ v\ 1.0=EPL-1.0 +eclipse\ public\ license\ v1.0=EPL-1.0 +eclipse\ public\ license\ -\ v\ 2.0=EPL-2.0 +eclipse\ public\ license\ v.\ 2.0=EPL-2.0 +eclipse\ public\ license\ v2.0=EPL-2.0 +eclipse\ public\ license\ -\ version\ 1.0=EPL-1.0 +eclipse\ public\ license,\ version\ 1.0=EPL-1.0 +eclipse\ public\ license\ -\ version\ 2.0=EPL-2.0 +eclipse\ public\ license,\ version\ 2.0=EPL-2.0 +edl\ 1.0=EPL-1.0 +epl=EPL-1.0 +epl\ 2.0=EPL-2.0 +epl-2.0=EPL-2.0 +gnu\ general\ public\ library=GPL-1 +gnu\ general\ public\ license,\ version\ 2=GPL-2 +gnu\ general\ public\ license\ version\ 2=GPL-2 +gnu\ general\ public\ license,\ version\ 2\ with\ the\ classpath\ exception=GPL-2-with-classpath-exception +gnu\ general\ public\ license,\ version\ 2,\ with\ the\ classpath\ exception=GPL-2-with-classpath-exception +gnu\ general\ public\ license,\ version\ 2\ with\ the\ gnu\ classpath\ exception=GPL-2-with-classpath-exception +gnu\ lesser\ general\ public\ licence=LGPL-3 +gnu\ lesser\ general\ public\ license=LGPL-3 +gnu\ lesser\ general\ public\ license\ as\ published\ by\ the\ free\ software\ foundation;\ either\ version\ 2.1\ of\ the\ license,\ or\ (at\ your\ option)\ any\ later\ version.=LGPL-2.1 +gnu\ lesser\ general\ public\ license\ (lgpl)=LGPL-3 +gnu\ lesser\ general\ public\ license\ (lgpl),\ version\ 2.1=LGPL-2.1 +gnu\ lesser\ general\ public\ license\ v2.1=LGPL-2.1 +gnu\ lesser\ general\ public\ license\ version\ 2.1=LGPL-2.1 +gnu\ lesser\ general\ public\ license,\ version\ 2.1=LGPL-2.1 +gnu\ lesser\ public\ license=LGPL-3 +gnu\ lgplv3=LGPL-3 +gnu\ library\ general\ public\ license\ v2.1\ or\ later=LGPL-2.1 +go\ license=BSD +gpl-2.0=GPL-2 +gpl-2.0-with-classpath-exception=GPL-2-with-classpath-exception +gpl2\ w/\ cpe=GPL-2-with-classpath-exception +gpl\ 3=GPL-3 +gpl\ v2=GPL-2 +gpl\ v2\ with\ classpath\ exception=GPL-2-with-classpath-exception +hsqldb\ license=BSD +indiana\ university\ extreme!\ lab\ software\ license=Indiana-University-Extreme-Lab +indiana\ university\ extreme!\ lab\ software\ license\ 1.1.1=Indiana-University-Extreme-Lab +indiana\ university\ extreme!\ lab\ software\ license,\ vesion\ 1.1.1=Indiana-University-Extreme-Lab +jquery\ license=MIT:CC0 +lgpl=LGPL-3 +lgpl\ 2.1=LGPL-2.1 +lgpl-2.1=LGPL-2.1 +lgpl\ 3=LGPL-3 +lgplv2.1=LGPL-2.1 +lgpl,\ version\ 2.1=LGPL-2.1 +mit\ license=MIT +modified\ bsd=BSD +mozilla\ public\ license\ 1.1\ (mpl\ 1.1)=MPL-1.1 +mozilla\ public\ license\ version\ 2.0=MPL-2.0 +mpl\ 1.1=MPL-1.1 +mpl\ 2.0\ or\ epl\ 1.0=||\ (\ MPL-1.1\ EPL-1.0\ ) +new\ bsd\ license=BSD +provided\ without\ support\ or\ warranty=JSON +public\ domain=public-domain +public\ domain,\ per\ creative\ commons\ cc0=public-domain +public\ domain,\ sun\ microsoystems=public-domain +revised\ bsd=BSD +similar\ to\ apache\ license\ but\ with\ the\ acknowledgment\ clause\ removed=Apache-2.0 +spec\ evaluation\ license=Apache-2.0 +spec\ implementation\ license=Apache-2.0 +the\ apache\ license,\ version\ 2.0=Apache-2.0 +the\ apache\ software\ license,\ version\ 2.0=Apache-2.0 +the\ bsd\ 2-clause\ license=BSD-2 +the\ bsd\ 3-clause\ license=BSD +the\ bsd\ license=BSD +the\ gnu\ general\ public\ license\ (gpl),\ version\ 2,\ with\ classpath\ exception=GPL-2-with-classpath-exception +the\ gnu\ lesser\ general\ public\ license,\ version\ 2.1=LGPL-2.1 +the\ go\ license=BSD +the\ json\ license=JSON +the\ mit\ license=MIT +the\ new\ bsd\ license=BSD +universal\ permissive\ license,\ version\ 1.0=UPL-1.0 +w3c\ license=W3C |