diff options
Diffstat (limited to 'src/main/java/org')
5 files changed, 37 insertions, 29 deletions
diff --git a/src/main/java/org/gentoo/java/ebuilder/Main.java b/src/main/java/org/gentoo/java/ebuilder/Main.java index 6843af7..72e0a04 100644 --- a/src/main/java/org/gentoo/java/ebuilder/Main.java +++ b/src/main/java/org/gentoo/java/ebuilder/Main.java @@ -250,9 +250,9 @@ public class Main { i++; config.setForceMinJavaVersion(new JavaVersion(args[i])); break; - case "--from-maven-central": - config.setFromMavenCentral(true); - break; + case "--from-maven-central": + config.setFromMavenCentral(true); + break; case "--generate-ebuild": case "-g": config.setGenerateEbuild(true); diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java index d6345bf..98864f8 100644 --- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java +++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java @@ -69,16 +69,16 @@ public class MavenCache { } final StringBuilder sbDependency = new StringBuilder(50); - if (cacheItem.getCategory().compareTo("java-virtuals") != 0) { + if (cacheItem.getCategory().compareTo("java-virtuals") != 0) { sbDependency.append(">="); - } + } sbDependency.append(cacheItem.getCategory()); sbDependency.append('/'); sbDependency.append(cacheItem.getPkg()); - if (cacheItem.getCategory().compareTo("java-virtuals") != 0) { + if (cacheItem.getCategory().compareTo("java-virtuals") != 0) { sbDependency.append('-'); sbDependency.append(stripExtraFromVersion(cacheItem.getVersion())); - } + } if (cacheItem.getUseFlag() != null) { sbDependency.append('['); 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 38a8bf8..3f74241 100644 --- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java +++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java @@ -614,7 +614,7 @@ public class MavenEbuilder { writer.println(); writer.print("JAVA_PKG_IUSE=\"doc source"); - if (mavenProject.hasTests()) { + if (mavenProject.hasTests() || config.hasBinjarUri()) { writer.print(" test"); } @@ -796,9 +796,9 @@ public class MavenEbuilder { writer.println(')'); } - if (config.hasBinjarUri()) { + if (config.hasBinjarUri()) { writer.println("JAVA_BINJAR_FILENAME=\"${P}-bin.jar\""); - } + } final String testingFramework = determineTestingFramework(mavenProject); boolean firstTestVar = true; @@ -875,13 +875,21 @@ public class MavenEbuilder { final PrintWriter writer) { writer.println(); writer.println("src_unpack() {"); - writer.println("\tmkdir -p ${S}/${JAVA_SRC_DIR}"); - writer.println("\tunzip ${DISTDIR}/${P}-sources.jar -d ${S}/${JAVA_SRC_DIR} || die"); + writer.println("\tmkdir -p \"${S}\"/${JAVA_SRC_DIR}"); + writer.println( + "\tunzip \"${DISTDIR}\"/${P}-sources.jar" + + " -d \"${S}\"/${JAVA_SRC_DIR} || die"); - if (mavenProject.hasTests()) { - writer.println("\tmkdir -p ${JAVA_TEST_SRC_DIR}"); - writer.println("\tunzip ${DISTDIR}/${P}-test.jar -d ${S}/${JAVA_TEST_SRC_DIR} || die"); - } + /** + * unzip ${P}-test-sources.jar, uncomment it after the switch + * --test-source-uri is supported + if (mavenProject.hasTests()) { + writer.println("\tmkdir -p \"${S}\"/${JAVA_TEST_SRC_DIR}"); + writer.println( + "\tunzip \"${DISTDIR}\"/${P}-test-sources.jar" + + " -d \"${S}\"/${JAVA_TEST_SRC_DIR} || die"); + } + */ writer.println("}"); } diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java index 63ba043..8abc0aa 100644 --- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java +++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java @@ -50,7 +50,7 @@ public class MavenParser { mavenCache.getDependency("junit", "junit", "4.11"))); } - result.add(mavenProject); + result.add(mavenProject); }); return result; @@ -536,9 +536,9 @@ public class MavenParser { case "artifactId": artifactId = reader.getElementText(); - /* jsch.agentproxy is an empty artifact. */ + /* jsch.agentproxy is an empty artifact. */ // TODO: this should go to a config file to ignore some artifacts - if (artifactId.equals("jsch.agentproxy")) { + if (artifactId.equals("jsch.agentproxy")) { return; } break; @@ -552,12 +552,12 @@ public class MavenParser { version = reader.getElementText().replace( "-SNAPSHOT", ""); - /* crazy version from - * org.khronos:opengl-api:gl1.1-android-2.1_r1 */ + /* crazy version from + * org.khronos:opengl-api:gl1.1-android-2.1_r1 */ // TODO: this should go to a file mapping crazy versions - if (version.equals("gl1.1-android-2.1_r1")) { - version = "2.1.1"; - } + if (version.equals("gl1.1-android-2.1_r1")) { + version = "2.1.1"; + } break; default: consumeElement(reader); diff --git a/src/main/java/org/gentoo/java/ebuilder/portage/PortageParser.java b/src/main/java/org/gentoo/java/ebuilder/portage/PortageParser.java index b918f51..b48e0d2 100644 --- a/src/main/java/org/gentoo/java/ebuilder/portage/PortageParser.java +++ b/src/main/java/org/gentoo/java/ebuilder/portage/PortageParser.java @@ -261,7 +261,7 @@ public class PortageParser { String groupId = null; String artifactId = null; String mavenVersion = null; - String[] mavenProvide = null; + String[] mavenProvide = null; try (final BufferedReader reader = new BufferedReader( new InputStreamReader(Files.newInputStream(ebuild.toPath(), @@ -304,7 +304,7 @@ public class PortageParser { replace("\"", ""); } else if (line.startsWith("MAVEN_PROVIDES=")) { mavenProvide = line.substring("MAVEN_PROVIDES=".length()). - replace("\"", "").split(" "); + replace("\"", "").split(" "); } } @@ -366,7 +366,7 @@ public class PortageParser { cacheItems.add(new CacheItem(category, pkg, version, slot, useFlag, groupId, artifactId, mavenVersion, eclasses)); - if (mavenProvide != null) { + if (mavenProvide != null) { for (String providedId: mavenProvide) { final String[] parts = providedId.split(":"); cacheItems.add(new CacheItem(category, pkg, version, slot, useFlag, @@ -407,7 +407,7 @@ public class PortageParser { private String processSlot(final String slot, final Path ebuildMetadata) { //final metadata = new File(ebuildMetadata.toString()); - String result = slot; + String result = slot; try (final BufferedReader reader = new BufferedReader( new InputStreamReader(Files.newInputStream(ebuildMetadata, StandardOpenOption.READ)))) { @@ -427,7 +427,7 @@ public class PortageParser { } catch (final IOException ex) { throw new RuntimeException("Failed to read ebuild", ex); } - return result; + return result; } /** |