Skip to content

Commit

Permalink
Add check that NativeAndStarlarkFlags actually contains flags.
Browse files Browse the repository at this point in the history
Part of fixing bazelbuild#23147.

Closes bazelbuild#23157.

PiperOrigin-RevId: 658001205
Change-Id: Ibf85095d66f70ebcf078bd7f6da108bab37746f1
  • Loading branch information
katre authored and copybara-github committed Jul 31, 2024
1 parent d2eeed4 commit 5a8280a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private StateMachine finishConfigurationKeyProcessing(BuildConfigurationKey newC
private BuildConfigurationKey applyFlagsForOptions(BuildOptions options)
throws OptionsParsingException {
// Does the target platform provide any flags?
if (this.platformFlags != null) {
if (this.platformFlags != null && !this.platformFlags.isEmpty()) {
OptionsParsingResult parsingResult = platformFlags.parse();
BuildOptions updatedOptions = options.applyParsingResult(parsingResult);
return BuildConfigurationKey.create(updatedOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ public static Builder builder() {
@Nullable
abstract RepositoryMapping repoMapping();

public boolean isEmpty() {
return nativeFlags().isEmpty() && starlarkFlags().isEmpty();
}

public OptionsParsingResult parse() throws OptionsParsingException {
OptionsParser parser =
OptionsParser.builder()
Expand Down

0 comments on commit 5a8280a

Please sign in to comment.