aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiroslav Šulc <fordfrog@gentoo.org>2020-08-30 20:20:44 +0200
committerMiroslav Šulc <fordfrog@gentoo.org>2020-08-30 20:20:44 +0200
commit766ecd34d054a963c7b7149d8e53676b289b8ea8 (patch)
tree61b3c70b8c2209ced44101319ac0db668ba7c9a1
parentversion updated (diff)
downloadjava-ebuilder-766ecd34d054a963c7b7149d8e53676b289b8ea8.tar.gz
java-ebuilder-766ecd34d054a963c7b7149d8e53676b289b8ea8.tar.bz2
java-ebuilder-766ecd34d054a963c7b7149d8e53676b289b8ea8.zip
minor style fixes and sorted methods in MavenProject
Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
-rw-r--r--src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java98
1 files changed, 50 insertions, 48 deletions
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 b7553b0..e91bb80 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
@@ -3,6 +3,7 @@ package org.gentoo.java.ebuilder.maven;
import java.io.PrintWriter;
import java.nio.file.Path;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.SortedSet;
@@ -44,14 +45,14 @@ public class MavenProject {
*/
private Boolean hasTests;
/**
- * Lisences.
- */
- private SortedSet<String> licenses = new TreeSet<>();
- /**
* Homepage URL.
*/
private String homepage;
/**
+ * Lisences.
+ */
+ private final SortedSet<String> licenses = new TreeSet<>();
+ /**
* Application main class.
*/
private String mainClass;
@@ -113,14 +114,12 @@ public class MavenProject {
/**
* Adds license to {@link #licenses}.
*
- * @param license {@link #licenses}
+ * @param portageLicenses {@link #licenses}
*/
public void addLicense(final String portageLicenses) {
final String[] parts = portageLicenses.split(":");
- for (String eachLicense: parts) {
- licenses.add(eachLicense);
- }
+ licenses.addAll(Arrays.asList(parts));
}
/**
@@ -280,6 +279,40 @@ public class MavenProject {
}
/**
+ * deal with scope == "system" dependencies
+ *
+ * @param writer writer
+ *
+ * @return lines of ebuild variables
+ */
+ @SuppressWarnings("unchecked")
+ public String getExtraJars(final PrintWriter writer) {
+ String ret = "";
+ List<MavenDependency> systemDependencies = getDependencies(new String[]{
+ "system"});
+
+ for (final MavenDependency dependency : systemDependencies) {
+ switch (dependency.getGroupId()) {
+ case "com.sun":
+ switch (dependency.getArtifactId()) {
+ case "tools":
+ ret += "JAVA_NEEDS_TOOLS=1\n";
+ break;
+ default:
+ writer.println("Equivalent variable for "
+ + dependency.getArtifactId() + " not found.");
+ }
+ break;
+ default:
+ writer.println("Equivalent variable for " + dependency.
+ getGroupId() + " not found.");
+ }
+ }
+
+ return ret;
+ }
+
+ /**
* Getter for {@link #groupId}.
*
* @return {@link #groupId}
@@ -298,6 +331,15 @@ public class MavenProject {
}
/**
+ * Setter for {@link #hasTests}
+ *
+ * @param hasTests {@link #hasTests}
+ */
+ public void setHasTests(boolean hasTests) {
+ this.hasTests = hasTests;
+ }
+
+ /**
* Getter for {@link #homepage}.
*
* @return {@link #homepage}
@@ -424,37 +466,6 @@ public class MavenProject {
}
/**
- * deal with scope == "system" dependencies
- *
- * @return lines of ebuild variables
- */
- @SuppressWarnings("unchecked")
- public String getExtraJars(final PrintWriter writer) {
- String ret = "";
- List<MavenDependency> systemDependencies = getDependencies(new String[]{"system"});
-
- for (final MavenDependency dependency : systemDependencies) {
- switch (dependency.getGroupId()) {
- case "com.sun":
- switch (dependency.getArtifactId()) {
- case "tools":
- ret += "JAVA_NEEDS_TOOLS=1\n";
- break;
- default:
- writer.println("Equivalent variable for " +
- dependency.getArtifactId() + " not found.");
- }
- break;
- default:
- writer.println("Equivalent variable for " +
- dependency.getGroupId() + " not found.");
- }
- }
-
- return ret;
- }
-
- /**
* Getter for {@link #targetVersion}.
*
* @return {@link #targetVersion}
@@ -592,15 +603,6 @@ public class MavenProject {
}
/**
- * Setter for {@link #hasTests}
- *
- * @param hasTests {@link #hasTests}
- */
- public void setHasTests(boolean hasTests) {
- this.hasTests = hasTests;
- }
-
- /**
* Returns dependencies based on the specified scopes.
*
* @param scopes array of scopes