8015145: Smartjavac needs more flexibility with linking to sources

Reviewed-by: jjg, ohrstrom
This commit is contained in:
Erik Joelsson 2013-08-15 17:24:35 +02:00
parent 0c6e63367d
commit fd4983b254
3 changed files with 49 additions and 9 deletions

View file

@ -249,16 +249,19 @@ public class Main {
return -1;
}
// Find all source files allowable for linking.
// Create a map of all source files that are available for linking. Both -src and
// -sourcepath point to such files. It is possible to specify multiple
// -sourcepath options to enable different filtering rules. If the
// filters are the same for multiple sourcepaths, they may be concatenated
// using :(;). Before sending the list of sourcepaths to javac, they are
// all concatenated. The list created here is used by the SmartFileWrapper to
// make sure only the correct sources are actually available.
// We might find more modules here as well.
Map<String,Source> sources_to_link_to = new HashMap<String,Source>();
// Always reuse -src for linking as well! This means that we might
// get two -sourcepath on the commandline after the rewrite, which is
// fine. We can have as many as we like. You need to have separate -src/-sourcepath/-classpath
// if you need different filtering rules for different roots. If you have the same filtering
// rules for all sourcepath roots, you can concatenate them using :(;) as before.
rewriteOptions(args, "-src", "-sourcepath");
findFiles(args, "-src", Util.set(".java"), sources_to_link_to, modules, current_module, true);
findFiles(args, "-sourcepath", Util.set(".java"), sources_to_link_to, modules, current_module, true);
// Rewrite the -src option to make it through to the javac instances.
rewriteOptions(args, "-src", "-sourcepath");
// Find all class files allowable for linking.
// And pickup knowledge of all modules found here.