aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/config
diff options
context:
space:
mode:
authorGravatar Michael Staib <mstaib@google.com>2017-03-17 23:15:16 +0000
committerGravatar Yue Gan <yueg@google.com>2017-03-20 11:43:06 +0000
commita5aa916dc8c0e99c8fc91893246381f72b7066a9 (patch)
tree4a8c20854fd779b12d554319677c48a240dbe918 /src/main/java/com/google/devtools/build/lib/analysis/config
parent42d313fa526398b76aa122106adf1518a784e12f (diff)
Create "internal" category of command-line options.
This is intended to be used for "flags" which should never appear on the command line - things like configuration distinguishers, which are used internally and must be part of the build options, but should always be set to their default value at the top level. This is already a convention within Bazel, but doesn't actually work the way Bazel expects - flags with spaces can be set by simply escaping or quoting the spaces so that word splitting will not break on them. This means they can also be matched by config_settings, which pass a single string. Forbidding the parser from matching these flags solves both of these unintended cases. Existing cases like this have also been converted to internal. -- PiperOrigin-RevId: 150497246 MOS_MIGRATED_REVID=150497246
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/config')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
index ca6158ff6f..e7df822128 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
@@ -465,7 +465,7 @@ public final class BuildConfiguration {
*/
@Option(name = "experimental multi cpu distinguisher",
defaultValue = "",
- category = "undocumented")
+ category = "internal")
public String experimentalMultiCpuDistinguisher;
@Option(name = "min_param_file_size",
@@ -563,9 +563,9 @@ public final class BuildConfiguration {
* to a constant, so that the output files for the host are completely independent of those for
* the target, no matter what options are in force (k8/piii, opt/dbg, etc).
*/
- @Option(name = "output directory name", // (Spaces => can't be specified on command line.)
+ @Option(name = "output directory name",
defaultValue = "null",
- category = "undocumented")
+ category = "internal")
public String outputDirectoryName;
@Option(name = "platform_suffix",
@@ -847,7 +847,7 @@ public final class BuildConfiguration {
@Option(name = "is host configuration",
defaultValue = "false",
- category = "undocumented",
+ category = "internal",
help = "Shows whether these options are set for host configuration.")
public boolean isHost;
@@ -1449,6 +1449,10 @@ public final class BuildConfiguration {
for (Field field : options.getClass().getFields()) {
if (field.isAnnotationPresent(Option.class)) {
Option option = field.getAnnotation(Option.class);
+ if (option.category().equals("internal")) {
+ // ignore internal options
+ continue;
+ }
Object value = field.get(options);
if (value == null) {
if (lateBoundDefaults.containsKey(option.name())) {