Search in sources :

Example 6 with ExmlConfiguration

use of net.jangaroo.exml.config.ExmlConfiguration in project jangaroo-tools by CoreMedia.

the class AbstractExmlMojo method createExmlConfiguration.

protected ExmlConfiguration createExmlConfiguration(List<File> classPath, List<File> sourcePath, File outputDirectory) throws MojoExecutionException {
    if (configClassPackage == null) {
        throw new MojoExecutionException("parameter 'configClassPackage' is missing");
    }
    ExmlConfiguration exmlConfiguration = new ExmlConfiguration();
    exmlConfiguration.setConfigClassPackage(configClassPackage);
    exmlConfiguration.setClassPath(classPath);
    exmlConfiguration.setOutputDirectory(outputDirectory);
    try {
        exmlConfiguration.setSourcePath(sourcePath);
    } catch (IOException e) {
        throw new MojoExecutionException("could not determine source directory", e);
    }
    return exmlConfiguration;
}
Also used : MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) IOException(java.io.IOException) ExmlConfiguration(net.jangaroo.exml.config.ExmlConfiguration)

Example 7 with ExmlConfiguration

use of net.jangaroo.exml.config.ExmlConfiguration in project jangaroo-tools by CoreMedia.

the class ExmlToMxmlMojo method execute.

@Override
public void execute() throws MojoExecutionException {
    if (!renameOnly && hasExmlConfiguration()) {
        getLog().info("removing exml-maven-plugin from POM");
        PomConverter.removeExmlPlugin(getProject().getBasedir());
    }
    if (!renameOnly && "jangaroo".equals(getProject().getPackaging())) {
        getLog().info("changing packaging from jangaroo to jangaroo-pkg");
        PomConverter.changePackaging(getProject().getBasedir());
    }
    if (!isExmlProject()) {
        getLog().info("not an EXML project, skipping MXML conversion");
        return;
    }
    if (renameOnly) {
        getLog().info("Renaming EXML files to MXML files");
        try {
            renameFiles(getSourceDirectory(), "exml", "mxml");
            renameFiles(getTestSourceDirectory(), "exml", "mxml");
        } catch (IOException e) {
            throw new MojoExecutionException("error while renaming EXML files", e);
        }
        return;
    }
    if (alreadyRenamed) {
        getLog().info("Renaming MXML files back to EXML files before running the conversion");
        try {
            renameFiles(getSourceDirectory(), "mxml", "exml");
            renameFiles(getTestSourceDirectory(), "mxml", "exml");
        } catch (IOException e) {
            throw new MojoExecutionException("error while renaming files", e);
        }
    }
    if (extAsJar != null && !extAsJar.exists()) {
        throw new MojoExecutionException("error: extAsJar " + extAsJar.getAbsolutePath() + " does not exist.");
    }
    // Convert main EXML sources to MXML:
    ExmlConfiguration config = createExmlConfiguration(getActionScriptClassPath(), Collections.singletonList(getSourceDirectory()), getGeneratedSourcesDirectory());
    config.setExtAsJar(extAsJar);
    new Exmlc(config).convertAllExmlToMxml();
    // Also convert test EXML sources to MXML:
    if (getTestSourceDirectory() != null && getTestSourceDirectory().exists()) {
        ExmlConfiguration testConfig = createExmlConfiguration(getActionScriptTestClassPath(), Collections.singletonList(getTestSourceDirectory()), getGeneratedTestSourcesDirectory());
        testConfig.setExtAsJar(extAsJar);
        new Exmlc(testConfig).convertAllExmlToMxml();
    }
}
Also used : MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) Exmlc(net.jangaroo.exml.compiler.Exmlc) IOException(java.io.IOException) ExmlConfiguration(net.jangaroo.exml.config.ExmlConfiguration)

Example 8 with ExmlConfiguration

use of net.jangaroo.exml.config.ExmlConfiguration in project jangaroo-tools by CoreMedia.

the class ExmlcCommandLineParser method parse.

public ExmlConfiguration parse(String[] args) throws CommandLineParseException {
    ExmlConfiguration config = new ExmlConfiguration();
    CmdLineParser parser = new CmdLineParser(config);
    try {
        // parse the arguments.
        parser.parseArgument(args);
    } catch (CmdLineException e) {
        StringBuilder msg = extendedUsage(parser, e);
        throw new CommandLineParseException(msg.toString(), -1);
    }
    return parseConfig(parser, config);
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) CommandLineParseException(net.jangaroo.jooc.cli.CommandLineParseException) ExmlConfiguration(net.jangaroo.exml.config.ExmlConfiguration) CmdLineException(org.kohsuke.args4j.CmdLineException)

Aggregations

ExmlConfiguration (net.jangaroo.exml.config.ExmlConfiguration)8 File (java.io.File)4 Exmlc (net.jangaroo.exml.compiler.Exmlc)3 IOException (java.io.IOException)2 CompileLog (net.jangaroo.jooc.api.CompileLog)2 CommandLineParseException (net.jangaroo.jooc.cli.CommandLineParseException)2 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)2 Test (org.junit.Test)2 LinkedHashMap (java.util.LinkedHashMap)1 ExmlcException (net.jangaroo.exml.api.ExmlcException)1 ExmlcCommandLineParser (net.jangaroo.exml.cli.ExmlcCommandLineParser)1 ConfigClass (net.jangaroo.exml.model.ConfigClass)1 ConfigClassRegistry (net.jangaroo.exml.model.ConfigClassRegistry)1 ExmlValidator (net.jangaroo.exml.parser.ExmlValidator)1 FilePosition (net.jangaroo.jooc.api.FilePosition)1 MojoFailureException (org.apache.maven.plugin.MojoFailureException)1 CmdLineException (org.kohsuke.args4j.CmdLineException)1 CmdLineParser (org.kohsuke.args4j.CmdLineParser)1