diff options
author | 2020-08-18 11:20:45 +0800 | |
---|---|---|
committer | 2020-08-18 16:05:21 +0800 | |
commit | ab6630af6804d8e79e3a3f6ab31b5abb8a6f6d9c (patch) | |
tree | 5173dfd0286697f9a8c95a51c3bf5cc57b426d40 | |
parent | update java-pkg-maven, add two licenses (diff) | |
download | java-ebuilder-ab6630af6804d8e79e3a3f6ab31b5abb8a6f6d9c.tar.gz java-ebuilder-ab6630af6804d8e79e3a3f6ab31b5abb8a6f6d9c.tar.bz2 java-ebuilder-ab6630af6804d8e79e3a3f6ab31b5abb8a6f6d9c.zip |
improve the coding style of ebuild
Signed-off-by: zongyu <zzy2529420793@gmail.com>
-rw-r--r-- | src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java | 107 |
1 files changed, 53 insertions, 54 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 bfedb68..b16a64e 100644 --- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java +++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java @@ -32,14 +32,6 @@ public class MavenEbuilder { = "https://wiki.gentoo.org/wiki/No_homepage"; /** - * The extra dependency for framework "pkgdiff" - */ - private static final String dependencyForPkgdiff - = "\n\t\tamd64? (\n\t\t\tdev-util/pkgdiff" - + "\n\t\t\tdev-util/japi-compliance-checker" - + "\n\t\t)"; - - /** * EAPI version. */ private static final String EAPI = "7"; @@ -389,7 +381,9 @@ public class MavenEbuilder { dependencies.stream().filter((dependency) -> (dependency.getSystemDependency() != null - && !result.contains(dependency.getSystemDependency()))). + && !result.contains(dependency.getSystemDependency()) + && (determineTestingFrameworkByDependency(dependency) == null + || type != "test"))). forEach((dependency) -> { result.add(dependency.getSystemDependency()); }); @@ -555,26 +549,39 @@ public class MavenEbuilder { writer.println("\tapp-arch/unzip"); } - if (config.hasBinjarUri() && (hasCDepend || !compileDependencies.isEmpty())) { - writer.println("\t!binary? ("); - } - - if (hasCDepend) { - writer.println("\t${CDEPEND}"); - } + if (config.hasBinjarUri()) { + if (hasCDepend && compileDependencies.isEmpty()) { + writer.println("\t!binary? ( ${CDEPEND} )"); + } else if (!compileDependencies.isEmpty()) { + writer.println("\t!binary? ("); + + if (hasCDepend) { + writer.println("\t\t${CDEPEND}"); + } + + if (!compileDependencies.isEmpty()) { + compileDependencies.stream().forEach((dependency) -> { + writer.print("\t\t"); + writer.println(dependency); + }); + } - if (!compileDependencies.isEmpty()) { - compileDependencies.stream().forEach((dependency) -> { - writer.print('\t'); - writer.println(dependency); - }); - } + writer.println("\t)"); + } + } else { + if (hasCDepend) { + writer.println("\t${CDEPEND}"); + } - if (config.hasBinjarUri() && (hasCDepend || !compileDependencies.isEmpty())) { - writer.println("\t)"); + if (!compileDependencies.isEmpty()) { + compileDependencies.stream().forEach((dependency) -> { + writer.print('\t'); + writer.println(dependency); + }); + } } - if (!testDependencies.isEmpty() || config.hasBinjarUri()) { + if (!testDependencies.isEmpty()) { writer.println("\ttest? ("); testDependencies.stream().forEach((dependency) -> { @@ -582,11 +589,6 @@ public class MavenEbuilder { writer.println(dependency); }); - // TODO: is it necessary to check whether amd64 is inside KEYWORDS? - if (config.hasBinjarUri()) { - writer.println(dependencyForPkgdiff); - } - writer.println("\t)"); } @@ -611,7 +613,7 @@ public class MavenEbuilder { writer.println(":*"); if (hasCDepend) { - writer.print("${CDEPEND}"); + writer.print("\t${CDEPEND}"); } if (!runtimeDependencies.isEmpty()) { @@ -700,6 +702,26 @@ public class MavenEbuilder { } writer.println('"'); + + // write MAVEN_ID ahead of DESCRIPTION + writer.print("MAVEN_ID=\""); + writer.print(mavenProject.getGroupId()); + writer.print(':'); + writer.print(mavenProject.getArtifactId()); + writer.print(':'); + writer.print(mavenProject.getVersion()); + writer.println('"'); + + // write testing framworks, so java-pkg-simple.eclass can deal with it + final String testingFramework + = determineTestingFramework(mavenProject, config); + + if (testingFramework != null) { + writer.print("JAVA_TESTING_FRAMEWORKS=\""); + writer.print(testingFramework); + writer.println('"'); + } + writer.println(); writer.print("inherit java-pkg-2 java-pkg-simple"); @@ -750,16 +772,6 @@ public class MavenEbuilder { final MavenProject mavenProject, final PrintWriter writer) { writer.println(); - // write MAVEN_ID ahead of DESCRIPTION, - // becase defaultDescription need ${MAVEN_ID} - writer.print("MAVEN_ID=\""); - writer.print(mavenProject.getGroupId()); - writer.print(':'); - writer.print(mavenProject.getArtifactId()); - writer.print(':'); - writer.print(mavenProject.getVersion()); - writer.println('"'); - writer.print("DESCRIPTION=\""); if (mavenProject.getDescription() != null) { @@ -895,21 +907,8 @@ public class MavenEbuilder { writer.println("JAVA_BINJAR_FILENAME=\"${P}-bin.jar\""); } - final String testingFramework - = determineTestingFramework(mavenProject, config); boolean firstTestVar = true; - if (testingFramework != null) { - if (firstTestVar) { - writer.println(); - firstTestVar = false; - } - - writer.print("JAVA_TESTING_FRAMEWORKS=\""); - writer.print(testingFramework); - writer.println('"'); - } - if (!mavenProject.getTestDependencies().isEmpty()) { if (firstTestVar) { writer.println(); |