use of org.eclipse.ceylon.compiler.CeylonCompileTool in project ceylon by eclipse.
the class NewProjectToolTests method testHelloWorldNoAntNoEclipseCompiles.
@Test
public void testHelloWorldNoAntNoEclipseCompiles() throws Exception {
ToolModel<CeylonNewTool> newModel = pluginLoader.loadToolModel("new");
Assert.assertNotNull(newModel);
Assert.assertTrue(newModel.isPorcelain());
Path tmpPath = Files.createTempDirectory("ceylon-new-");
File tmpDir = tmpPath.toFile();
try {
CeylonNewTool newTool = pluginFactory.bindArguments(newModel, getMainTool(), args("--from=../dist/templates", "hello-world", "--module-name=org.example.hello", "--module-version=1", "--ant=false", "--eclipse=false", tmpDir.getAbsolutePath()));
runTool(newTool);
ToolModel<CeylonCompileTool> compileModel = pluginLoader.loadToolModel("compile");
Assert.assertNotNull(compileModel);
CeylonCompileTool compileTool = pluginFactory.bindArguments(compileModel, getMainTool(), toolOptions("--src=" + tmpDir.getAbsolutePath() + "/source", "--out=" + tmpDir.getAbsolutePath(), "org.example.hello"));
runTool(compileTool);
} finally {
delete(tmpDir);
}
}
use of org.eclipse.ceylon.compiler.CeylonCompileTool in project ceylon by eclipse.
the class CompilerToolTests method testBug1183.
@Test
public void testBug1183() 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.bug1183"));
try {
tool.run();
Assert.fail("Tool should have thrown an exception");
} catch (CompilerErrorException e) {
// We expect this, not a FatalToolError
}
}
use of org.eclipse.ceylon.compiler.CeylonCompileTool in project ceylon by eclipse.
the class CompilerToolTests method testCompileWithErroneous.
@Test
public void testCompileWithErroneous() 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.erroneous"));
try {
tool.run();
Assert.fail("Tool should have thrown an exception");
} catch (CompilerErrorException x) {
Assert.assertEquals("There was 1 error", x.getMessage());
} catch (Throwable t) {
t.printStackTrace();
Assert.fail("Unexpected exception");
}
}
use of org.eclipse.ceylon.compiler.CeylonCompileTool in project ceylon by eclipse.
the class CompilerToolTests method testValidatingJavaOptions.
@Test
public void testValidatingJavaOptions() throws Exception {
ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
Assert.assertNotNull(model);
try {
CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--javac=-target=foo", "com.example"));
Assert.fail("Tool should have thrown an exception");
} catch (OptionArgumentException x) {
Assert.assertEquals("Invalid --javac option: -target: invalid target release: foo", x.getMessage());
}
try {
CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--javac=-source=foo", "com.example"));
Assert.fail("Tool should have thrown an exception");
} catch (OptionArgumentException x) {
Assert.assertEquals("Invalid --javac option: -source: invalid source release: foo", x.getMessage());
}
try {
CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--javac=-monkey", "com.example"));
Assert.fail("Tool should have thrown an exception");
} catch (OptionArgumentException x) {
Assert.assertEquals("Unknown --javac option: -monkey", x.getMessage());
}
{
CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--javac=-Xlint:cast", "--src=test/src", "org.eclipse.ceylon.tools.test.ceylon"));
}
try {
CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--javac=-Xlint:monkey", "--src=test/src", "org.eclipse.ceylon.tools.test.ceylon"));
Assert.fail("Tool should have thrown an exception");
} catch (OptionArgumentException x) {
Assert.assertEquals("Unknown --javac option: -Xlint:monkey", x.getMessage());
}
}
use of org.eclipse.ceylon.compiler.CeylonCompileTool in project ceylon by eclipse.
the class CompilerToolTests method testCompileValidEncoding.
@Test
public void testCompileValidEncoding() throws Exception {
ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
Assert.assertNotNull(model);
CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--src=test/src", "--encoding=UTF-8", "org.eclipse.ceylon.tools.test.ceylon"));
}
Aggregations