|
37 | 37 | import java.nio.charset.IllegalCharsetNameException;
|
38 | 38 | import java.nio.charset.UnsupportedCharsetException;
|
39 | 39 | import java.util.ArrayList;
|
40 |
| -import java.util.HashSet; |
| 40 | +import java.util.Arrays; |
41 | 41 | import java.util.Iterator;
|
42 |
| -import java.util.LinkedHashSet; |
43 | 42 | import java.util.List;
|
44 | 43 | import java.util.Locale;
|
45 | 44 | import java.util.Map.Entry;
|
46 | 45 | import java.util.ServiceLoader;
|
47 |
| -import java.util.Set; |
48 |
| - |
49 | 46 | import org.codehaus.plexus.compiler.AbstractCompiler;
|
50 | 47 | import org.codehaus.plexus.compiler.Compiler;
|
51 | 48 | import org.codehaus.plexus.compiler.CompilerConfiguration;
|
|
54 | 51 | import org.codehaus.plexus.compiler.CompilerOutputStyle;
|
55 | 52 | import org.codehaus.plexus.compiler.CompilerResult;
|
56 | 53 | import org.codehaus.plexus.component.annotations.Component;
|
57 |
| -import org.codehaus.plexus.util.DirectoryScanner; |
58 | 54 | import org.codehaus.plexus.util.StringUtils;
|
59 | 55 | import org.eclipse.jdt.core.compiler.CompilationProgress;
|
60 | 56 | import org.eclipse.jdt.core.compiler.batch.BatchCompiler;
|
@@ -169,14 +165,12 @@ public CompilerResult performCompile( CompilerConfiguration config )
|
169 | 165 | args.add( config.getOutputLocation() );
|
170 | 166 |
|
171 | 167 | // Annotation processors defined?
|
172 |
| - List<String> extraSourceDirs = new ArrayList<>(); |
173 | 168 | if ( !isPreJava1_6( config ) )
|
174 | 169 | {
|
175 | 170 | File generatedSourcesDir = config.getGeneratedSourcesDirectory();
|
176 | 171 | if ( generatedSourcesDir != null )
|
177 | 172 | {
|
178 | 173 | generatedSourcesDir.mkdirs();
|
179 |
| - extraSourceDirs.add( generatedSourcesDir.getAbsolutePath() ); |
180 | 174 |
|
181 | 175 | //-- option to specify where annotation processor is to generate its output
|
182 | 176 | args.add( "-s" );
|
@@ -247,24 +241,7 @@ public CompilerResult performCompile( CompilerConfiguration config )
|
247 | 241 | }
|
248 | 242 |
|
249 | 243 | // Collect sources
|
250 |
| - Set<String> allSources = new HashSet<>(); |
251 |
| - for ( String source : config.getSourceLocations() ) |
252 |
| - { |
253 |
| - File srcFile = new File( source ); |
254 |
| - if ( srcFile.exists() ) |
255 |
| - { |
256 |
| - Set<String> ss = getSourceFilesForSourceRoot( config, source ); |
257 |
| - allSources.addAll( ss ); |
258 |
| - } |
259 |
| - } |
260 |
| - for ( String extraSrcDir : extraSourceDirs ) |
261 |
| - { |
262 |
| - File extraDir = new File( extraSrcDir ); |
263 |
| - if ( extraDir.isDirectory() ) |
264 |
| - { |
265 |
| - addExtraSources( extraDir, allSources ); |
266 |
| - } |
267 |
| - } |
| 244 | + List<String> allSources = Arrays.asList( getSourceFiles( config ) ); |
268 | 245 | List<CompilerMessage> messageList = new ArrayList<>();
|
269 | 246 | if ( allSources.isEmpty() )
|
270 | 247 | {
|
@@ -504,9 +481,9 @@ static boolean isReplaceProcessorPath( CompilerConfiguration config )
|
504 | 481 | return false;
|
505 | 482 | }
|
506 | 483 |
|
507 |
| - static Set<String> resortSourcesToPutModuleInfoFirst( Set<String> allSources ) |
| 484 | + static List<String> resortSourcesToPutModuleInfoFirst( List<String> allSources ) |
508 | 485 | {
|
509 |
| - Set<String> resorted = new LinkedHashSet<>( allSources.size() ); |
| 486 | + List<String> resorted = new ArrayList<>( allSources.size() ); |
510 | 487 |
|
511 | 488 | for ( String mi : allSources )
|
512 | 489 | {
|
@@ -654,18 +631,6 @@ private JavaCompiler getEcj()
|
654 | 631 | return null;
|
655 | 632 | }
|
656 | 633 |
|
657 |
| - private void addExtraSources( File dir, Set<String> allSources ) |
658 |
| - { |
659 |
| - DirectoryScanner scanner = new DirectoryScanner(); |
660 |
| - scanner.setBasedir( dir.getAbsolutePath() ); |
661 |
| - scanner.setIncludes( new String[]{ "**/*.java" } ); |
662 |
| - scanner.scan(); |
663 |
| - for ( String file : scanner.getIncludedFiles() ) |
664 |
| - { |
665 |
| - allSources.add( new File( dir, file ).getAbsolutePath() ); |
666 |
| - } |
667 |
| - } |
668 |
| - |
669 | 634 | private CompilerMessage.Kind convert( Diagnostic.Kind kind )
|
670 | 635 | {
|
671 | 636 | if ( kind == null )
|
|
0 commit comments