Skip to content

Commit

Permalink
Match options against parsing result.
Browse files Browse the repository at this point in the history
    Checks whether an existing build options matches a set of flags provided through an option parser (for example from the command line or a file).

    Step 2/N towards the platforms mapping functionality for bazelbuild/bazel#6426

    RELNOTES: None.
    PiperOrigin-RevId: 238085427
  • Loading branch information
Luca Di Grazia committed Sep 4, 2022
1 parent dd56bdb commit 1c6979e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,6 @@ public Collection<FragmentOptions> getNativeOptions() {
return fragmentOptionsMap.values();
}

/** Returns the set of fragment classes contained in these options. */
public Set<Class<? extends FragmentOptions>> getFragmentClasses() {
return fragmentOptionsMap.keySet();
}

public ImmutableMap<Label, Object> getStarlarkOptions() {
return skylarkOptionsMap;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,19 +389,6 @@ public void parsingResultTransformIllegalStarlarkLabel() throws Exception {
assertThrows(IllegalArgumentException.class, () -> original.applyParsingResult(parser));
}

@Test
public void parsingResultTransformMultiValueOption() throws Exception {
BuildOptions original = BuildOptions.of(BUILD_CONFIG_OPTIONS);

OptionsParser parser = OptionsParser.newOptionsParser(BUILD_CONFIG_OPTIONS);
parser.parse("--features=foo");

BuildOptions modified = original.applyParsingResult(parser);

assertThat(modified.get(BuildConfiguration.Options.class).defaultFeatures)
.containsExactly("foo");
}

@Test
public void parsingResultMatch() throws Exception {
BuildOptions original = BuildOptions.of(BUILD_CONFIG_OPTIONS, "--cpu=foo", "--stamp");
Expand Down

0 comments on commit 1c6979e

Please sign in to comment.