aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcushon <cushon@google.com>2017-05-02 17:17:12 -0700
committerLiam Miller-Cushon <cushon@google.com>2017-05-03 12:13:04 -0700
commit55b9b0f2263b9308ec94917f46f00259350f20df (patch)
treecb72bf6dba3f48324b16747428efd8b6a191f9b5
parente00231e80f0b3822babc5d34d2ac776c08bd235f (diff)
downloadturbine-55b9b0f2263b9308ec94917f46f00259350f20df.tar.gz
Add a flag to control fallback to javac-turbine
which is currently used for error reporting. MOE_MIGRATED_REVID=154902502
-rw-r--r--java/com/google/turbine/options/TurbineOptions.java15
-rw-r--r--java/com/google/turbine/options/TurbineOptionsParser.java6
2 files changed, 21 insertions, 0 deletions
diff --git a/java/com/google/turbine/options/TurbineOptions.java b/java/com/google/turbine/options/TurbineOptions.java
index 6fe96a4..ba9396f 100644
--- a/java/com/google/turbine/options/TurbineOptions.java
+++ b/java/com/google/turbine/options/TurbineOptions.java
@@ -40,6 +40,7 @@ public class TurbineOptions {
private final Optional<String> targetLabel;
private final ImmutableList<String> depsArtifacts;
private final Optional<String> ruleKind;
+ private final boolean javacFallback;
private final ImmutableList<String> javacOpts;
private final boolean shouldReduceClassPath;
@@ -57,6 +58,7 @@ public class TurbineOptions {
@Nullable String targetLabel,
ImmutableList<String> depsArtifacts,
@Nullable String ruleKind,
+ boolean javacFallback,
ImmutableList<String> javacOpts,
boolean shouldReduceClassPath) {
this.output = checkNotNull(output, "output must not be null");
@@ -74,6 +76,7 @@ public class TurbineOptions {
this.targetLabel = Optional.fromNullable(targetLabel);
this.depsArtifacts = checkNotNull(depsArtifacts, "depsArtifacts must not be null");
this.ruleKind = Optional.fromNullable(ruleKind);
+ this.javacFallback = javacFallback;
this.javacOpts = checkNotNull(javacOpts, "javacOpts must not be null");
this.shouldReduceClassPath = shouldReduceClassPath;
}
@@ -143,6 +146,11 @@ public class TurbineOptions {
return ruleKind;
}
+ /** Fall back to javac-turbine for error reporting. */
+ public boolean javacFallback() {
+ return javacFallback;
+ }
+
/** Additional Java compiler flags. */
public ImmutableList<String> javacOpts() {
return javacOpts;
@@ -174,6 +182,7 @@ public class TurbineOptions {
@Nullable private String targetLabel;
private final ImmutableList.Builder<String> depsArtifacts = ImmutableList.builder();
@Nullable private String ruleKind;
+ private boolean javacFallback = true;
private final ImmutableList.Builder<String> javacOpts = ImmutableList.builder();
private boolean shouldReduceClassPath = true;
@@ -192,6 +201,7 @@ public class TurbineOptions {
targetLabel,
depsArtifacts.build(),
ruleKind,
+ javacFallback,
javacOpts.build(),
shouldReduceClassPath);
}
@@ -266,6 +276,11 @@ public class TurbineOptions {
return this;
}
+ public Builder setJavacFallback(boolean javacFallback) {
+ this.javacFallback = javacFallback;
+ return this;
+ }
+
public Builder addAllJavacOpts(Iterable<String> javacOpts) {
this.javacOpts.addAll(javacOpts);
return this;
diff --git a/java/com/google/turbine/options/TurbineOptionsParser.java b/java/com/google/turbine/options/TurbineOptionsParser.java
index e06db38..5d78201 100644
--- a/java/com/google/turbine/options/TurbineOptionsParser.java
+++ b/java/com/google/turbine/options/TurbineOptionsParser.java
@@ -135,6 +135,12 @@ public class TurbineOptionsParser {
case "--rule_kind":
builder.setRuleKind(readOne(argumentDeque));
break;
+ case "--javac_fallback":
+ builder.setJavacFallback(true);
+ break;
+ case "--nojavac_fallback":
+ builder.setJavacFallback(false);
+ break;
default:
if (next.isEmpty() && !argumentDeque.isEmpty()) {
throw new IllegalArgumentException("unknown option: " + next);