use of org.eclipse.ceylon.tools.classpath.CeylonClasspathTool in project ceylon by eclipse.
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.setModules(Arrays.asList(moduleSpec));
cpTool.setRepositoryAsStrings(Arrays.asList(outRepo.getAbsolutePath()));
cpTool.setSystemRepository("../dist/dist/repo");
cpTool.setNoDefRepos(true);
cpTool.setOffline(true);
StringBuilder sb = new StringBuilder();
cpTool.setOut(sb);
cpTool.initialize(null);
cpTool.run();
String classpath = sb.toString();
List<String> args = new ArrayList<String>(Arrays.asList(path, "-cp", classpath));
// args.add("-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y");
if (JDKUtils.jdk.providesVersion(JDK.JDK9.version)) {
args.add("-XaddExports:java.base/sun.reflect.annotation=ALL-UNNAMED");
}
args.add("org.eclipse.ceylon.compiler.java.runtime.Main");
args.add(moduleSpec);
args.add(runClass);
ProcessBuilder processBuilder = new ProcessBuilder(args);
processBuilder.inheritIO();
Process process = processBuilder.start();
int exit = process.waitFor();
Assert.assertTrue(exit == 0);
}
use of org.eclipse.ceylon.tools.classpath.CeylonClasspathTool in project ceylon by eclipse.
the class ClasspathToolTests method testNoArgs.
@Test
public void testNoArgs() throws Exception {
ToolModel<CeylonClasspathTool> model = pluginLoader.loadToolModel("classpath");
Assert.assertNotNull(model);
try {
CeylonClasspathTool tool = pluginFactory.bindArguments(model, getMainTool(), Collections.<String>emptyList());
Assert.fail();
} catch (OptionArgumentException e) {
// asserting this is thrown
}
}
use of org.eclipse.ceylon.tools.classpath.CeylonClasspathTool in project ceylon by eclipse.
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(), toolOptions("io.cayla.web/0.3.0"));
try {
tool.run();
} catch (ToolError err) {
Assert.assertEquals("Module conflict error prevented classpath generation: try running \"ceylon info --print-overrides 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 org.eclipse.ceylon.tools.classpath.CeylonClasspathTool in project ceylon by eclipse.
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(), toolOptions("naskduhqwedmansd"));
try {
tool.run();
Assert.fail();
} catch (ToolUsageError x) {
Assert.assertTrue(x.getMessage().contains("Module naskduhqwedmansd not found"));
}
}
use of org.eclipse.ceylon.tools.classpath.CeylonClasspathTool in project ceylon by eclipse.
the class ClasspathToolTests method testRecursiveDependenciesForce.
@Test
public void testRecursiveDependenciesForce() throws Exception {
ToolModel<CeylonClasspathTool> model = pluginLoader.loadToolModel("classpath");
Assert.assertNotNull(model);
CeylonClasspathTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--force", "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