aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main
diff options
context:
space:
mode:
authorGravatar cushon <cushon@google.com>2018-06-28 01:58:56 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-28 02:00:19 -0700
commit02642c20fb2799d2b609cf9cd42f489e62fc0e01 (patch)
tree4939dfba914a92bd5e7d08e554337eef666e9bde /src/main
parent4adcf224c481ac96c0b6827eb480f6fd58250357 (diff)
Automated rollback of commit 1f319fffb8a577be95e8143c21755fe55156a0cb.
*** Reason for rollback *** fix forward *** Original change description *** PiperOrigin-RevId: 202441346
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/ShellConfiguration.java24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/ShellConfiguration.java b/src/main/java/com/google/devtools/build/lib/analysis/ShellConfiguration.java
index f2dd58db01..2fab7708d1 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/ShellConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/ShellConfiguration.java
@@ -27,6 +27,7 @@ import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.common.options.Option;
import com.google.devtools.common.options.OptionDocumentationCategory;
import com.google.devtools.common.options.OptionEffectTag;
+import com.google.devtools.common.options.OptionMetadataTag;
import java.io.Serializable;
import javax.annotation.Nullable;
@@ -40,15 +41,21 @@ public class ShellConfiguration extends BuildConfiguration.Fragment {
.build();
private final PathFragment shellExecutable;
+ private final boolean useShBinaryStubScript;
- public ShellConfiguration(PathFragment shellExecutable) {
+ public ShellConfiguration(PathFragment shellExecutable, boolean useShBinaryStubScript) {
this.shellExecutable = shellExecutable;
+ this.useShBinaryStubScript = useShBinaryStubScript;
}
public PathFragment getShellExecutable() {
return shellExecutable;
}
+ public boolean useShBinaryStubScript() {
+ return useShBinaryStubScript;
+ }
+
/** An option that tells Bazel where the shell is. */
@AutoCodec(strategy = AutoCodec.Strategy.PUBLIC_FIELDS)
public static class Options extends FragmentOptions {
@@ -69,10 +76,20 @@ public class ShellConfiguration extends BuildConfiguration.Fragment {
)
public PathFragment shellExecutable;
+ @Option(
+ name = "experimental_use_sh_binary_stub_script",
+ documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
+ effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
+ metadataTags = {OptionMetadataTag.EXPERIMENTAL},
+ defaultValue = "false",
+ help = "If enabled, use a stub script for sh_binary targets.")
+ public boolean useShBinaryStubScript;
+
@Override
public Options getHost() {
Options host = (Options) getDefault();
host.shellExecutable = shellExecutable;
+ host.useShBinaryStubScript = useShBinaryStubScript;
return host;
}
}
@@ -101,7 +118,10 @@ public class ShellConfiguration extends BuildConfiguration.Fragment {
@Nullable
@Override
public Fragment create(BuildOptions buildOptions) {
- return new ShellConfiguration(shellExecutableProvider.getShellExecutable(buildOptions));
+ Options options = buildOptions.get(Options.class);
+ return new ShellConfiguration(
+ shellExecutableProvider.getShellExecutable(buildOptions),
+ options != null && options.useShBinaryStubScript);
}
public static PathFragment determineShellExecutable(