Permalink
Browse files

Merge remote branch 'upstream/flexmojos-4.x' into flexmojos-4.x

  • Loading branch information...
2 parents 0dca49e + fc8c865 commit 50d9997e064c2078da0fa569ce9b14e321ee996c @chrisdutz chrisdutz committed Jun 17, 2011
@@ -691,9 +691,9 @@
* Usually, you must use the same compiler and framework versions. Set this to true to avoid this check. EXTREMELLY
* UN-ADVISIBLE.
*
- * @parameter default-value="false" expression="${flex.ignoreVersionIssues}"
+ * @parameter default-value="false" expression="${flex.iKnowWhatImDoingPleaseBreakMyBuildIwontBlameFlexmojosForStopWorking}"
*/
- private boolean ignoreVersionIssues;
+ private boolean iKnowWhatImDoingPleaseBreakMyBuildIwontBlameFlexmojosForStopWorking;
/**
* Only include inheritance dependencies of classes specified with include-classes.
@@ -3307,7 +3307,7 @@ private File resolveThemeFile( String artifactName, String themeName, String typ
public void versionCheck()
{
- if ( ignoreVersionIssues )
+ if ( iKnowWhatImDoingPleaseBreakMyBuildIwontBlameFlexmojosForStopWorking )
{
return;
}
@@ -3328,7 +3328,7 @@ public void versionCheck()
+ "' - Framework: '"
+ frameworkVersion
+ "'.\n"
- + " You can use 'ignoreVersionIssues' to disable this check. Please refer to Flexmojos maven doc.\n"
+ + " You can use 'iKnowWhatImDoingPleaseBreakMyBuildIwontBlameFlexmojosForStopWorking' to disable this check. Please refer to Flexmojos maven doc.\n"
+ "If you prefer fixing it instead of ignoring, take a look at: https://docs.sonatype.org/display/FLEXMOJOS/How+to+set+Flex+SDK+version";
throw new IllegalStateException( msg );
}
@@ -204,7 +204,7 @@
private File testSourceDirectory;
public Result buildTest( String testFilename, List<? extends String> testClasses, Integer testControlPort,
- Integer testPort )
+ Integer testPort )
throws MojoExecutionException, MojoFailureException
{
getLog().info( "Compiling test class: " + testClasses );
@@ -260,29 +260,7 @@ public void execute()
return;
}
- if ( test != null )
- {
- includeTestFiles = new String[] { test };
- excludeTestFiles = null;
- }
-
- if ( includeTestFiles == null || includeTestFiles.length == 0 )
- {
- includeTestFiles = new String[] { "**/Test*.as", "**/*Test.as", "**/Test*.mxml", "**/*Test.mxml" };
- }
- else
- {
- for ( int i = 0; i < includeTestFiles.length; i++ )
- {
- String pattern = includeTestFiles[i];
-
- if ( !pattern.endsWith( ".as" ) && !pattern.endsWith( ".mxml" ) )
- {
- pattern = pattern + ".as";
- }
- includeTestFiles[i] = "**/" + pattern;
- }
- }
+ initializeIncludes();
if ( !testOutputDirectory.exists() )
{
@@ -650,7 +628,7 @@ else if ( !testRunnerTemplate.exists() )
}
}
- private List<String> getTestClasses()
+ protected List<String> getTestClasses()
{
getLog().debug( "Scanning for tests at " + testSourceDirectory + " for " + Arrays.toString( includeTestFiles )
+ " but " + Arrays.toString( excludeTestFiles ) );
@@ -676,6 +654,33 @@ else if ( !testRunnerTemplate.exists() )
return testClasses;
}
+ protected void initializeIncludes()
+ {
+ if ( test != null )
+ {
+ includeTestFiles = new String[] { test };
+ excludeTestFiles = null;
+ }
+
+ if ( includeTestFiles == null || includeTestFiles.length == 0 )
+ {
+ includeTestFiles = new String[] { "**/Test*.as", "**/*Test.as", "**/Test*.mxml", "**/*Test.mxml" };
+ }
+ else
+ {
+ for ( int i = 0; i < includeTestFiles.length; i++ )
+ {
+ String pattern = includeTestFiles[i];
+
+ if ( !pattern.endsWith( ".as" ) && !pattern.endsWith( ".mxml" ) )
+ {
+ pattern = pattern + ".as";
+ }
+ includeTestFiles[i] = "**/" + pattern;
+ }
+ }
+ }
+
@Override
public boolean isUpdateSecuritySandbox()
{
@@ -1,131 +1,137 @@
-package org.sonatype.flexmojos.compiler;
-
-import java.lang.reflect.Method;
-import java.util.List;
-
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
-import org.codehaus.plexus.logging.AbstractLogEnabled;
-import org.sonatype.flexmojos.compiler.command.Command;
-import org.sonatype.flexmojos.compiler.command.CommandUtil;
-import org.sonatype.flexmojos.compiler.command.Result;
-import org.sonatype.flexmojos.compiler.util.FlexCompilerArgumentParser;
-
-import flex2.tools.ASDoc;
-import flex2.tools.Compc;
-import flex2.tools.DigestTool;
-import flex2.tools.Mxmlc;
-import flex2.tools.Optimizer;
-
-@Component( role = FlexCompiler.class )
-public class DefaultFlexCompiler
- extends AbstractLogEnabled
- implements FlexCompiler
-{
-
- @Requirement
- private FlexCompilerArgumentParser parser;
-
- public Result compileSwc( final ICompcConfiguration configuration, boolean sychronize )
- throws Exception
- {
- return CommandUtil.execute( new Command()
- {
- public void command()
- throws Exception
- {
- String[] args = parser.parseArguments( configuration, ICompcConfiguration.class );
- logArgs( args );
- Compc.compc( args );
- }
- }, sychronize );
- }
-
- public Result compileSwf( MxmlcConfigurationHolder cfgHolder, boolean sychronize )
- throws Exception
- {
- final List<String> argsList =
- parser.getArgumentsList( cfgHolder.configuration, ICommandLineConfiguration.class );
- if ( cfgHolder.sourceFile != null )
- {
- argsList.add( cfgHolder.sourceFile.getAbsolutePath() );
- }
- return CommandUtil.execute( new Command()
- {
- public void command()
- {
- String[] args = argsList.toArray( new String[argsList.size()] );
- logArgs( args );
- Mxmlc.mxmlc( args );
- }
- }, sychronize );
- }
-
- public Result asdoc( final IASDocConfiguration configuration, boolean sychronize )
- throws Exception
- {
- return CommandUtil.execute( new Command()
- {
- public void command()
- {
- String[] args = parser.parseArguments( configuration, IASDocConfiguration.class );
- logArgs( args );
- ASDoc.asdoc( args );
- }
- }, sychronize );
- }
-
- public Result digest( final IDigestConfiguration configuration, boolean sychronize )
- throws Exception
- {
- return CommandUtil.execute( new Command()
- {
- public void command()
- throws Exception
- {
- String[] args = parser.parseArguments( configuration, IDigestConfiguration.class );
- logArgs( args );
- Method m = DigestTool.class.getDeclaredMethod( "digestTool", String[].class );
- m.setAccessible( true );
- m.invoke( null, new Object[] { args } );
- }
- }, sychronize );
- }
-
- public Result optimize( final IOptimizerConfiguration configuration, boolean sychronize )
- throws Exception
- {
- return CommandUtil.execute( new Command()
- {
- public void command()
- throws Exception
- {
- String[] args = parser.parseArguments( configuration, IOptimizerConfiguration.class );
- logArgs( args );
- Optimizer.main( args );
- }
- }, sychronize );
- }
-
- private void logArgs( String[] args )
- {
- if ( getLogger().isDebugEnabled() )
- {
- StringBuilder sb = new StringBuilder();
- for ( String arg : args )
- {
- if ( arg.startsWith( "-" ) )
- {
- sb.append( '\n' );
- }
- sb.append( arg );
- sb.append( ' ' );
- }
- synchronized ( getLogger() )
- {
- getLogger().debug( "Compilation arguments:" + sb );
- }
- }
- }
-
-}
+package org.sonatype.flexmojos.compiler;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.sonatype.flexmojos.compiler.command.Command;
+import org.sonatype.flexmojos.compiler.command.CommandUtil;
+import org.sonatype.flexmojos.compiler.command.Result;
+import org.sonatype.flexmojos.compiler.util.FlexCompilerArgumentParser;
+
+import flex2.tools.ASDoc;
+import flex2.tools.Compc;
+import flex2.tools.DigestTool;
+import flex2.tools.Mxmlc;
+import flex2.tools.Optimizer;
+
+@Component( role = FlexCompiler.class )
+public class DefaultFlexCompiler
+ extends AbstractLogEnabled
+ implements FlexCompiler
+{
+
+ @Requirement
+ private FlexCompilerArgumentParser parser;
+
+ public Result compileSwc( final ICompcConfiguration configuration, boolean sychronize )
+ throws Exception
+ {
+ return CommandUtil.execute( new Command()
+ {
+ public void command()
+ throws Exception
+ {
+ String[] args = parser.parseArguments( configuration, ICompcConfiguration.class );
+ logArgs( args );
+ Compc.compc( args );
+ }
+ }, sychronize );
+ }
+
+ public Result compileSwf( MxmlcConfigurationHolder cfgHolder, boolean sychronize )
+ throws Exception
+ {
+ final List<String> argsList =
+ parser.getArgumentsList( cfgHolder.configuration, ICommandLineConfiguration.class );
+ if ( cfgHolder.sourceFile != null )
+ {
+ argsList.add( cfgHolder.sourceFile.getAbsolutePath() );
+ }
+ return CommandUtil.execute( new Command()
+ {
+ public void command()
+ {
+ String[] args = argsList.toArray( new String[argsList.size()] );
+ logArgs( args );
+ Mxmlc.mxmlc( args );
+ }
+ }, sychronize );
+ }
+
+ public Result asdoc( final IASDocConfiguration configuration, boolean sychronize )
+ throws Exception
+ {
+ return CommandUtil.execute( new Command()
+ {
+ public void command()
+ {
+ String[] args = parser.parseArguments( configuration, IASDocConfiguration.class );
+ logArgs( args );
+ // Force the XML Transformer to the Xalan version that comes with Flex
+ String defaultTransfomer = System.getProperty( "javax.xml.transform.TransformerFactory" );
+ System.setProperty( "javax.xml.transform.TransformerFactory",
+ "org.apache.xalan.processor.TransformerFactoryImpl" );
+ ASDoc.main( args );
+ // and set it back to the default
+ System.setProperty( "javax.xml.transform.TransformerFactory", defaultTransfomer );
+ }
+ }, sychronize );
+ }
+
+ public Result digest( final IDigestConfiguration configuration, boolean sychronize )
+ throws Exception
+ {
+ return CommandUtil.execute( new Command()
+ {
+ public void command()
+ throws Exception
+ {
+ String[] args = parser.parseArguments( configuration, IDigestConfiguration.class );
+ logArgs( args );
+ Method m = DigestTool.class.getDeclaredMethod( "digestTool", String[].class );
+ m.setAccessible( true );
+ m.invoke( null, new Object[] { args } );
+ }
+ }, sychronize );
+ }
+
+ public Result optimize( final IOptimizerConfiguration configuration, boolean sychronize )
+ throws Exception
+ {
+ return CommandUtil.execute( new Command()
+ {
+ public void command()
+ throws Exception
+ {
+ String[] args = parser.parseArguments( configuration, IOptimizerConfiguration.class );
+ logArgs( args );
+ Optimizer.main( args );
+ }
+ }, sychronize );
+ }
+
+ private void logArgs( String[] args )
+ {
+ if ( getLogger().isDebugEnabled() )
+ {
+ StringBuilder sb = new StringBuilder();
+ for ( String arg : args )
+ {
+ if ( arg.startsWith( "-" ) )
+ {
+ sb.append( '\n' );
+ }
+ sb.append( arg );
+ sb.append( ' ' );
+ }
+ synchronized ( getLogger() )
+ {
+ getLogger().debug( "Compilation arguments:" + sb );
+ }
+ }
+ }
+
+}
Oops, something went wrong.

0 comments on commit 50d9997

Please sign in to comment.