expectedOutputFiles() {
return Collections.emptyList();
}
- protected File getLocalArtifactPath( String groupId, String artifactId, String version, String type )
- {
- VersionRange versionRange = VersionRange.createFromVersion( version );
+ protected File getLocalArtifactPath(String groupId, String artifactId, String version, String type) {
+ VersionRange versionRange = VersionRange.createFromVersion(version);
- Artifact artifact = new DefaultArtifact( groupId, artifactId, versionRange, Artifact.SCOPE_COMPILE, type, null,
- new DefaultArtifactHandler( type ) );
+ Artifact artifact = new DefaultArtifact(
+ groupId,
+ artifactId,
+ versionRange,
+ Artifact.SCOPE_COMPILE,
+ type,
+ null,
+ new DefaultArtifactHandler(type));
- return getLocalArtifactPath( artifact );
+ return getLocalArtifactPath(artifact);
}
- protected String getJavaVersion()
- {
+ protected String getJavaVersion() {
- String javaVersion = System.getProperty( "java.version" );
+ String javaVersion = System.getProperty("java.version");
String realJavaVersion = javaVersion;
- int dotIdx = javaVersion.indexOf( "." );
- if ( dotIdx > -1 )
- {
+ int dotIdx = javaVersion.indexOf(".");
+ if (dotIdx > -1) {
int lastDot = dotIdx;
// find the next dot, so we can trim up to this point.
- dotIdx = javaVersion.indexOf( ".", lastDot + 1 );
- if ( dotIdx > lastDot )
- {
- javaVersion = javaVersion.substring( 0, dotIdx );
+ dotIdx = javaVersion.indexOf(".", lastDot + 1);
+ if (dotIdx > lastDot) {
+ javaVersion = javaVersion.substring(0, dotIdx);
}
}
- System.out.println( "java.version is: " + realJavaVersion + "\ntrimmed java version is: " + javaVersion
- + "\ncomparison: \"1.5\".compareTo( \"" + javaVersion + "\" ) == " + ( "1.5".compareTo(
- javaVersion ) ) + "\n" );
+ System.out.println("java.version is: " + realJavaVersion + "\ntrimmed java version is: " + javaVersion
+ + "\ncomparison: \"1.5\".compareTo( \"" + javaVersion + "\" ) == " + ("1.5".compareTo(javaVersion))
+ + "\n");
return javaVersion;
}
- protected File getLocalArtifactPath( Artifact artifact )
- {
- return new File( localRepository.getBasedir(), localRepository.pathOf( artifact ) );
+ protected File getLocalArtifactPath(Artifact artifact) {
+ return new File(localRepository.getBasedir(), localRepository.pathOf(artifact));
}
}
diff --git a/plexus-compilers/plexus-compiler-aspectj/src/main/java/org/codehaus/plexus/compiler/ajc/AspectJCompiler.java b/plexus-compilers/plexus-compiler-aspectj/src/main/java/org/codehaus/plexus/compiler/ajc/AspectJCompiler.java
index b403f32a..d3503d8b 100644
--- a/plexus-compilers/plexus-compiler-aspectj/src/main/java/org/codehaus/plexus/compiler/ajc/AspectJCompiler.java
+++ b/plexus-compilers/plexus-compiler-aspectj/src/main/java/org/codehaus/plexus/compiler/ajc/AspectJCompiler.java
@@ -1,5 +1,20 @@
package org.codehaus.plexus.compiler.ajc;
+import javax.inject.Named;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
import org.aspectj.ajdt.ajc.BuildArgParser;
import org.aspectj.ajdt.internal.core.builder.AjBuildConfig;
import org.aspectj.ajdt.internal.core.builder.AjBuildManager;
@@ -17,21 +32,6 @@
import org.codehaus.plexus.compiler.CompilerResult;
import org.codehaus.plexus.util.DirectoryScanner;
-import javax.inject.Named;
-import javax.inject.Singleton;
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
/**
*
* Options
@@ -288,201 +288,164 @@
* @author Jason van Zyl
*/
@Named("aspectj")
-public class AspectJCompiler
- extends AbstractCompiler
-{
+public class AspectJCompiler extends AbstractCompiler {
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
- public AspectJCompiler()
- {
+ public AspectJCompiler() {
// Input file ending "" means: Give me all files, I am going to filter them myself later. We are doing this,
// because in method 'getSourceFiles' we need to search for both ".java" and ".aj" files.
- super( CompilerOutputStyle.ONE_OUTPUT_FILE_PER_INPUT_FILE, "", ".class", null );
+ super(CompilerOutputStyle.ONE_OUTPUT_FILE_PER_INPUT_FILE, "", ".class", null);
}
@Override
- public String getCompilerId()
- {
+ public String getCompilerId() {
return "aspectj";
}
- public CompilerResult performCompile( CompilerConfiguration config )
- throws CompilerException
- {
- File destinationDir = new File( config.getOutputLocation() );
+ public CompilerResult performCompile(CompilerConfiguration config) throws CompilerException {
+ File destinationDir = new File(config.getOutputLocation());
- if ( !destinationDir.exists() )
- {
+ if (!destinationDir.exists()) {
destinationDir.mkdirs();
}
- String[] sourceFiles = getSourceFiles( config );
+ String[] sourceFiles = getSourceFiles(config);
- if ( sourceFiles.length == 0 )
- {
+ if (sourceFiles.length == 0) {
return new CompilerResult();
}
- logCompiling( sourceFiles, config );
+ logCompiling(sourceFiles, config);
// String[] args = buildCompilerArguments( config, sourceFiles );
- AjBuildConfig buildConfig = buildCompilerConfig( config );
- return new CompilerResult().compilerMessages( compileInProcess( buildConfig ) );
+ AjBuildConfig buildConfig = buildCompilerConfig(config);
+ return new CompilerResult().compilerMessages(compileInProcess(buildConfig));
}
- private static class AspectJMessagePrinter extends Main.MessagePrinter
- {
- public AspectJMessagePrinter( boolean verbose )
- {
- super( verbose );
+ private static class AspectJMessagePrinter extends Main.MessagePrinter {
+ public AspectJMessagePrinter(boolean verbose) {
+ super(verbose);
}
}
- private AjBuildConfig buildCompilerConfig( CompilerConfiguration config )
- throws CompilerException
- {
+ private AjBuildConfig buildCompilerConfig(CompilerConfiguration config) throws CompilerException {
BuildArgParser buildArgParser = new BuildArgParser(new AspectJMessagePrinter(config.isVerbose()));
AjBuildConfig buildConfig = new AjBuildConfig(buildArgParser);
// Avoid NPE when AjBuildConfig.getCheckedClasspaths() is called later during compilation
buildArgParser.populateBuildConfig(buildConfig, new String[0], true, null);
- buildConfig.setIncrementalMode( false );
+ buildConfig.setIncrementalMode(false);
- String[] files = getSourceFiles( config );
- if ( files != null )
- {
- buildConfig.setFiles( buildFileList( Arrays.asList( files ) ) );
+ String[] files = getSourceFiles(config);
+ if (files != null) {
+ buildConfig.setFiles(buildFileList(Arrays.asList(files)));
}
String releaseVersion = config.getReleaseVersion();
- setSourceVersion( buildConfig, releaseVersion == null ? config.getSourceVersion() : releaseVersion );
- setTargetVersion( buildConfig, releaseVersion == null ? config.getTargetVersion() : releaseVersion );
+ setSourceVersion(buildConfig, releaseVersion == null ? config.getSourceVersion() : releaseVersion);
+ setTargetVersion(buildConfig, releaseVersion == null ? config.getTargetVersion() : releaseVersion);
- if ( config.isDebug() )
- {
+ if (config.isDebug()) {
buildConfig.getOptions().produceDebugAttributes =
- ClassFileConstants.ATTR_SOURCE + ClassFileConstants.ATTR_LINES + ClassFileConstants.ATTR_VARS;
+ ClassFileConstants.ATTR_SOURCE + ClassFileConstants.ATTR_LINES + ClassFileConstants.ATTR_VARS;
}
Map javaOpts = config.getCustomCompilerArgumentsAsMap();
- if ( javaOpts != null && !javaOpts.isEmpty() )
- {
+ if (javaOpts != null && !javaOpts.isEmpty()) {
// TODO support customCompilerArguments
// buildConfig.setJavaOptions( javaOpts );
}
- List cp = new LinkedList<>( config.getClasspathEntries() );
-
- File javaHomeDir = new File( System.getProperty( "java.home" ) );
- File[] jars = new File( javaHomeDir, "lib" ).listFiles();
- if ( jars != null )
- {
- for ( File jar : jars )
- {
- if ( jar.getName().endsWith( ".jar" ) || jar.getName().endsWith( ".zip" ) )
- {
- cp.add( 0, jar.getAbsolutePath() );
+ List cp = new LinkedList<>(config.getClasspathEntries());
+
+ File javaHomeDir = new File(System.getProperty("java.home"));
+ File[] jars = new File(javaHomeDir, "lib").listFiles();
+ if (jars != null) {
+ for (File jar : jars) {
+ if (jar.getName().endsWith(".jar") || jar.getName().endsWith(".zip")) {
+ cp.add(0, jar.getAbsolutePath());
}
}
}
- jars = new File( javaHomeDir, "../Classes" ).listFiles();
- if ( jars != null )
- {
- for ( File jar : jars )
- {
- if ( jar.getName().endsWith( ".jar" ) || jar.getName().endsWith( ".zip" ) )
- {
- cp.add( 0, jar.getAbsolutePath() );
+ jars = new File(javaHomeDir, "../Classes").listFiles();
+ if (jars != null) {
+ for (File jar : jars) {
+ if (jar.getName().endsWith(".jar") || jar.getName().endsWith(".zip")) {
+ cp.add(0, jar.getAbsolutePath());
}
}
}
- checkForAspectJRT( cp );
- if ( cp != null && !cp.isEmpty() )
- {
- List elements = new ArrayList<>( cp.size() );
- for ( String path : cp )
- {
- elements.add( ( new File( path ) ).getAbsolutePath() );
+ checkForAspectJRT(cp);
+ if (cp != null && !cp.isEmpty()) {
+ List elements = new ArrayList<>(cp.size());
+ for (String path : cp) {
+ elements.add((new File(path)).getAbsolutePath());
}
- buildConfig.setClasspath( elements );
+ buildConfig.setClasspath(elements);
}
String outputLocation = config.getOutputLocation();
- if ( outputLocation != null )
- {
- File outDir = new File( outputLocation );
- if ( !outDir.exists() )
- {
+ if (outputLocation != null) {
+ File outDir = new File(outputLocation);
+ if (!outDir.exists()) {
outDir.mkdirs();
}
- buildConfig.setOutputDir( outDir );
+ buildConfig.setOutputDir(outDir);
}
- if ( config instanceof AspectJCompilerConfiguration )
- {
+ if (config instanceof AspectJCompilerConfiguration) {
AspectJCompilerConfiguration ajCfg = (AspectJCompilerConfiguration) config;
Map sourcePathResources = ajCfg.getSourcePathResources();
- if ( sourcePathResources != null && !sourcePathResources.isEmpty() )
- {
- buildConfig.setSourcePathResources( sourcePathResources );
+ if (sourcePathResources != null && !sourcePathResources.isEmpty()) {
+ buildConfig.setSourcePathResources(sourcePathResources);
}
Map ajOptions = ajCfg.getAJOptions();
- if ( ajOptions != null && !ajOptions.isEmpty() )
- {
+ if (ajOptions != null && !ajOptions.isEmpty()) {
// TODO not supported
- //buildConfig.setAjOptions( ajCfg.getAJOptions() );
+ // buildConfig.setAjOptions( ajCfg.getAJOptions() );
}
- List aspectPath = buildFileList( ajCfg.getAspectPath() );
- if ( aspectPath != null && !aspectPath.isEmpty() )
- {
- buildConfig.setAspectpath( buildFileList( ajCfg.getAspectPath() ) );
+ List aspectPath = buildFileList(ajCfg.getAspectPath());
+ if (aspectPath != null && !aspectPath.isEmpty()) {
+ buildConfig.setAspectpath(buildFileList(ajCfg.getAspectPath()));
}
- List inJars = buildFileList( ajCfg.getInJars() );
- if ( inJars != null && !inJars.isEmpty() )
- {
- buildConfig.setInJars( buildFileList( ajCfg.getInJars() ) );
+ List inJars = buildFileList(ajCfg.getInJars());
+ if (inJars != null && !inJars.isEmpty()) {
+ buildConfig.setInJars(buildFileList(ajCfg.getInJars()));
}
- List inPaths = buildFileList( ajCfg.getInPath() );
- if ( inPaths != null && !inPaths.isEmpty() )
- {
- buildConfig.setInPath( buildFileList( ajCfg.getInPath() ) );
+ List inPaths = buildFileList(ajCfg.getInPath());
+ if (inPaths != null && !inPaths.isEmpty()) {
+ buildConfig.setInPath(buildFileList(ajCfg.getInPath()));
}
String outJar = ajCfg.getOutputJar();
- if ( outJar != null )
- {
- buildConfig.setOutputJar( new File( ajCfg.getOutputJar() ) );
+ if (outJar != null) {
+ buildConfig.setOutputJar(new File(ajCfg.getOutputJar()));
}
}
return buildConfig;
}
- private List compileInProcess( AjBuildConfig buildConfig )
- throws CompilerException
- {
+ private List compileInProcess(AjBuildConfig buildConfig) throws CompilerException {
MessageHandler messageHandler = new MessageHandler();
- AjBuildManager manager = new AjBuildManager( messageHandler );
+ AjBuildManager manager = new AjBuildManager(messageHandler);
- try
- {
- manager.batchBuild( buildConfig, messageHandler );
- }
- catch ( AbortException | IOException e )
- {
- throw new CompilerException( "Unknown error while compiling", e );
+ try {
+ manager.batchBuild(buildConfig, messageHandler);
+ } catch (AbortException | IOException e) {
+ throw new CompilerException("Unknown error while compiling", e);
}
// We need the location of the maven so we have a couple of options
@@ -494,73 +457,60 @@ private List compileInProcess( AjBuildConfig buildConfig )
// property or we
// could pass in a set of parameters in a Map.
- boolean errors = messageHandler.hasAnyMessage( IMessage.ERROR, true );
+ boolean errors = messageHandler.hasAnyMessage(IMessage.ERROR, true);
List messages = new ArrayList<>();
- if ( errors )
- {
- IMessage[] errorMessages = messageHandler.getMessages( IMessage.ERROR, true );
+ if (errors) {
+ IMessage[] errorMessages = messageHandler.getMessages(IMessage.ERROR, true);
- for ( IMessage m : errorMessages )
- {
+ for (IMessage m : errorMessages) {
ISourceLocation sourceLocation = m.getSourceLocation();
CompilerMessage error;
- if ( sourceLocation == null )
- {
- error = new CompilerMessage( m.getMessage(), true );
- }
- else
- {
- error =
- new CompilerMessage( sourceLocation.getSourceFile().getPath(), true, sourceLocation.getLine(),
- sourceLocation.getColumn(), sourceLocation.getEndLine(),
- sourceLocation.getColumn(), m.getMessage() );
+ if (sourceLocation == null) {
+ error = new CompilerMessage(m.getMessage(), true);
+ } else {
+ error = new CompilerMessage(
+ sourceLocation.getSourceFile().getPath(),
+ true,
+ sourceLocation.getLine(),
+ sourceLocation.getColumn(),
+ sourceLocation.getEndLine(),
+ sourceLocation.getColumn(),
+ m.getMessage());
}
- messages.add( error );
+ messages.add(error);
}
}
return messages;
}
- private void checkForAspectJRT( List cp )
- {
- if ( cp == null || cp.isEmpty() )
- {
- throw new IllegalStateException( "AspectJ Runtime not found in supplied classpath" );
- }
- else
- {
- try
- {
+ private void checkForAspectJRT(List cp) {
+ if (cp == null || cp.isEmpty()) {
+ throw new IllegalStateException("AspectJ Runtime not found in supplied classpath");
+ } else {
+ try {
URL[] urls = new URL[cp.size()];
- for ( int i = 0; i < urls.length; i++ )
- {
- urls[i] = ( new File( cp.get( i ) ) ).toURL();
+ for (int i = 0; i < urls.length; i++) {
+ urls[i] = (new File(cp.get(i))).toURL();
}
- URLClassLoader cloader = new URLClassLoader( urls );
+ URLClassLoader cloader = new URLClassLoader(urls);
- cloader.loadClass( "org.aspectj.lang.JoinPoint" );
- }
- catch ( MalformedURLException e )
- {
- throw new IllegalArgumentException( "Invalid classpath entry" );
- }
- catch ( ClassNotFoundException e )
- {
- throw new IllegalStateException( "AspectJ Runtime not found in supplied classpath" );
+ cloader.loadClass("org.aspectj.lang.JoinPoint");
+ } catch (MalformedURLException e) {
+ throw new IllegalArgumentException("Invalid classpath entry");
+ } catch (ClassNotFoundException e) {
+ throw new IllegalStateException("AspectJ Runtime not found in supplied classpath");
}
}
}
- private List buildFileList( List locations )
- {
+ private List buildFileList(List locations) {
List fileList = new LinkedList<>();
- for ( String location : locations )
- {
- fileList.add( new File( location ) );
+ for (String location : locations) {
+ fileList.add(new File(location));
}
return fileList;
@@ -572,10 +522,8 @@ private List buildFileList( List locations )
* @param buildConfig
* @param sourceVersion
*/
- private void setSourceVersion( AjBuildConfig buildConfig, String sourceVersion )
- throws CompilerException
- {
- buildConfig.getOptions().sourceLevel = versionStringToMajorMinor( sourceVersion );
+ private void setSourceVersion(AjBuildConfig buildConfig, String sourceVersion) throws CompilerException {
+ buildConfig.getOptions().sourceLevel = versionStringToMajorMinor(sourceVersion);
}
/**
@@ -584,124 +532,120 @@ private void setSourceVersion( AjBuildConfig buildConfig, String sourceVersion )
* @param buildConfig
* @param targetVersion
*/
- private void setTargetVersion( AjBuildConfig buildConfig, String targetVersion )
- throws CompilerException
- {
- buildConfig.getOptions().targetJDK = versionStringToMajorMinor( targetVersion );
+ private void setTargetVersion(AjBuildConfig buildConfig, String targetVersion) throws CompilerException {
+ buildConfig.getOptions().targetJDK = versionStringToMajorMinor(targetVersion);
}
- private static long versionStringToMajorMinor(String version) throws CompilerException
- {
- if ( version == null )
- {
+ private static long versionStringToMajorMinor(String version) throws CompilerException {
+ if (version == null) {
version = "";
}
// Note: We avoid using org.codehaus.plexus:plexus-java here on purpose, because Maven Compiler might depend on
// a different (older) versionm, e.g. not having the 'asMajor' method yet. This can cause problems for users
// trying to compile their AspectJ code using Plexus.
-
+
version = version.trim()
- // Cut off leading "1.", focusing on the Java major
- .replaceFirst( "^1[.]", "" )
- // Accept, but cut off trailing ".0", as ECJ/ACJ explicitly support versions like 5.0, 8.0, 11.0
- .replaceFirst("[.]0$", "");
-
- switch ( version )
- {
- // Java 1.6 as a default source/target seems to make sense. Maven Compiler should set its own default
- // anyway, so this probably never needs to be used. But not having a default feels bad, too.
- case "" : return ClassFileConstants.JDK1_6;
- case "1" : return ClassFileConstants.JDK1_1;
- case "2" : return ClassFileConstants.JDK1_2;
- case "3" : return ClassFileConstants.JDK1_3;
- case "4" : return ClassFileConstants.JDK1_4;
- case "5" : return ClassFileConstants.JDK1_5;
- case "6" : return ClassFileConstants.JDK1_6;
- case "7" : return ClassFileConstants.JDK1_7;
- case "8" : return ClassFileConstants.JDK1_8;
- case "9" : return ClassFileConstants.JDK9;
- case "10" : return ClassFileConstants.JDK10;
- case "11" : return ClassFileConstants.JDK11;
- case "12" : return ClassFileConstants.JDK12;
- case "13" : return ClassFileConstants.JDK13;
- case "14" : return ClassFileConstants.JDK14;
- case "15" : return ClassFileConstants.JDK15;
- case "16" : return ClassFileConstants.JDK16;
+ // Cut off leading "1.", focusing on the Java major
+ .replaceFirst("^1[.]", "")
+ // Accept, but cut off trailing ".0", as ECJ/ACJ explicitly support versions like 5.0, 8.0, 11.0
+ .replaceFirst("[.]0$", "");
+
+ switch (version) {
+ // Java 1.6 as a default source/target seems to make sense. Maven Compiler should set its own default
+ // anyway, so this probably never needs to be used. But not having a default feels bad, too.
+ case "":
+ return ClassFileConstants.JDK1_6;
+ case "1":
+ return ClassFileConstants.JDK1_1;
+ case "2":
+ return ClassFileConstants.JDK1_2;
+ case "3":
+ return ClassFileConstants.JDK1_3;
+ case "4":
+ return ClassFileConstants.JDK1_4;
+ case "5":
+ return ClassFileConstants.JDK1_5;
+ case "6":
+ return ClassFileConstants.JDK1_6;
+ case "7":
+ return ClassFileConstants.JDK1_7;
+ case "8":
+ return ClassFileConstants.JDK1_8;
+ case "9":
+ return ClassFileConstants.JDK9;
+ case "10":
+ return ClassFileConstants.JDK10;
+ case "11":
+ return ClassFileConstants.JDK11;
+ case "12":
+ return ClassFileConstants.JDK12;
+ case "13":
+ return ClassFileConstants.JDK13;
+ case "14":
+ return ClassFileConstants.JDK14;
+ case "15":
+ return ClassFileConstants.JDK15;
+ case "16":
+ return ClassFileConstants.JDK16;
}
- throw new CompilerException( "Unknown Java source/target version number: " + version );
+ throw new CompilerException("Unknown Java source/target version number: " + version);
}
/**
* @return null
*/
- public String[] createCommandLine( CompilerConfiguration config )
- throws CompilerException
- {
+ public String[] createCommandLine(CompilerConfiguration config) throws CompilerException {
return null;
}
- protected static String[] getSourceFiles( CompilerConfiguration config )
- {
+ protected static String[] getSourceFiles(CompilerConfiguration config) {
Set sources = new HashSet<>();
Set sourceFiles = config.getSourceFiles();
- if ( sourceFiles != null && !sourceFiles.isEmpty() )
- {
- for ( File sourceFile : sourceFiles )
- {
- if ( sourceFile.getName().endsWith( ".java" ) || sourceFile.getName().endsWith( ".aj" ) )
- {
- sources.add( sourceFile.getAbsolutePath() );
+ if (sourceFiles != null && !sourceFiles.isEmpty()) {
+ for (File sourceFile : sourceFiles) {
+ if (sourceFile.getName().endsWith(".java")
+ || sourceFile.getName().endsWith(".aj")) {
+ sources.add(sourceFile.getAbsolutePath());
}
}
- }
- else
- {
- for ( String sourceLocation : config.getSourceLocations() )
- {
- sources.addAll( getSourceFilesForSourceRoot( config, sourceLocation ) );
+ } else {
+ for (String sourceLocation : config.getSourceLocations()) {
+ sources.addAll(getSourceFilesForSourceRoot(config, sourceLocation));
}
}
String[] result;
- if ( sources.isEmpty() )
- {
+ if (sources.isEmpty()) {
result = new String[0];
- }
- else
- {
- result = sources.toArray( new String[sources.size()] );
+ } else {
+ result = sources.toArray(new String[sources.size()]);
}
return result;
}
- protected static Set getSourceFilesForSourceRoot( CompilerConfiguration config, String sourceLocation )
- {
+ protected static Set getSourceFilesForSourceRoot(CompilerConfiguration config, String sourceLocation) {
DirectoryScanner scanner = new DirectoryScanner();
- scanner.setBasedir( sourceLocation );
+ scanner.setBasedir(sourceLocation);
Set includes = config.getIncludes();
- if ( includes != null && !includes.isEmpty() )
- {
- String[] inclStrs = includes.toArray( new String[includes.size()] );
- scanner.setIncludes( inclStrs );
- }
- else
- {
- scanner.setIncludes( new String[] {"**/*.java", "**/*.aj"} );
+ if (includes != null && !includes.isEmpty()) {
+ String[] inclStrs = includes.toArray(new String[includes.size()]);
+ scanner.setIncludes(inclStrs);
+ } else {
+ scanner.setIncludes(new String[] {"**/*.java", "**/*.aj"});
}
Set excludes = config.getExcludes();
- if ( excludes != null && !excludes.isEmpty() )
- {
- String[] exclStrs = excludes.toArray( new String[excludes.size()] );
- scanner.setExcludes( exclStrs );
+ if (excludes != null && !excludes.isEmpty()) {
+ String[] exclStrs = excludes.toArray(new String[excludes.size()]);
+ scanner.setExcludes(exclStrs);
}
scanner.scan();
@@ -710,14 +654,12 @@ protected static Set getSourceFilesForSourceRoot( CompilerConfiguration
Set sources = new HashSet<>();
- for ( String sourceDirectorySource : sourceDirectorySources )
- {
- File f = new File( sourceLocation, sourceDirectorySource );
+ for (String sourceDirectorySource : sourceDirectorySources) {
+ File f = new File(sourceLocation, sourceDirectorySource);
- sources.add( f.getPath() );
+ sources.add(f.getPath());
}
return sources;
}
-
}
diff --git a/plexus-compilers/plexus-compiler-aspectj/src/main/java/org/codehaus/plexus/compiler/ajc/AspectJCompilerConfiguration.java b/plexus-compilers/plexus-compiler-aspectj/src/main/java/org/codehaus/plexus/compiler/ajc/AspectJCompilerConfiguration.java
index 8ef8aefb..6afcc3c8 100644
--- a/plexus-compilers/plexus-compiler-aspectj/src/main/java/org/codehaus/plexus/compiler/ajc/AspectJCompilerConfiguration.java
+++ b/plexus-compilers/plexus-compiler-aspectj/src/main/java/org/codehaus/plexus/compiler/ajc/AspectJCompilerConfiguration.java
@@ -13,9 +13,7 @@
/**
* @author jdcasey
*/
-public class AspectJCompilerConfiguration
- extends CompilerConfiguration
-{
+public class AspectJCompilerConfiguration extends CompilerConfiguration {
private List aspectPath = new LinkedList<>();
@@ -29,92 +27,75 @@ public class AspectJCompilerConfiguration
private Map sourcePathResources;
- public void setAspectPath( List aspectPath )
- {
- this.aspectPath = new LinkedList<>( aspectPath );
+ public void setAspectPath(List aspectPath) {
+ this.aspectPath = new LinkedList<>(aspectPath);
}
- public void addAspectPath( String aspectPath )
- {
- this.aspectPath.add( aspectPath );
+ public void addAspectPath(String aspectPath) {
+ this.aspectPath.add(aspectPath);
}
- public List getAspectPath()
- {
- return Collections.unmodifiableList( aspectPath );
+ public List getAspectPath() {
+ return Collections.unmodifiableList(aspectPath);
}
- public void setInJars( List inJars )
- {
- this.inJars = new LinkedList<>( inJars );
+ public void setInJars(List inJars) {
+ this.inJars = new LinkedList<>(inJars);
}
- public void addInJar( String inJar )
- {
- this.inJars.add( inJar );
+ public void addInJar(String inJar) {
+ this.inJars.add(inJar);
}
- public List getInJars()
- {
- return Collections.unmodifiableList( inJars );
+ public List getInJars() {
+ return Collections.unmodifiableList(inJars);
}
- public void setInPath( List inPath )
- {
- this.inPath = new LinkedList<>( inPath );
+ public void setInPath(List inPath) {
+ this.inPath = new LinkedList<>(inPath);
}
- public void addInPath( String inPath )
- {
- this.inPath.add( inPath );
+ public void addInPath(String inPath) {
+ this.inPath.add(inPath);
}
- public List getInPath()
- {
- return Collections.unmodifiableList( inPath );
+ public List getInPath() {
+ return Collections.unmodifiableList(inPath);
}
- public void setOutputJar( String outputJar )
- {
+ public void setOutputJar(String outputJar) {
this.outputJar = outputJar;
}
- public String getOutputJar()
- {
+ public String getOutputJar() {
return outputJar;
}
/**
* Ignored, not supported yet
*/
- public void setAJOptions( Map ajOptions )
- {
- //TODO
- //this.ajOptions = new TreeMap( ajOptions );
+ public void setAJOptions(Map ajOptions) {
+ // TODO
+ // this.ajOptions = new TreeMap( ajOptions );
}
- public void setAJOption( String optionName, String optionValue )
- {
- this.ajOptions.put( optionName, optionValue );
+ public void setAJOption(String optionName, String optionValue) {
+ this.ajOptions.put(optionName, optionValue);
}
/**
* Ignored, not supported yet
* @return empty Map
*/
- public Map getAJOptions()
- {
- return Collections.unmodifiableMap( ajOptions );
+ public Map getAJOptions() {
+ return Collections.unmodifiableMap(ajOptions);
}
- public void setSourcePathResources( Map sourcePathResources )
- {
- this.sourcePathResources = new TreeMap<>( sourcePathResources );
+ public void setSourcePathResources(Map sourcePathResources) {
+ this.sourcePathResources = new TreeMap<>(sourcePathResources);
}
- public Map getSourcePathResources()
- {
+ public Map getSourcePathResources() {
return sourcePathResources;
}
-
}
diff --git a/plexus-compilers/plexus-compiler-aspectj/src/test/java/org/codehaus/plexus/compiler/ajc/AspectJCompilerTest.java b/plexus-compilers/plexus-compiler-aspectj/src/test/java/org/codehaus/plexus/compiler/ajc/AspectJCompilerTest.java
index 6c20e598..c73cd139 100644
--- a/plexus-compilers/plexus-compiler-aspectj/src/test/java/org/codehaus/plexus/compiler/ajc/AspectJCompilerTest.java
+++ b/plexus-compilers/plexus-compiler-aspectj/src/test/java/org/codehaus/plexus/compiler/ajc/AspectJCompilerTest.java
@@ -10,35 +10,27 @@
/**
* @author Jason van Zyl
*/
-public class AspectJCompilerTest
- extends AbstractCompilerTest
-{
- public AspectJCompilerTest()
- {
+public class AspectJCompilerTest extends AbstractCompilerTest {
+ public AspectJCompilerTest() {
super();
}
@Override
- protected String getRoleHint()
- {
+ protected String getRoleHint() {
return "aspectj";
}
@Override
- protected Collection expectedOutputFiles()
- {
- return Arrays.asList( "org/codehaus/foo/ExternalDeps.class", "org/codehaus/foo/Person.class" );
+ protected Collection expectedOutputFiles() {
+ return Arrays.asList("org/codehaus/foo/ExternalDeps.class", "org/codehaus/foo/Person.class");
}
@Override
- protected List getClasspath()
- throws Exception
- {
+ protected List getClasspath() throws Exception {
List classpath = super.getClasspath();
- String aspectjVersion = System.getProperty( "aspectj.version" );
- File aspectjRuntime = getLocalArtifactPath( "org.aspectj", "aspectjrt", aspectjVersion, "jar" );
- classpath.add( aspectjRuntime.getAbsolutePath() );
+ String aspectjVersion = System.getProperty("aspectj.version");
+ File aspectjRuntime = getLocalArtifactPath("org.aspectj", "aspectjrt", aspectjVersion, "jar");
+ classpath.add(aspectjRuntime.getAbsolutePath());
return classpath;
}
-
}
diff --git a/plexus-compilers/plexus-compiler-csharp/src/main/java/org/codehaus/plexus/compiler/csharp/CSharpCompiler.java b/plexus-compilers/plexus-compiler-csharp/src/main/java/org/codehaus/plexus/compiler/csharp/CSharpCompiler.java
index 9a232bd2..c2b0bd9c 100644
--- a/plexus-compilers/plexus-compiler-csharp/src/main/java/org/codehaus/plexus/compiler/csharp/CSharpCompiler.java
+++ b/plexus-compilers/plexus-compiler-csharp/src/main/java/org/codehaus/plexus/compiler/csharp/CSharpCompiler.java
@@ -16,23 +16,8 @@
* limitations under the License.
*/
-import org.codehaus.plexus.compiler.AbstractCompiler;
-import org.codehaus.plexus.compiler.CompilerConfiguration;
-import org.codehaus.plexus.compiler.CompilerException;
-import org.codehaus.plexus.compiler.CompilerMessage;
-import org.codehaus.plexus.compiler.CompilerOutputStyle;
-import org.codehaus.plexus.compiler.CompilerResult;
-import org.codehaus.plexus.util.DirectoryScanner;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.Os;
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.cli.CommandLineException;
-import org.codehaus.plexus.util.cli.CommandLineUtils;
-import org.codehaus.plexus.util.cli.Commandline;
-import org.codehaus.plexus.util.cli.StreamConsumer;
-import org.codehaus.plexus.util.cli.WriterStreamConsumer;
-
import javax.inject.Named;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileWriter;
@@ -50,33 +35,46 @@
import java.util.Map;
import java.util.Set;
+import org.codehaus.plexus.compiler.AbstractCompiler;
+import org.codehaus.plexus.compiler.CompilerConfiguration;
+import org.codehaus.plexus.compiler.CompilerException;
+import org.codehaus.plexus.compiler.CompilerMessage;
+import org.codehaus.plexus.compiler.CompilerOutputStyle;
+import org.codehaus.plexus.compiler.CompilerResult;
+import org.codehaus.plexus.util.DirectoryScanner;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.Os;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+import org.codehaus.plexus.util.cli.WriterStreamConsumer;
+
/**
* @author Gilles Dodinet
* @author Trygve Laugstøl
* @author Matthew Pocock
* @author Chris Stevenson
*/
-@Named( "csharp" )
-public class CSharpCompiler
- extends AbstractCompiler
-{
+@Named("csharp")
+public class CSharpCompiler extends AbstractCompiler {
private static final String JAR_SUFFIX = ".jar";
private static final String DLL_SUFFIX = ".dll";
private static final String NET_SUFFIX = ".net";
-
+
private static final String ARGUMENTS_FILE_NAME = "csharp-arguments";
- private static final String[] DEFAULT_INCLUDES = { "**/**" };
-
+ private static final String[] DEFAULT_INCLUDES = {"**/**"};
+
private Map compilerArguments;
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
- public CSharpCompiler()
- {
- super( CompilerOutputStyle.ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES, ".cs", null, null );
+ public CSharpCompiler() {
+ super(CompilerOutputStyle.ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES, ".cs", null, null);
}
// ----------------------------------------------------------------------
@@ -84,117 +82,94 @@ public CSharpCompiler()
// ----------------------------------------------------------------------
@Override
- public String getCompilerId()
- {
+ public String getCompilerId() {
return "csharp";
}
- public boolean canUpdateTarget( CompilerConfiguration configuration )
- throws CompilerException
- {
+ public boolean canUpdateTarget(CompilerConfiguration configuration) throws CompilerException {
return false;
}
- public String getOutputFile( CompilerConfiguration configuration )
- throws CompilerException
- {
- return configuration.getOutputFileName() + "." + getTypeExtension( configuration );
+ public String getOutputFile(CompilerConfiguration configuration) throws CompilerException {
+ return configuration.getOutputFileName() + "." + getTypeExtension(configuration);
}
- public CompilerResult performCompile( CompilerConfiguration config )
- throws CompilerException
- {
- File destinationDir = new File( config.getOutputLocation() );
+ public CompilerResult performCompile(CompilerConfiguration config) throws CompilerException {
+ File destinationDir = new File(config.getOutputLocation());
- if ( !destinationDir.exists() )
- {
+ if (!destinationDir.exists()) {
destinationDir.mkdirs();
}
- config.setSourceFiles( null );
+ config.setSourceFiles(null);
- String[] sourceFiles = CSharpCompiler.getSourceFiles( config );
+ String[] sourceFiles = CSharpCompiler.getSourceFiles(config);
- if ( sourceFiles.length == 0 )
- {
- return new CompilerResult().success( true );
+ if (sourceFiles.length == 0) {
+ return new CompilerResult().success(true);
}
- logCompiling( sourceFiles, config );
+ logCompiling(sourceFiles, config);
- String[] args = buildCompilerArguments( config, sourceFiles );
+ String[] args = buildCompilerArguments(config, sourceFiles);
List messages;
- if ( config.isFork() )
- {
- messages =
- compileOutOfProcess( config.getWorkingDirectory(), config.getBuildDirectory(), findExecutable( config ),
- args );
- }
- else
- {
- throw new CompilerException( "This compiler doesn't support in-process compilation." );
+ if (config.isFork()) {
+ messages = compileOutOfProcess(
+ config.getWorkingDirectory(), config.getBuildDirectory(), findExecutable(config), args);
+ } else {
+ throw new CompilerException("This compiler doesn't support in-process compilation.");
}
- return new CompilerResult().compilerMessages( messages );
+ return new CompilerResult().compilerMessages(messages);
}
- public String[] createCommandLine( CompilerConfiguration config )
- throws CompilerException
- {
- return buildCompilerArguments( config, CSharpCompiler.getSourceFiles( config ) );
+ public String[] createCommandLine(CompilerConfiguration config) throws CompilerException {
+ return buildCompilerArguments(config, CSharpCompiler.getSourceFiles(config));
}
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
- private Map getCompilerArguments( CompilerConfiguration config )
- {
- if (compilerArguments != null)
- {
+ private Map getCompilerArguments(CompilerConfiguration config) {
+ if (compilerArguments != null) {
return compilerArguments;
}
-
+
compilerArguments = config.getCustomCompilerArgumentsAsMap();
-
+
Iterator i = compilerArguments.keySet().iterator();
-
- while ( i.hasNext() )
- {
+
+ while (i.hasNext()) {
String orig = i.next();
- String v = compilerArguments.get( orig );
- if ( orig.contains( ":" ) && v == null )
- {
- String[] arr = orig.split( ":" );
+ String v = compilerArguments.get(orig);
+ if (orig.contains(":") && v == null) {
+ String[] arr = orig.split(":");
i.remove();
String k = arr[0];
v = arr[1];
- compilerArguments.put( k, v );
- if ( config.isDebug() )
- {
- System.out.println( "transforming argument from " + orig + " to " + k + " = [" + v + "]" );
+ compilerArguments.put(k, v);
+ if (config.isDebug()) {
+ System.out.println("transforming argument from " + orig + " to " + k + " = [" + v + "]");
}
}
}
-
- config.setCustomCompilerArgumentsAsMap( compilerArguments );
-
+
+ config.setCustomCompilerArgumentsAsMap(compilerArguments);
+
return compilerArguments;
}
- private String findExecutable( CompilerConfiguration config )
- {
+ private String findExecutable(CompilerConfiguration config) {
String executable = config.getExecutable();
- if ( !StringUtils.isEmpty( executable ) )
- {
+ if (!StringUtils.isEmpty(executable)) {
return executable;
}
- if ( Os.isFamily( "windows" ) )
- {
+ if (Os.isFamily("windows")) {
return "csc";
}
@@ -202,60 +177,56 @@ private String findExecutable( CompilerConfiguration config )
}
/*
-$ mcs --help
-Mono C# compiler, (C) 2001 - 2003 Ximian, Inc.
-mcs [options] source-files
- --about About the Mono C# compiler
- -addmodule:MODULE Adds the module to the generated assembly
- -checked[+|-] Set default context to checked
- -codepage:ID Sets code page to the one in ID (number, utf8, reset)
- -clscheck[+|-] Disables CLS Compliance verifications
- -define:S1[;S2] Defines one or more symbols (short: /d:)
- -debug[+|-], -g Generate debugging information
- -delaysign[+|-] Only insert the public key into the assembly (no signing)
- -doc:FILE XML Documentation file to generate
- -keycontainer:NAME The key pair container used to strongname the assembly
- -keyfile:FILE The strongname key file used to strongname the assembly
- -langversion:TEXT Specifies language version modes: ISO-1 or Default
- -lib:PATH1,PATH2 Adds the paths to the assembly link path
- -main:class Specified the class that contains the entry point
- -noconfig[+|-] Disables implicit references to assemblies
- -nostdlib[+|-] Does not load core libraries
- -nowarn:W1[,W2] Disables one or more warnings
- -optimize[+|-] Enables code optimalizations
- -out:FNAME Specifies output file
- -pkg:P1[,Pn] References packages P1..Pn
- -recurse:SPEC Recursively compiles the files in SPEC ([dir]/file)
- -reference:ASS References the specified assembly (-r:ASS)
- -target:KIND Specifies the target (KIND is one of: exe, winexe,
- library, module), (short: /t:)
- -unsafe[+|-] Allows unsafe code
- -warnaserror[+|-] Treat warnings as errors
- -warn:LEVEL Sets warning level (the highest is 4, the default is 2)
- -help2 Show other help flags
-
-Resources:
- -linkresource:FILE[,ID] Links FILE as a resource
- -resource:FILE[,ID] Embed FILE as a resource
- -win32res:FILE Specifies Win32 resource file (.res)
- -win32icon:FILE Use this icon for the output
- @file Read response file for more options
-
-Options can be of the form -option or /option
- */
-
- private String[] buildCompilerArguments( CompilerConfiguration config, String[] sourceFiles )
- throws CompilerException
- {
+ $ mcs --help
+ Mono C# compiler, (C) 2001 - 2003 Ximian, Inc.
+ mcs [options] source-files
+ --about About the Mono C# compiler
+ -addmodule:MODULE Adds the module to the generated assembly
+ -checked[+|-] Set default context to checked
+ -codepage:ID Sets code page to the one in ID (number, utf8, reset)
+ -clscheck[+|-] Disables CLS Compliance verifications
+ -define:S1[;S2] Defines one or more symbols (short: /d:)
+ -debug[+|-], -g Generate debugging information
+ -delaysign[+|-] Only insert the public key into the assembly (no signing)
+ -doc:FILE XML Documentation file to generate
+ -keycontainer:NAME The key pair container used to strongname the assembly
+ -keyfile:FILE The strongname key file used to strongname the assembly
+ -langversion:TEXT Specifies language version modes: ISO-1 or Default
+ -lib:PATH1,PATH2 Adds the paths to the assembly link path
+ -main:class Specified the class that contains the entry point
+ -noconfig[+|-] Disables implicit references to assemblies
+ -nostdlib[+|-] Does not load core libraries
+ -nowarn:W1[,W2] Disables one or more warnings
+ -optimize[+|-] Enables code optimalizations
+ -out:FNAME Specifies output file
+ -pkg:P1[,Pn] References packages P1..Pn
+ -recurse:SPEC Recursively compiles the files in SPEC ([dir]/file)
+ -reference:ASS References the specified assembly (-r:ASS)
+ -target:KIND Specifies the target (KIND is one of: exe, winexe,
+ library, module), (short: /t:)
+ -unsafe[+|-] Allows unsafe code
+ -warnaserror[+|-] Treat warnings as errors
+ -warn:LEVEL Sets warning level (the highest is 4, the default is 2)
+ -help2 Show other help flags
+
+ Resources:
+ -linkresource:FILE[,ID] Links FILE as a resource
+ -resource:FILE[,ID] Embed FILE as a resource
+ -win32res:FILE Specifies Win32 resource file (.res)
+ -win32icon:FILE Use this icon for the output
+ @file Read response file for more options
+
+ Options can be of the form -option or /option
+ */
+
+ private String[] buildCompilerArguments(CompilerConfiguration config, String[] sourceFiles)
+ throws CompilerException {
List args = new ArrayList<>();
- if ( config.isDebug() )
- {
- args.add( "/debug+" );
- }
- else
- {
- args.add( "/debug-" );
+ if (config.isDebug()) {
+ args.add("/debug+");
+ } else {
+ args.add("/debug-");
}
// config.isShowWarnings()
@@ -267,41 +238,32 @@ private String[] buildCompilerArguments( CompilerConfiguration config, String[]
//
// ----------------------------------------------------------------------
- for ( String element : config.getClasspathEntries() )
- {
- File f = new File( element );
+ for (String element : config.getClasspathEntries()) {
+ File f = new File(element);
- if ( !f.isFile() )
- {
+ if (!f.isFile()) {
continue;
}
-
+
if (element.endsWith(JAR_SUFFIX)) {
- try
- {
+ try {
File dllDir = new File(element + NET_SUFFIX);
- if (!dllDir.exists())
- {
+ if (!dllDir.exists()) {
dllDir.mkdir();
}
JarUtil.extract(dllDir.toPath(), new File(element));
- for (String tmpfile : dllDir.list())
- {
- if ( tmpfile.endsWith(DLL_SUFFIX) )
- {
- String dll = Paths.get(dllDir.getAbsolutePath(), tmpfile).toString();
- args.add( "/reference:\"" + dll + "\"" );
+ for (String tmpfile : dllDir.list()) {
+ if (tmpfile.endsWith(DLL_SUFFIX)) {
+ String dll =
+ Paths.get(dllDir.getAbsolutePath(), tmpfile).toString();
+ args.add("/reference:\"" + dll + "\"");
}
}
+ } catch (IOException e) {
+ throw new CompilerException(e.toString(), e);
}
- catch ( IOException e )
- {
- throw new CompilerException( e.toString(), e );
- }
- }
- else
- {
- args.add( "/reference:\"" + element + "\"" );
+ } else {
+ args.add("/reference:\"" + element + "\"");
}
}
@@ -309,171 +271,144 @@ private String[] buildCompilerArguments( CompilerConfiguration config, String[]
// Main class
// ----------------------------------------------------------------------
- Map compilerArguments = getCompilerArguments( config );
+ Map compilerArguments = getCompilerArguments(config);
- String mainClass = compilerArguments.get( "-main" );
+ String mainClass = compilerArguments.get("-main");
- if ( !StringUtils.isEmpty( mainClass ) )
- {
- args.add( "/main:" + mainClass );
+ if (!StringUtils.isEmpty(mainClass)) {
+ args.add("/main:" + mainClass);
}
// ----------------------------------------------------------------------
// Xml Doc output
// ----------------------------------------------------------------------
- String doc = compilerArguments.get( "-doc" );
+ String doc = compilerArguments.get("-doc");
- if ( !StringUtils.isEmpty( doc ) )
- {
- args.add( "/doc:" + new File( config.getOutputLocation(),
- config.getOutputFileName() + ".xml" ).getAbsolutePath() );
+ if (!StringUtils.isEmpty(doc)) {
+ args.add("/doc:"
+ + new File(config.getOutputLocation(), config.getOutputFileName() + ".xml").getAbsolutePath());
}
// ----------------------------------------------------------------------
// Xml Doc output
// ----------------------------------------------------------------------
- String nowarn = compilerArguments.get( "-nowarn" );
+ String nowarn = compilerArguments.get("-nowarn");
- if ( !StringUtils.isEmpty( nowarn ) )
- {
- args.add( "/nowarn:" + nowarn );
+ if (!StringUtils.isEmpty(nowarn)) {
+ args.add("/nowarn:" + nowarn);
}
// ----------------------------------------------------------------------
// Out - Override output name, this is required for generating the unit test dll
// ----------------------------------------------------------------------
- String out = compilerArguments.get( "-out" );
+ String out = compilerArguments.get("-out");
- if ( !StringUtils.isEmpty( out ) )
- {
- args.add( "/out:" + new File( config.getOutputLocation(), out ).getAbsolutePath() );
- }
- else
- {
- args.add( "/out:" + new File( config.getOutputLocation(), getOutputFile( config ) ).getAbsolutePath() );
+ if (!StringUtils.isEmpty(out)) {
+ args.add("/out:" + new File(config.getOutputLocation(), out).getAbsolutePath());
+ } else {
+ args.add("/out:" + new File(config.getOutputLocation(), getOutputFile(config)).getAbsolutePath());
}
// ----------------------------------------------------------------------
// Resource File - compile in a resource file into the assembly being created
// ----------------------------------------------------------------------
- String resourcefile = compilerArguments.get( "-resourcefile" );
+ String resourcefile = compilerArguments.get("-resourcefile");
- if ( !StringUtils.isEmpty( resourcefile ) )
- {
- String resourceTarget = compilerArguments.get( "-resourcetarget" );
- args.add( "/res:" + new File( resourcefile ).getAbsolutePath() + "," + resourceTarget );
+ if (!StringUtils.isEmpty(resourcefile)) {
+ String resourceTarget = compilerArguments.get("-resourcetarget");
+ args.add("/res:" + new File(resourcefile).getAbsolutePath() + "," + resourceTarget);
}
// ----------------------------------------------------------------------
- // Target - type of assembly to produce, lib,exe,winexe etc...
+ // Target - type of assembly to produce, lib,exe,winexe etc...
// ----------------------------------------------------------------------
- String target = compilerArguments.get( "-target" );
+ String target = compilerArguments.get("-target");
- if ( StringUtils.isEmpty( target ) )
- {
- args.add( "/target:library" );
- }
- else
- {
- args.add( "/target:" + target );
+ if (StringUtils.isEmpty(target)) {
+ args.add("/target:library");
+ } else {
+ args.add("/target:" + target);
}
// ----------------------------------------------------------------------
// remove MS logo from output (not applicable for mono)
// ----------------------------------------------------------------------
- String nologo = compilerArguments.get( "-nologo" );
+ String nologo = compilerArguments.get("-nologo");
- if ( !StringUtils.isEmpty( nologo ) )
- {
- args.add( "/nologo" );
+ if (!StringUtils.isEmpty(nologo)) {
+ args.add("/nologo");
}
// ----------------------------------------------------------------------
// add any resource files
// ----------------------------------------------------------------------
- this.addResourceArgs( config, args );
+ this.addResourceArgs(config, args);
// ----------------------------------------------------------------------
// add source files
// ----------------------------------------------------------------------
- for ( String sourceFile : sourceFiles )
- {
- args.add( sourceFile );
+ for (String sourceFile : sourceFiles) {
+ args.add(sourceFile);
}
- return args.toArray( new String[args.size()] );
+ return args.toArray(new String[args.size()]);
}
- private void addResourceArgs( CompilerConfiguration config, List