use of org.eclipse.ceylon.compiler.CeylonCompileTool in project ceylon by eclipse.
the class CompilerToolTests method testCompileCwd.
@Test
public void testCompileCwd() throws Exception {
File destDir = destFile("compilecwdtest");
FileUtil.delete(destDir);
destDir.mkdirs();
FileUtil.copyAll(new File("test/src/org/eclipse/ceylon/tools/test/cwdtest"), destDir);
ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
Assert.assertNotNull(model);
CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), Arrays.asList("--cwd", destDir.getPath(), "--sysrep", getSysRepPath(), "--src=src", "--resource=res", "--out=mod", "--rep", "aether", "--overrides", "overrides.xml", // Unfortunately --cwd doesn't affect Java options
"--javac=-cp=" + getClassPathAsPath(), "cwdtest"));
tool.run();
File carFile = getModuleArchive("cwdtest", "1", (new File(destDir, "mod")).getPath());
assertTrue(carFile.exists());
JarFile car = new JarFile(carFile);
ZipEntry entry = car.getEntry("cwdtest/test.txt");
assertNotNull(entry);
car.close();
}
use of org.eclipse.ceylon.compiler.CeylonCompileTool in project ceylon by eclipse.
the class CompilerToolTests method testTargetInvalid.
@Test
public void testTargetInvalid() throws Exception {
ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
Assert.assertNotNull(model);
try {
CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--src=test/src", "--target=56", "org.eclipse.ceylon.tools.test.java8"));
} catch (InvalidOptionValueException e) {
Assert.assertEquals("Invalid value '56' given for option 'target' to command 'compile'", e.getMessage());
}
}
use of org.eclipse.ceylon.compiler.CeylonCompileTool in project ceylon by eclipse.
the class CompilerToolTests method testCompileNoSuchModule.
@Test
public void testCompileNoSuchModule() throws Exception {
ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
Assert.assertNotNull(model);
try {
CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--src=test/src", "org.eclipse.ceylon.tools.test.nosuchmodule"));
Assert.fail();
} catch (OptionArgumentException e) {
Assert.assertEquals("Module org.eclipse.ceylon.tools.test.nosuchmodule not found in source directories: test" + File.separator + "src", e.getMessage());
}
}
use of org.eclipse.ceylon.compiler.CeylonCompileTool in project ceylon by eclipse.
the class CompilerToolTests method testUnknownWarning.
@Test
public void testUnknownWarning() throws Exception {
ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
Assert.assertNotNull(model);
try {
CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--suppress-warning=blah"));
Assert.fail("Tool should have thrown an exception");
} catch (OptionArgumentException e) {
Assert.assertEquals("Invalid value 'blah' given for option 'suppress-warning' to command 'compile'", e.getMessage());
// We expect this, not a FatalToolError
}
}
use of org.eclipse.ceylon.compiler.CeylonCompileTool in project ceylon by eclipse.
the class CompilerToolTests method testCompile.
@Test
public void testCompile() throws Exception {
ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
Assert.assertNotNull(model);
CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--src=test/src", "org.eclipse.ceylon.tools.test.ceylon"));
tool.run();
}
Aggregations