Skip to content

Commit

Permalink
Categorize build options for BuildConfiguration.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 171017483
  • Loading branch information
gregestren authored and aehlig committed Oct 6, 2017
1 parent f8c5520 commit e1b09f2
Show file tree
Hide file tree
Showing 15 changed files with 177 additions and 123 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ public static class BuildRequestOptions extends OptionsBase {
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {
OptionEffectTag.LOADING_AND_ANALYSIS,
OptionEffectTag.EAGERNESS_TO_EXIT,
OptionEffectTag.AFFECTS_OUTPUTS
},
help =
Expand All @@ -258,7 +257,6 @@ public static class BuildRequestOptions extends OptionsBase {
documentationCategory = OptionDocumentationCategory.OUTPUT_SELECTION,
effectTags = {
OptionEffectTag.EXECUTION,
OptionEffectTag.EAGERNESS_TO_EXIT,
OptionEffectTag.AFFECTS_OUTPUTS
},
help =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public enum OrderOutput {
defaultValue = "false",
category = "query",
documentationCategory = OptionDocumentationCategory.QUERY,
effectTags = {OptionEffectTag.BUILD_FILE_SEMANTICS},
effectTags = {OptionEffectTag.BUILD_FILE_SEMANTICS, OptionEffectTag.EAGERNESS_TO_EXIT},
help =
"If true, the tests() expression gives an error if it encounters a test_suite containing "
+ "non-test targets."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public DefaultProvisioningProfileConverter() {
defaultValue = "null",
category = "flags",
documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
effectTags = {OptionEffectTag.ACTION_OPTIONS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES},
help =
"The identifier of an Xcode toolchain to use for builds. Currently only the toolchains "
+ "that ship with Xcode are supported. For example, in addition to the default "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class SwiftCommandLineOptions extends FragmentOptions {
defaultValue = "",
category = "flags",
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_OPTIONS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES},
help = "Additional options to pass to Swift compilation."
)
public List<String> copts;
Expand All @@ -39,7 +39,7 @@ public class SwiftCommandLineOptions extends FragmentOptions {
defaultValue = "false",
category = "flags",
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_OPTIONS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES},
help = "Whether to enable Whole Module Optimization"
)
public boolean enableWholeModuleOptimization;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public LipoModeConverter() {
documentationCategory = OptionDocumentationCategory.OUTPUT_SELECTION,
effectTags = {
OptionEffectTag.LOADING_AND_ANALYSIS,
OptionEffectTag.ACTION_OPTIONS,
OptionEffectTag.ACTION_COMMAND_LINES,
OptionEffectTag.AFFECTS_OUTPUTS
},
help =
Expand Down Expand Up @@ -329,7 +329,7 @@ public LipoModeConverter() {
defaultValue = "",
category = "flags",
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_OPTIONS, OptionEffectTag.AFFECTS_OUTPUTS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS},
help = "Additional options to pass to gcc."
)
public List<String> coptList;
Expand All @@ -340,7 +340,7 @@ public LipoModeConverter() {
category = "flags",
allowMultiple = true,
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_OPTIONS, OptionEffectTag.AFFECTS_OUTPUTS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS},
help = "Additional option to pass to gcc when compiling C++ source files."
)
public List<String> cxxoptList;
Expand All @@ -351,7 +351,7 @@ public LipoModeConverter() {
defaultValue = "",
category = "flags",
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_OPTIONS, OptionEffectTag.AFFECTS_OUTPUTS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS},
help = "Additional option to pass to gcc when compiling C source files."
)
public List<String> conlyoptList;
Expand All @@ -362,7 +362,7 @@ public LipoModeConverter() {
category = "flags",
allowMultiple = true,
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_OPTIONS, OptionEffectTag.AFFECTS_OUTPUTS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS},
help = "Additional option to pass to gcc when linking."
)
public List<String> linkoptList;
Expand All @@ -373,7 +373,7 @@ public LipoModeConverter() {
category = "flags",
allowMultiple = true,
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_OPTIONS, OptionEffectTag.AFFECTS_OUTPUTS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS},
help = "Additional option to pass to the LTO indexing step (under --features=thin_lto)."
)
public List<String> ltoindexoptList;
Expand All @@ -384,7 +384,7 @@ public LipoModeConverter() {
defaultValue = "",
category = "flags",
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_OPTIONS, OptionEffectTag.AFFECTS_OUTPUTS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS},
help = "Additional options to pass to strip when generating a '<name>.stripped' binary."
)
public List<String> stripoptList;
Expand All @@ -407,7 +407,7 @@ public LipoModeConverter() {
defaultValue = "true",
category = "semantics",
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_OPTIONS, OptionEffectTag.AFFECTS_OUTPUTS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS},
help =
"When on, use --whole-archive for cc_binary rules that have "
+ "linkshared=1 and either linkstatic=1 or '-static' in linkopts. "
Expand Down Expand Up @@ -661,7 +661,7 @@ private boolean enableLipoSettings() {
defaultValue = "null",
category = "version",
documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
effectTags = {OptionEffectTag.AFFECTS_OUTPUTS, OptionEffectTag.ACTION_OPTIONS},
effectTags = {OptionEffectTag.AFFECTS_OUTPUTS, OptionEffectTag.ACTION_COMMAND_LINES},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"If set, use this label instead of the default STL implementation. "
Expand Down Expand Up @@ -689,7 +689,7 @@ private boolean enableLipoSettings() {
defaultValue = "",
category = "semantics",
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_OPTIONS, OptionEffectTag.AFFECTS_OUTPUTS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS},
help =
"Additional options to selectively pass to gcc when compiling certain files. "
+ "This option can be passed multiple times. "
Expand Down Expand Up @@ -729,7 +729,7 @@ private boolean enableLipoSettings() {
defaultValue = "",
category = "flags",
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_OPTIONS, OptionEffectTag.AFFECTS_OUTPUTS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS},
help = "Additional options to pass to gcc for host tools."
)
public List<String> hostCoptList;
Expand All @@ -740,7 +740,7 @@ private boolean enableLipoSettings() {
defaultValue = "",
category = "flags",
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_OPTIONS, OptionEffectTag.AFFECTS_OUTPUTS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS},
help = "Additional options to pass to gcc for host tools."
)
public List<String> hostCxxoptList;
Expand All @@ -751,7 +751,7 @@ private boolean enableLipoSettings() {
category = "version",
converter = LibcTopLabelConverter.class,
documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
effectTags = {OptionEffectTag.ACTION_OPTIONS, OptionEffectTag.AFFECTS_OUTPUTS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS},
help =
"A label to a checked-in libc library. The default value is selected by the crosstool "
+ "toolchain, and you almost never need to override it."
Expand All @@ -764,7 +764,7 @@ private boolean enableLipoSettings() {
category = "version",
converter = LibcTopLabelConverter.class,
documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
effectTags = {OptionEffectTag.ACTION_OPTIONS, OptionEffectTag.AFFECTS_OUTPUTS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS},
help =
"If specified, this setting overrides the libc top-level directory (--grte_top) "
+ "for the host configuration."
Expand All @@ -776,7 +776,7 @@ private boolean enableLipoSettings() {
defaultValue = "false",
category = "flags",
documentationCategory = OptionDocumentationCategory.OUTPUT_SELECTION,
effectTags = {OptionEffectTag.ACTION_OPTIONS, OptionEffectTag.AFFECTS_OUTPUTS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS},
help =
"If enabled, for every C++ binary linked with gold, the number of defined symbols "
+ "and the number of used symbols per input file is stored in a .sc file."
Expand Down Expand Up @@ -831,7 +831,7 @@ private boolean enableLipoSettings() {
defaultValue = "false",
category = "semantics",
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_OPTIONS, OptionEffectTag.AFFECTS_OUTPUTS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"If true, use libunwind for stack unwinding, and compile with "
Expand All @@ -855,7 +855,7 @@ private boolean enableLipoSettings() {
name = "strict_system_includes",
defaultValue = "false",
category = "strategy",
documentationCategory = OptionDocumentationCategory.BUILD_TIME_OPTIMIZATION,
documentationCategory = OptionDocumentationCategory.INPUT_STRICTNESS,
effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS, OptionEffectTag.EAGERNESS_TO_EXIT},
help =
"If true, headers found through system include paths (-isystem) are also required to be "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ public OneVersionEnforcementLevelConverter() {
defaultValue = "default",
converter = StrictDepsConverter.class,
category = "semantics",
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.UNKNOWN},
documentationCategory = OptionDocumentationCategory.INPUT_STRICTNESS,
effectTags = {OptionEffectTag.BUILD_FILE_SEMANTICS, OptionEffectTag.EAGERNESS_TO_EXIT},
help =
"If true, checks that a Java target explicitly declares all directly used "
+ "targets as dependencies.",
Expand Down Expand Up @@ -462,7 +462,7 @@ public OneVersionEnforcementLevelConverter() {
name = "strict_deps_java_protos",
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.UNKNOWN},
effectTags = {OptionEffectTag.BUILD_FILE_SEMANTICS, OptionEffectTag.EAGERNESS_TO_EXIT},
help =
"When 'strict-deps' is on, .java files that depend on classes not declared in their rule's "
+ "'deps' fail to build. In other words, it's forbidden to depend on classes obtained "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public class ObjcCommandLineOptions extends FragmentOptions {
defaultValue = "",
category = "flags",
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_OPTIONS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES},
help = "Additional options to pass to Objective C compilation."
)
public List<String> copts;
Expand All @@ -131,7 +131,7 @@ public class ObjcCommandLineOptions extends FragmentOptions {
defaultValue = "false",
category = "misc",
documentationCategory = OptionDocumentationCategory.TESTING,
effectTags = {OptionEffectTag.ACTION_OPTIONS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES},
help = "Enable checking for memory leaks in ios_test targets."
)
public boolean runMemleaks;
Expand All @@ -153,7 +153,7 @@ public class ObjcCommandLineOptions extends FragmentOptions {
defaultValue = "-O0,-DDEBUG=1",
converter = CommaSeparatedOptionListConverter.class,
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_OPTIONS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES},
help = "Uses these strings as objc fastbuild compiler options."
)
public List<String> fastbuildOptions;
Expand All @@ -162,7 +162,7 @@ public class ObjcCommandLineOptions extends FragmentOptions {
name = "experimental_objc_enable_module_maps",
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.OUTPUT_SELECTION,
effectTags = {OptionEffectTag.ACTION_OPTIONS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES},
help = "Enables module map generation and interpretation."
)
public boolean enableModuleMaps;
Expand All @@ -172,7 +172,7 @@ public class ObjcCommandLineOptions extends FragmentOptions {
defaultValue = "false",
category = "flags",
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_OPTIONS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES},
help =
"Whether to perform symbol and dead-code strippings on linked binaries. Binary "
+ "strippings will be performed if both this flag and --compilationMode=opt are "
Expand All @@ -185,7 +185,7 @@ public class ObjcCommandLineOptions extends FragmentOptions {
defaultValue = "false",
category = "flags",
documentationCategory = OptionDocumentationCategory.OUTPUT_SELECTION,
effectTags = {OptionEffectTag.AFFECTS_OUTPUTS, OptionEffectTag.ACTION_OPTIONS},
effectTags = {OptionEffectTag.AFFECTS_OUTPUTS, OptionEffectTag.ACTION_COMMAND_LINES},
help = "Whether to generate debug symbol(.dSYM) file(s)."
)
public boolean appleGenerateDsym;
Expand All @@ -195,7 +195,7 @@ public class ObjcCommandLineOptions extends FragmentOptions {
defaultValue = "null",
category = "flags",
documentationCategory = OptionDocumentationCategory.SIGNING,
effectTags = {OptionEffectTag.ACTION_OPTIONS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES},
help =
"Certificate name to use for iOS signing. If not set will fall back to provisioning "
+ "profile. May be the certificate's keychain identity preference or (substring) of "
Expand All @@ -207,7 +207,7 @@ public class ObjcCommandLineOptions extends FragmentOptions {
name = "objc_debug_with_GLIBCXX",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_OPTIONS},
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES},
help =
"If set, and compilation mode is set to 'dbg', define GLIBCXX_DEBUG, "
+ " GLIBCXX_DEBUG_PEDANTIC and GLIBCPP_CONCEPT_CHECKS."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ public static class Options extends FragmentOptions {
defaultValue = "strict",
converter = BuildConfiguration.StrictDepsConverter.class,
category = "semantics",
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
documentationCategory = OptionDocumentationCategory.INPUT_STRICTNESS,
effectTags = {OptionEffectTag.BUILD_FILE_SEMANTICS, OptionEffectTag.EAGERNESS_TO_EXIT},
metadataTags = {OptionMetadataTag.INCOMPATIBLE_CHANGE},
help =
"If true, checks that a proto_library target explicitly declares all directly "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ public enum OptionDocumentationCategory {
/** This option's primary purpose is to affect the verbosity, format or location of logging. */
LOGGING,

/**
* This option affects how strictly Bazel enforces valid build inputs (rule definitions,
* flag combinations, etc).
*/
INPUT_STRICTNESS,

/** This option deals with how to go about executing the build. */
EXECUTION_STRATEGY,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,12 @@ public enum OptionEffectTag {

/**
* This option is used to change command line arguments of one or more actions during the build.
*
* <p>Even though many options implicitly change command line arguments because they change
* configured target analysis, this setting is intended for options specifically meant for
* for that purpose.
*/
ACTION_OPTIONS(13),
ACTION_COMMAND_LINES(13),

/** This option is used to change the testrunner environment of the build. */
TEST_RUNNER(14);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,19 @@ public class OptionFilterDescriptions {

/** The order that the categories should be listed in. */
static OptionDocumentationCategory[] documentationOrder = {
OptionDocumentationCategory.BAZEL_CLIENT_OPTIONS,
OptionDocumentationCategory.EXECUTION_STRATEGY,
OptionDocumentationCategory.TOOLCHAIN,
OptionDocumentationCategory.OUTPUT_SELECTION,
OptionDocumentationCategory.OUTPUT_PARAMETERS,
OptionDocumentationCategory.SIGNING,
OptionDocumentationCategory.TESTING,
OptionDocumentationCategory.QUERY,
OptionDocumentationCategory.BUILD_TIME_OPTIMIZATION,
OptionDocumentationCategory.LOGGING,
OptionDocumentationCategory.GENERIC_INPUTS,
OptionDocumentationCategory.UNCATEGORIZED
OptionDocumentationCategory.BAZEL_CLIENT_OPTIONS,
OptionDocumentationCategory.EXECUTION_STRATEGY,
OptionDocumentationCategory.TOOLCHAIN,
OptionDocumentationCategory.OUTPUT_SELECTION,
OptionDocumentationCategory.OUTPUT_PARAMETERS,
OptionDocumentationCategory.INPUT_STRICTNESS,
OptionDocumentationCategory.SIGNING,
OptionDocumentationCategory.TESTING,
OptionDocumentationCategory.QUERY,
OptionDocumentationCategory.BUILD_TIME_OPTIMIZATION,
OptionDocumentationCategory.LOGGING,
OptionDocumentationCategory.GENERIC_INPUTS,
OptionDocumentationCategory.UNCATEGORIZED
};

static ImmutableMap<OptionDocumentationCategory, String> getOptionCategoriesEnumDescription(
Expand Down Expand Up @@ -64,6 +65,10 @@ static ImmutableMap<OptionDocumentationCategory, String> getOptionCategoriesEnum
OptionDocumentationCategory.OUTPUT_PARAMETERS,
"Options that let the user configure the intended output, affecting its value, as "
+ "opposed to its existence")
.put(
OptionDocumentationCategory.INPUT_STRICTNESS,
"Options that affect how strictly Bazel enforces valid build inputs (rule definitions, "
+ " flag combinations, etc.)")
.put(
OptionDocumentationCategory.SIGNING,
"Options that affect the signing outputs of a build")
Expand Down Expand Up @@ -140,7 +145,7 @@ public static ImmutableMap<OptionEffectTag, String> getOptionEffectTagDescriptio
OptionEffectTag.TERMINAL_OUTPUT,
"This option affects " + productName + "'s terminal output.")
.put(
OptionEffectTag.ACTION_OPTIONS,
OptionEffectTag.ACTION_COMMAND_LINES,
"This option changes the command line arguments of one or more build actions.")
.put(
OptionEffectTag.TEST_RUNNER,
Expand Down
2 changes: 1 addition & 1 deletion src/main/protobuf/option_filters.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ enum OptionEffectTag {
EAGERNESS_TO_EXIT = 10;
BAZEL_MONITORING = 11;
TERMINAL_OUTPUT = 12;
ACTION_OPTIONS = 13;
ACTION_COMMAND_LINES = 13;
TEST_RUNNER = 14;
}

Expand Down
Loading

0 comments on commit e1b09f2

Please sign in to comment.