diff options
author | Philipp Wollermann <philwo@google.com> | 2015-06-09 13:56:47 +0000 |
---|---|---|
committer | Philipp Wollermann <philwo@google.com> | 2015-06-10 16:02:11 +0000 |
commit | a49fe7be516edb710094f3420e3b0c72eb20a1ef (patch) | |
tree | 84fa7976c743418d22c122ee66678c0c56b1c64a | |
parent | 43c483d9102cc577ed70873c890084b035fc0110 (diff) |
Bugfix: We must use a case-insensitive TreeMap here so that differently cased strategy-flags can override the default flags (otherwise for example "Javac" and "javac" are both stored in the case-sensitive HashMap and it depends on luck which one ends up in the final strategy map).
--
MOS_MIGRATED_REVID=95532191
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/actions/ActionContextConsumer.java | 5 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionContextConsumer.java b/src/main/java/com/google/devtools/build/lib/actions/ActionContextConsumer.java index abf06db065..c4fd1bf17a 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/ActionContextConsumer.java +++ b/src/main/java/com/google/devtools/build/lib/actions/ActionContextConsumer.java @@ -46,6 +46,11 @@ public interface ActionContextConsumer { * * <p>If a spawn action is executed whose mnemonic maps to the empty string or is not * present in the map at all, the choice of the implementation is left to Blaze. + * + * <p>Matching on mnemonics is done case-insensitively so it is recommended that any + * implementation of this method makes sure that no two keys that refer to the same mnemonic are + * present in the returned map. The easiest way to assure this is to use a map created using + * {@code new TreeMap<>(String.CASE_INSENSITIVE_ORDER)}. */ Map<String, String> getSpawnActionContexts(); diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java index b1c6ae28ea..cfe6589127 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java @@ -35,9 +35,9 @@ import com.google.devtools.common.options.Option; import com.google.devtools.common.options.OptionsBase; import com.google.devtools.common.options.OptionsProvider; -import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.TreeMap; /** * Module implementing the rule set of Bazel. @@ -85,7 +85,7 @@ public class BazelRulesModule extends BlazeModule { } @Override public Map<String, String> getSpawnActionContexts() { - Map<String, String> contexts = new HashMap<>(); + Map<String, String> contexts = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); contexts.put("Genrule", options.genruleStrategy); |