Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add experimental flag to make cpp compile actions shareable #16863

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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