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 Dec 7, 2021
1 parent 9eb40d6 commit 3a1795e
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 @@ -689,6 +689,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 @@ -827,6 +827,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 configuration.")
public boolean experimentalShareableCppCompileActions;

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

// === Runfiles ===
host.buildRunfilesManifests = buildRunfilesManifests;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,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 3a1795e

Please sign in to comment.