Gentoo Archives: gentoo-commits

From: "Miroslav Šulc" <fordfrog@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
Date: Sun, 30 Aug 2020 18:22:08
Message-Id: 1598811644.766ecd34d054a963c7b7149d8e53676b289b8ea8.fordfrog@gentoo
1 commit: 766ecd34d054a963c7b7149d8e53676b289b8ea8
2 Author: Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
3 AuthorDate: Sun Aug 30 18:20:44 2020 +0000
4 Commit: Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
5 CommitDate: Sun Aug 30 18:20:44 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=766ecd34
7
8 minor style fixes and sorted methods in MavenProject
9
10 Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>
11
12 .../gentoo/java/ebuilder/maven/MavenProject.java | 98 +++++++++++-----------
13 1 file changed, 50 insertions(+), 48 deletions(-)
14
15 diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
16 index b7553b0..e91bb80 100644
17 --- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
18 +++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
19 @@ -3,6 +3,7 @@ package org.gentoo.java.ebuilder.maven;
20 import java.io.PrintWriter;
21 import java.nio.file.Path;
22 import java.util.ArrayList;
23 +import java.util.Arrays;
24 import java.util.Collections;
25 import java.util.List;
26 import java.util.SortedSet;
27 @@ -43,14 +44,14 @@ public class MavenProject {
28 * Whether the package has test classes.
29 */
30 private Boolean hasTests;
31 - /**
32 - * Lisences.
33 - */
34 - private SortedSet<String> licenses = new TreeSet<>();
35 /**
36 * Homepage URL.
37 */
38 private String homepage;
39 + /**
40 + * Lisences.
41 + */
42 + private final SortedSet<String> licenses = new TreeSet<>();
43 /**
44 * Application main class.
45 */
46 @@ -113,14 +114,12 @@ public class MavenProject {
47 /**
48 * Adds license to {@link #licenses}.
49 *
50 - * @param license {@link #licenses}
51 + * @param portageLicenses {@link #licenses}
52 */
53 public void addLicense(final String portageLicenses) {
54 final String[] parts = portageLicenses.split(":");
55
56 - for (String eachLicense: parts) {
57 - licenses.add(eachLicense);
58 - }
59 + licenses.addAll(Arrays.asList(parts));
60 }
61
62 /**
63 @@ -279,6 +278,40 @@ public class MavenProject {
64 this.description = description.replaceAll("[\n ]+", " ");
65 }
66
67 + /**
68 + * deal with scope == "system" dependencies
69 + *
70 + * @param writer writer
71 + *
72 + * @return lines of ebuild variables
73 + */
74 + @SuppressWarnings("unchecked")
75 + public String getExtraJars(final PrintWriter writer) {
76 + String ret = "";
77 + List<MavenDependency> systemDependencies = getDependencies(new String[]{
78 + "system"});
79 +
80 + for (final MavenDependency dependency : systemDependencies) {
81 + switch (dependency.getGroupId()) {
82 + case "com.sun":
83 + switch (dependency.getArtifactId()) {
84 + case "tools":
85 + ret += "JAVA_NEEDS_TOOLS=1\n";
86 + break;
87 + default:
88 + writer.println("Equivalent variable for "
89 + + dependency.getArtifactId() + " not found.");
90 + }
91 + break;
92 + default:
93 + writer.println("Equivalent variable for " + dependency.
94 + getGroupId() + " not found.");
95 + }
96 + }
97 +
98 + return ret;
99 + }
100 +
101 /**
102 * Getter for {@link #groupId}.
103 *
104 @@ -297,6 +330,15 @@ public class MavenProject {
105 this.groupId = groupId;
106 }
107
108 + /**
109 + * Setter for {@link #hasTests}
110 + *
111 + * @param hasTests {@link #hasTests}
112 + */
113 + public void setHasTests(boolean hasTests) {
114 + this.hasTests = hasTests;
115 + }
116 +
117 /**
118 * Getter for {@link #homepage}.
119 *
120 @@ -423,37 +465,6 @@ public class MavenProject {
121 this.sourceVersion = sourceVersion;
122 }
123
124 - /**
125 - * deal with scope == "system" dependencies
126 - *
127 - * @return lines of ebuild variables
128 - */
129 - @SuppressWarnings("unchecked")
130 - public String getExtraJars(final PrintWriter writer) {
131 - String ret = "";
132 - List<MavenDependency> systemDependencies = getDependencies(new String[]{"system"});
133 -
134 - for (final MavenDependency dependency : systemDependencies) {
135 - switch (dependency.getGroupId()) {
136 - case "com.sun":
137 - switch (dependency.getArtifactId()) {
138 - case "tools":
139 - ret += "JAVA_NEEDS_TOOLS=1\n";
140 - break;
141 - default:
142 - writer.println("Equivalent variable for " +
143 - dependency.getArtifactId() + " not found.");
144 - }
145 - break;
146 - default:
147 - writer.println("Equivalent variable for " +
148 - dependency.getGroupId() + " not found.");
149 - }
150 - }
151 -
152 - return ret;
153 - }
154 -
155 /**
156 * Getter for {@link #targetVersion}.
157 *
158 @@ -591,15 +602,6 @@ public class MavenProject {
159 return hasTests;
160 }
161
162 - /**
163 - * Setter for {@link #hasTests}
164 - *
165 - * @param hasTests {@link #hasTests}
166 - */
167 - public void setHasTests(boolean hasTests) {
168 - this.hasTests = hasTests;
169 - }
170 -
171 /**
172 * Returns dependencies based on the specified scopes.
173 *