Skip to content

Commit

Permalink
Altering javac_worker a bit so it's possible to override how the comp…
Browse files Browse the repository at this point in the history
…iler is constructed.
  • Loading branch information
peterebden committed Apr 6, 2017
1 parent ccf18cf commit d05d251
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
Version 7.9.0
-------------

* Rewrite of proto_library and grpc_library rules. It's now possible to configure new
languages externally for plugins such as grpc-gateway.
* Add <root>/third_party/ to the default GOPATH
* Added --shell flag to plz build, which is like --prepare but opens a shell in the
work directory with an appropriate environment set.
* Added --update flag to plz hash to rewrite hashes in a BUILD file.


Version 7.8.2
-------------
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.8.2
7.9.0
10 changes: 9 additions & 1 deletion tools/javac_worker/src/build/please/compile/JavaCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ public BuildResponse build(BuildRequest request) throws IOException {
}
}

/**
* newCompiler creates a new compiler instance.
* This is added to allow subclasses to define their own compiler supplier (e.g. ErrorProne).
*/
public javax.tools.JavaCompiler newCompiler() {
return ToolProvider.getSystemJavaCompiler();
}

private BuildResponse reallyBuild(BuildRequest request) throws IOException {
BuildResponse.Builder builder = BuildResponse.newBuilder();
// Try to create the output directory
Expand All @@ -95,7 +103,7 @@ private BuildResponse reallyBuild(BuildRequest request) throws IOException {
String tmpDir = request.getTempDir() + "/_tmp";
DiagnosticReporter reporter = new DiagnosticReporter(builder);
StringWriter writer = new StringWriter();
javax.tools.JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
javax.tools.JavaCompiler compiler = newCompiler();
StandardJavaFileManager fileManager = compiler.getStandardFileManager(reporter, null, null);
ArrayList<String> srcs = new ArrayList<String>();
for (String src : request.getSrcsList()) {
Expand Down

0 comments on commit d05d251

Please sign in to comment.