-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up uses of an "empty" BuildOptions.
Work towards platform-based flags: #19409. PiperOrigin-RevId: 569576336 Change-Id: I7c7f37c833987aed83b04aaddac234ef3b17de2e
- Loading branch information
1 parent
0656103
commit 0626570
Showing
5 changed files
with
56 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/com/google/devtools/build/lib/analysis/config/CommonOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2023 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
package com.google.devtools.build.lib.analysis.config; | ||
|
||
import com.google.devtools.common.options.Options; | ||
|
||
/** Common sets of option objects for use in core processing. */ | ||
public final class CommonOptions { | ||
|
||
// Ideally the empty build options should be actually empty: no fragment options and no flags. But | ||
// core Bazel | ||
// code assumes CoreOptions exists. For example CoreOptions.check_visibility is required for | ||
// basic configured target graph evaluation. So we provide CoreOptions with default values | ||
// (not inherited from parent configuration). This means flags like --check_visibility may not | ||
// be consistently applied. If this becomes a problem in practice we can carve out exceptions | ||
// to flags like that to propagate. | ||
// TODO(bazel-team): break out flags that configure Bazel's analysis phase into their own | ||
// FragmentOptions and propagate them to this configuration. Those flags should also be | ||
// ineligible outputs for other transitions because they're not meant for rule logic. That | ||
// would guarantee consistency of flags like --check_visibility while still preventing forking. | ||
public static final BuildOptions EMPTY_OPTIONS = | ||
BuildOptions.builder().addFragmentOptions(Options.getDefaults(CoreOptions.class)).build(); | ||
|
||
private CommonOptions() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters