Skip to content

Commit

Permalink
Add experimental flag to make cpp compile actions shareable
Browse files Browse the repository at this point in the history
  • Loading branch information
torgil committed Nov 28, 2022
1 parent 6d07ee5 commit d178082
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,10 @@ public BuildOptions getOptions() {
return buildOptions;
}

public CoreOptions getCoreOptions() {
return options;
}

public String getCpu() {
return options.cpu;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,16 @@ public OutputPathsConverter() {
+ " of failing. This is to help use cquery diagnose failures in select.")
public boolean debugSelectsAlwaysSucceed;

@Option(
name = "experimental_shareable_cpp_compile_actions",
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.BAZEL_INTERNAL_CONFIGURATION},
help =
"If true, cpp actions will be shareable. This will make Bazel not fail with action"
+ " conflicts if it finds two identical actions with different configurations.")
public boolean experimentalShareableCppCompileActions;

/** Ways configured targets may provide the {@link Fragment}s they require. */
public enum IncludeConfigFragmentsEnum {
/**
Expand Down Expand Up @@ -936,6 +946,7 @@ public FragmentOptions getHost() {
host.includeRequiredConfigFragmentsProvider = includeRequiredConfigFragmentsProvider;
host.debugSelectsAlwaysSucceed = debugSelectsAlwaysSucceed;
host.checkTestonlyForOutputFiles = checkTestonlyForOutputFiles;
host.experimentalShareableCppCompileActions = experimentalShareableCppCompileActions;

// === Runfiles ===
host.buildRunfilesManifests = buildRunfilesManifests;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public CppCompileActionBuilder(
CcToolchainProvider ccToolchain,
BuildConfigurationValue configuration) {
this.owner = actionConstructionContext.getActionOwner();
this.shareable = false;
this.shareable = configuration.getCoreOptions().experimentalShareableCppCompileActions;
this.configuration = configuration;
this.cppConfiguration = configuration.getFragment(CppConfiguration.class);
this.mandatoryInputsBuilder = NestedSetBuilder.stableOrder();
Expand Down

0 comments on commit d178082

Please sign in to comment.