diff options
author | juliexxia <juliexxia@google.com> | 2018-08-13 15:21:42 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-08-13 15:23:28 -0700 |
commit | a6298007e0b8338aa4ac5cbc9f6d42d5d44b6d6d (patch) | |
tree | bd4a4357d6b36e90ea7382421ef0c27911230a31 /src/main/java/com/google/devtools/common/options/OptionsParser.java | |
parent | 3bace1b937934fb2cea6260067ecc1cdbe526847 (diff) |
Add a <code>getSkylarkOptions</code> helper function to all OptionsProviders.
This is to allow OptionsProviders to access the new skylark options which aren't held in a fragment class like native options and thus can't be accessed with the traditional <code>get</code> method. Currently this function isn't called anywhere and would just return an empty map. But in the future it will return a map of skylark flag names to values.
PiperOrigin-RevId: 208552510
Diffstat (limited to 'src/main/java/com/google/devtools/common/options/OptionsParser.java')
-rw-r--r-- | src/main/java/com/google/devtools/common/options/OptionsParser.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/common/options/OptionsParser.java b/src/main/java/com/google/devtools/common/options/OptionsParser.java index 6f1d7b6479..e1c7cbb8a0 100644 --- a/src/main/java/com/google/devtools/common/options/OptionsParser.java +++ b/src/main/java/com/google/devtools/common/options/OptionsParser.java @@ -176,6 +176,7 @@ public class OptionsParser implements OptionsProvider { private final OptionsParserImpl impl; private final List<String> residue = new ArrayList<String>(); private boolean allowResidue = true; + private Map<String, Object> skylarkOptions = new HashMap<>(); OptionsParser(OptionsData optionsData) { impl = new OptionsParserImpl(optionsData); @@ -191,6 +192,15 @@ public class OptionsParser implements OptionsProvider { this.allowResidue = allowResidue; } + @Override + public Map<String, Object> getSkylarkOptions() { + return skylarkOptions; + } + + void setSkylarkOptions(Map<String, Object> skylarkOptions) { + this.skylarkOptions = skylarkOptions; + } + /** * Indicates whether or not the parser will allow long options with a * single-dash, instead of the usual double-dash, too, eg. -example instead of just --example. |