use of com.redhat.ceylon.tools.classpath.CeylonClasspathTool in project ceylon-compiler by ceylon.
the class CeylonModuleRunner method runModuleInNewJvm.
protected void runModuleInNewJvm(String module, String version, String runClass) throws Exception {
String path = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
String moduleSpec = Module.DEFAULT_MODULE_NAME.equals(module) ? module : (module + "/" + version);
CeylonClasspathTool cpTool = new CeylonClasspathTool();
cpTool.setModule(moduleSpec);
cpTool.setRepositoryAsStrings(Arrays.asList(outRepo.getAbsolutePath()));
cpTool.setSystemRepository("../ceylon-dist/dist/repo");
cpTool.setNoDefRepos(true);
cpTool.setOffline(true);
StringBuilder sb = new StringBuilder();
cpTool.setOut(sb);
cpTool.run();
String classpath = sb.toString();
ProcessBuilder processBuilder = new ProcessBuilder(path, "-cp", classpath, Main.class.getName(), moduleSpec, runClass);
processBuilder.inheritIO();
Process process = processBuilder.start();
int exit = process.waitFor();
Assert.assertTrue(exit == 0);
}
use of com.redhat.ceylon.tools.classpath.CeylonClasspathTool in project ceylon-compiler by ceylon.
the class ClasspathToolTests method testMissingModule.
@Test
public void testMissingModule() throws Exception {
ToolModel<CeylonClasspathTool> model = pluginLoader.loadToolModel("classpath");
Assert.assertNotNull(model);
CeylonClasspathTool tool = pluginFactory.bindArguments(model, getMainTool(), Collections.<String>singletonList("naskduhqwedmansd"));
try {
tool.run();
Assert.fail();
} catch (ToolUsageError x) {
Assert.assertTrue(x.getMessage().contains("Module naskduhqwedmansd not found"));
}
}
use of com.redhat.ceylon.tools.classpath.CeylonClasspathTool in project ceylon-compiler by ceylon.
the class ClasspathToolTests method testModuleNameAlone.
@Test
public void testModuleNameAlone() throws Exception {
ToolModel<CeylonClasspathTool> model = pluginLoader.loadToolModel("classpath");
Assert.assertNotNull(model);
CeylonClasspathTool tool = pluginFactory.bindArguments(model, getMainTool(), Collections.<String>singletonList("ceylon.language"));
StringBuilder b = new StringBuilder();
tool.setOut(b);
tool.run();
String cp = b.toString();
Assert.assertTrue(cp.contains("ceylon.language-" + Versions.CEYLON_VERSION_NUMBER + ".car"));
}
use of com.redhat.ceylon.tools.classpath.CeylonClasspathTool in project ceylon-compiler by ceylon.
the class ClasspathToolTests method testRecursiveDependencies.
@Test
public void testRecursiveDependencies() throws Exception {
ToolModel<CeylonClasspathTool> model = pluginLoader.loadToolModel("classpath");
Assert.assertNotNull(model);
CeylonClasspathTool tool = pluginFactory.bindArguments(model, getMainTool(), Arrays.asList("io.cayla.web/0.3.0"));
try {
tool.run();
} catch (ToolError err) {
Assert.assertEquals("Module conflict error prevented classpath generation: try running \"ceylon info --suggest-override io.cayla.web/0.3.0\" to display an override file you can use with \"ceylon classpath --overrides override.xml io.cayla.web/0.3.0\" or try with \"ceylon classpath --force io.cayla.web/0.3.0\" to select the latest versions", err.getMessage());
}
}
use of com.redhat.ceylon.tools.classpath.CeylonClasspathTool in project ceylon-compiler by ceylon.
the class ClasspathToolTests method testRecursiveDependenciesOverride.
@Test
public void testRecursiveDependenciesOverride() throws Exception {
ToolModel<CeylonClasspathTool> model = pluginLoader.loadToolModel("classpath");
Assert.assertNotNull(model);
CeylonClasspathTool tool = pluginFactory.bindArguments(model, getMainTool(), Arrays.asList("--overrides", getPackagePath() + "/overrides.xml", "io.cayla.web/0.3.0"));
StringBuilder b = new StringBuilder();
tool.setOut(b);
tool.run();
String cp = b.toString();
Assert.assertTrue(cp.contains("org.jboss.logging-3.1.3.GA.jar"));
Assert.assertFalse(cp.contains("org.jboss.logging-3.1.2.GA.jar"));
}
Aggregations