summaryrefslogtreecommitdiff
path: root/java/com/google/devtools/common/options/InvocationPolicyEnforcer.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/google/devtools/common/options/InvocationPolicyEnforcer.java')
-rw-r--r--java/com/google/devtools/common/options/InvocationPolicyEnforcer.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/java/com/google/devtools/common/options/InvocationPolicyEnforcer.java b/java/com/google/devtools/common/options/InvocationPolicyEnforcer.java
index 88deb46..3b42a29 100644
--- a/java/com/google/devtools/common/options/InvocationPolicyEnforcer.java
+++ b/java/com/google/devtools/common/options/InvocationPolicyEnforcer.java
@@ -248,6 +248,15 @@ public final class InvocationPolicyEnforcer {
OptionPriority nextPriority =
OptionPriority.lowestOptionPriorityAtCategory(PriorityCategory.INVOCATION_POLICY);
for (FlagPolicy policy : invocationPolicy.getFlagPoliciesList()) {
+ // Explicitly disallow --config in invocation policy.
+ if (policy.getFlagName().equals("config")) {
+ throw new OptionsParsingException(
+ "Invocation policy is applied after --config expansion, changing config values now "
+ + "would have no effect and is disallowed to prevent confusion. Please remove the "
+ + "following policy : "
+ + policy);
+ }
+
// These policies are high-level, before expansion, and so are not the implicitDependents or
// expansions of any other flag, other than in an obtuse sense from --invocation_policy.
OptionPriority currentPriority = nextPriority;