Resolve left-over from Gradle migration
This is a feature that was used in 'kernel.test' which we are about
to reactivate.
diff --git a/util/org.eclipse.virgo.util.parser.launcher/src/main/java/org/eclipse/virgo/util/parser/launcher/ArgumentParser.java b/util/org.eclipse.virgo.util.parser.launcher/src/main/java/org/eclipse/virgo/util/parser/launcher/ArgumentParser.java
index 767efb9..1e7620a 100644
--- a/util/org.eclipse.virgo.util.parser.launcher/src/main/java/org/eclipse/virgo/util/parser/launcher/ArgumentParser.java
+++ b/util/org.eclipse.virgo.util.parser.launcher/src/main/java/org/eclipse/virgo/util/parser/launcher/ArgumentParser.java
@@ -46,7 +46,10 @@
private static final String START_FLAG = "start";
- protected static final String IVY_CACHE_RELATIVE = File.separator + "virgo-build-cache" + File.separator + "ivy-cache";
+ private static final String GRADLE_CACHE_RELATIVE = File.separator + ".gradle"
+ + File.separator + "caches"
+ + File.separator + "modules-2"
+ + File.separator + "files-2.1";
public LaunchCommand parse(String[] args) {
LaunchCommand command = new LaunchCommand();
@@ -100,7 +103,7 @@
String[] components = parseCommandComponents(decl, BUNDLE_PATH_DELIMITER, MAXIMUM_BUNDLE_DECLARATION_COMPONENTS);
String path = components[0];
- path = processIvyCachePlaceholder(path);
+ path = processGradleCachePlaceholder(path);
URI uri = pathToURI(path);
boolean autoStart = false;
@@ -114,9 +117,9 @@
}
return new BundleEntry(uri, autoStart);
}
-
- private String processIvyCachePlaceholder(String path) {
- return path.replace("${ivy.cache}", System.getProperty("user.home") + IVY_CACHE_RELATIVE);
+
+ private String processGradleCachePlaceholder(String path) {
+ return path.replace("${gradle.cache}", System.getProperty("user.home") + GRADLE_CACHE_RELATIVE);
}
private void parseConfigProperties(String configPath, LaunchCommand command) {
@@ -125,19 +128,10 @@
throw new ParseException("Config path '" + file.getAbsolutePath() + "' does not exist.");
}
Properties props = new Properties();
- InputStream stream = null;
- try {
- stream = new FileInputStream(file);
+ try (InputStream stream = new FileInputStream(file)) {
props.load(stream);
} catch (IOException e) {
throw new ParseException("Unable to read config properties file '" + file.getAbsolutePath() + "'.", e);
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException ex) {
- }
- }
}
command.setConfigProperties(props);
}
@@ -191,7 +185,7 @@
if (u.isAbsolute()) {
uri = u;
}
- } catch (URISyntaxException e) {
+ } catch (URISyntaxException ignored) {
}
}
diff --git a/util/org.eclipse.virgo.util.parser.launcher/src/test/java/org/eclipse/virgo/util/parser/launcher/ArgumentParserTests.java b/util/org.eclipse.virgo.util.parser.launcher/src/test/java/org/eclipse/virgo/util/parser/launcher/ArgumentParserTests.java
index 2f58221..5f7bbce 100644
--- a/util/org.eclipse.virgo.util.parser.launcher/src/test/java/org/eclipse/virgo/util/parser/launcher/ArgumentParserTests.java
+++ b/util/org.eclipse.virgo.util.parser.launcher/src/test/java/org/eclipse/virgo/util/parser/launcher/ArgumentParserTests.java
@@ -65,18 +65,17 @@
}
@Test
- @Ignore("[Bug 463462] - As a developer I'd like to be able to build the Virgo artifacts with Gradle")
- public void testIvyCachePlaceholderSubstitution() {
- String commandLine = "-B${ivy.cache}/repository/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar";
+ public void testGradleCachePlaceholderSubstitution() {
+ String commandLine = "-B${gradle.cache}/junit/junit/4.7/d9444742a5b897c6280724a49f57a8155517d21f/junit-4.7.jar";
LaunchCommand command = parse(commandLine);
-
+
BundleEntry[] bundleDeclarations = command.getBundleEntries();
assertNotNull(bundleDeclarations);
assertEquals(1, bundleDeclarations.length);
-
+
BundleEntry bd = bundleDeclarations[0];
assertFalse(bd.isAutoStart());
- assertEquals(new File(System.getProperty("user.home") + "/virgo-build-cache/ivy-cache" + "/repository/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar").toURI(), bd.getURI());
+ assertEquals(new File(System.getProperty("user.home") + "/.gradle/caches/modules-2/files-2.1/junit/junit/4.7/d9444742a5b897c6280724a49f57a8155517d21f/junit-4.7.jar").toURI(), bd.getURI());
}
@Test(expected=ParseException.class)