Skip to content

Commit

Permalink
Fixed specifying annotation processors path in javac front-end.
Browse files Browse the repository at this point in the history
	Change on 2016/12/23 by tball <tball@google.com>

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=142853361
  • Loading branch information
tomball committed Dec 28, 2016
1 parent a699a70 commit 9edf13d
Showing 1 changed file with 4 additions and 8 deletions.
Expand Up @@ -98,6 +98,10 @@ private JavacFileManager getFileManager(JavaCompiler compiler,
addPaths(StandardLocation.CLASS_PATH, classpathEntries, fileManager);
addPaths(StandardLocation.SOURCE_PATH, sourcepathEntries, fileManager);
addPaths(StandardLocation.PLATFORM_CLASS_PATH, Options.getBootClasspath(), fileManager);
List<String> processorPathEntries = options.getProcessorPathEntries();
if (!processorPathEntries.isEmpty()) {
addPaths(StandardLocation.ANNOTATION_PROCESSOR_PATH, processorPathEntries, fileManager);
}
fileManager.setLocation(StandardLocation.CLASS_OUTPUT,
Lists.newArrayList(options.fileUtil().getOutputDirectory()));
fileManager.setLocation(StandardLocation.SOURCE_OUTPUT,
Expand Down Expand Up @@ -137,14 +141,6 @@ private List<String> getJavacOptions(boolean processAnnotations) {
} else {
javacOptions.add("-proc:none");
}

// TODO(tball): this should be in the FileManager, but adding it there
// causes annotations to be processed twice, causing a "duplicate unit"
// error. Defining the path as a javac flag works correctly, however.
if (options.getProcessorPathEntries().size() > 0) {
javacOptions.add("-processorpath");
javacOptions.add(makePathString(options.getProcessorPathEntries()));
}
return javacOptions;
}

Expand Down

0 comments on commit 9edf13d

Please sign in to comment.