diff options
author | zongyu <zzy2529420793@gmail.com> | 2020-08-19 16:02:07 +0800 |
---|---|---|
committer | zongyu <zzy2529420793@gmail.com> | 2020-08-19 16:07:40 +0800 |
commit | e024794b5f61201fc1db11fdfc40fa05b03125ed (patch) | |
tree | a4d80673aa44b239011db6b7406916fda772b985 | |
parent | improve the coding style of ebuild (diff) | |
download | java-ebuilder-e024794b5f61201fc1db11fdfc40fa05b03125ed.tar.gz java-ebuilder-e024794b5f61201fc1db11fdfc40fa05b03125ed.tar.bz2 java-ebuilder-e024794b5f61201fc1db11fdfc40fa05b03125ed.zip |
recognize and write JAVA_NEEDS_TOOLS automatically
Signed-off-by: zongyu <zzy2529420793@gmail.com>
-rw-r--r-- | src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java | 3 | ||||
-rw-r--r-- | src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java | 31 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java index b16a64e..c1e84d1 100644 --- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java +++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java @@ -749,6 +749,7 @@ public class MavenEbuilder { // JAVA_CLASSPATH_EXTRA // JAVA_TEST_GENTOO_CLASSPATH // JAVA_ENCODING (unless it differs in projects) + // JAVA_NEED_TOOLS // Compile (jars, doc): // JAVA_SRC_DIR // JAVA_RESOURCE_DIRS @@ -878,6 +879,8 @@ public class MavenEbuilder { writer.println('"'); } + writer.print(mavenProject.getExtraJars(config.getStdoutWriter())); + writer.print("JAVA_SRC_DIR=\""); writer.print(replaceWithVars(config.getWorkdir().relativize( mavenProject.getSourceDirectory()).toString(), config)); 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 794f992..b7553b0 100644 --- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java +++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java @@ -424,6 +424,37 @@ 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} |