Search in sources :

Example 1 with AbstractCompileLog

use of net.jangaroo.jooc.AbstractCompileLog 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();
}
Also used : MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) AbstractCompileLog(net.jangaroo.jooc.AbstractCompileLog) Log(org.apache.maven.plugin.logging.Log) Jooc(net.jangaroo.jooc.Jooc) File(java.io.File) AbstractCompileLog(net.jangaroo.jooc.AbstractCompileLog)

Aggregations

File (java.io.File)1 AbstractCompileLog (net.jangaroo.jooc.AbstractCompileLog)1 Jooc (net.jangaroo.jooc.Jooc)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 Log (org.apache.maven.plugin.logging.Log)1