use of net.jangaroo.jooc.Jooc in project jangaroo-tools by CoreMedia.
the class ConfigClassBuilderTest method buildConfigClass.
private ConfigClass buildConfigClass(String resourceName, String module) throws URISyntaxException {
File sourceFile = new File(getClass().getResource("/" + module + "/" + resourceName).toURI());
InputSource inputSource = new FileInputSource(sourceFile, true);
CompilationUnit compilationUnit = new Jooc().doParse(inputSource, new StdOutCompileLog(), SemicolonInsertionMode.QUIRKS);
ConfigClassBuilder configClassBuilder = new ConfigClassBuilder(compilationUnit);
return configClassBuilder.buildConfigClass();
}
use of net.jangaroo.jooc.Jooc in project jangaroo-tools by CoreMedia.
the class AbstractCompilerMojo method compile.
private int compile(JoocConfiguration config) throws MojoExecutionException {
File outputDirectory = config.getOutputDirectory();
// create output directory if it does not exist
if (!outputDirectory.exists()) {
if (!outputDirectory.mkdirs()) {
throw new MojoExecutionException("Failed to create output directory " + outputDirectory.getAbsolutePath());
}
}
// create api output directory if it does not exist
File apiOutputDirectory = getApiOutputDirectory();
if (apiOutputDirectory != null && !apiOutputDirectory.exists()) {
if (!apiOutputDirectory.mkdirs()) {
throw new MojoExecutionException("Failed to create api output directory " + apiOutputDirectory.getAbsolutePath());
}
}
final List<File> sources = config.getSourceFiles();
final Log log = getLog();
log.info("Compiling " + sources.size() + " joo source file" + (sources.size() == 1 ? "" : "s") + " to " + outputDirectory);
Jooc jooc = new Jooc(config, new AbstractCompileLog() {
@Override
protected void doLogError(String msg) {
log.error(msg);
}
@Override
public void warning(String msg) {
log.warn(msg);
}
});
return jooc.run().getResultCode();
}
Aggregations