Skip to content

Commit

Permalink
Pass through additional compiler arguments
Browse files Browse the repository at this point in the history
This will allow to pass arguments like "--add-modules=java.se.ee" as `compilerArguments`
  • Loading branch information
beikov committed Sep 7, 2017
1 parent 0d916b6 commit fed8bfe
Showing 1 changed file with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,26 +341,28 @@ else if( "-s".equals(option) ) {
}
else if( option.startsWith("-A") ) {
javacConf.addCompilerCustomArgument(option, "");

}
final java.util.Properties props = project.getProperties();

final String sourceVersion = props.getProperty(PROCESSOR_SOURCE,props.getProperty(COMPILER_SOURCE, DEFAULT_SOURCE_VERSION));
final String targetVersion = props.getProperty(PROCESSOR_TARGET,props.getProperty(COMPILER_TARGET, DEFAULT_TARGET_VERSION));

javacConf.setSourceVersion(sourceVersion );
javacConf.setTargetVersion(targetVersion);
javacConf.setWorkingDirectory(project.getBasedir());

final java.util.Set<java.io.File> sourceFiles =
new java.util.HashSet<java.io.File>();
for( JavaFileObject src : compilationUnits ) {
sourceFiles.add( new java.io.File( src.toUri() ) );

else {
// Just pass through any other arguments
javacConf.addCompilerCustomArgument(option, "");
}

javacConf.setSourceFiles(sourceFiles);
}
final java.util.Properties props = project.getProperties();

final String sourceVersion = props.getProperty(PROCESSOR_SOURCE,props.getProperty(COMPILER_SOURCE, DEFAULT_SOURCE_VERSION));
final String targetVersion = props.getProperty(PROCESSOR_TARGET,props.getProperty(COMPILER_TARGET, DEFAULT_TARGET_VERSION));

javacConf.setSourceVersion(sourceVersion );
javacConf.setTargetVersion(targetVersion);
javacConf.setWorkingDirectory(project.getBasedir());

final java.util.Set<java.io.File> sourceFiles =
new java.util.HashSet<java.io.File>();
for( JavaFileObject src : compilationUnits ) {
sourceFiles.add( new java.io.File( src.toUri() ) );
}

javacConf.setSourceFiles(sourceFiles);
javacConf.setDebug(false);
javacConf.setFork(true);
javacConf.setVerbose(false);
Expand Down

0 comments on commit fed8bfe

Please sign in to comment.