Skip to content
Permalink
Browse files
- Added TestCompileMojo and included that into the default maven life…
…cycle.

git-svn-id: https://svn.apache.org/repos/asf/incubator/flex/utilities/trunk@1416186 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
chrisdutz committed Dec 2, 2012
1 parent 2b78fb8 commit 158861a04c4a8999f0affdee2e1bee1dc23a39a8
Showing 4 changed files with 65 additions and 17 deletions.
@@ -20,10 +20,7 @@
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.*;
import org.apache.maven.project.MavenProject;
import org.apache.maven.settings.Settings;

@@ -37,29 +34,30 @@
*/
@Mojo(name = "compile",
defaultPhase = LifecyclePhase.COMPILE,
requiresDependencyResolution = ResolutionScope.COMPILE,
threadSafe = true)
public class CompilerMojo extends AbstractFlexMojo {

@Parameter(defaultValue = "false")
protected boolean useLegacyCompiler;

@Component
private Map<String, Compiler> compilerMap;
protected Map<String, Compiler> compilerMap;

@Component
private MavenSession session;
protected MavenSession session;

@Component
private MavenProject project;
protected MavenProject project;

@Component
private MojoExecution mojoEcecution;
protected MojoExecution mojoEcecution;

@Component
private PluginDescriptor plugin;
protected PluginDescriptor plugin;

@Component
private Settings settings;
protected Settings settings;

public void execute() {
if(mojoEcecution.getLifecyclePhase().equals(LifecyclePhase.COMPILE.id())) {
@@ -0,0 +1,50 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.flex.maven.plugins.flex.test;

import org.apache.flex.maven.plugins.flex.compiler.CompilerMojo;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;

/**
* Created with IntelliJ IDEA.
* User: cdutz
* Date: 01.12.12
* Time: 17:48
*/
@Mojo(name = "test-compile",
defaultPhase = LifecyclePhase.TEST_COMPILE,
requiresDependencyResolution = ResolutionScope.TEST,
threadSafe = true)
public class TestCompileMojo extends CompilerMojo {

public void execute() {
if (useLegacyCompiler) {
if (project.getPackaging().equalsIgnoreCase("SWC")) {
compilerMap.get("compc").compile();
} else if (project.getPackaging().equalsIgnoreCase("SWF")) {
compilerMap.get("mxmlc").compile();
} else {
throw new RuntimeException("Wrong packaging");
}
} else {
compilerMap.get("falcon").compile();
}
}

}
@@ -29,7 +29,7 @@
@Mojo(name = "test",
defaultPhase = LifecyclePhase.TEST,
threadSafe = true)
public class TestMojo extends AbstractFlexMojo {
public class TestRunnerMojo extends AbstractFlexMojo {

public void execute() {
getLog().debug("Executing test-mojo");
@@ -23,9 +23,9 @@
<generate-test-sources></generate-test-sources>
<process-test-sources></process-test-sources>
<generate-test-resources></generate-test-resources>
<process-test-resources></process-test-resources>
<test-compile></test-compile>
<process-test-classes></process-test-classes>
<process-test-resources></process-test-resources-->
<test-compile>org.apache.maven.plugins:maven-flex-plugin:test-compile</test-compile>
<!--process-test-classes></process-test-classes>
<test></test>
<prepare-package></prepare-package>
<package></package>
@@ -61,9 +61,9 @@
<generate-test-sources></generate-test-sources>
<process-test-sources></process-test-sources>
<generate-test-resources></generate-test-resources>
<process-test-resources></process-test-resources>
<test-compile></test-compile>
<process-test-classes></process-test-classes>
<process-test-resources></process-test-resources-->
<test-compile>org.apache.maven.plugins:maven-flex-plugin:test-compile</test-compile>
<!--process-test-classes></process-test-classes>
<test></test>
<prepare-package></prepare-package>
<package></package>

0 comments on commit 158861a

Please sign in to comment.