aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2015-09-25 12:29:26 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-09-25 14:42:46 +0000
commit94e7d1a6d3ca45787f8b7ea659377c71cbc454ec (patch)
tree2f5543edc046c40db97b0296f0f73996163e708b /src/main/java/com
parent1c07e325fd073cb1d801098507e658f160750df3 (diff)
Do not hardcode the path to genrule-setup.sh in the implementation of genrule.
I don't know why it was implemented like that in the first place. -- MOS_MIGRATED_REVID=103934038
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRule.java7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRule.java
index 1b6284c056..3f931e2842 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRule.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRule.java
@@ -50,9 +50,6 @@ import java.util.Map;
*/
public class GenRule implements RuleConfiguredTargetFactory {
- public static final String GENRULE_SETUP_CMD =
- "source tools/genrule/genrule-setup.sh; ";
-
private Artifact getExecutable(RuleContext ruleContext, NestedSet<Artifact> filesToBuild) {
if (Iterables.size(filesToBuild) == 1) {
Artifact out = Iterables.getOnlyElement(filesToBuild);
@@ -99,7 +96,9 @@ public class GenRule implements RuleConfiguredTargetFactory {
ruleContext.attributes().get("heuristic_label_expansion", Type.BOOLEAN), false);
// Adds the genrule environment setup script before the actual shell command
- String command = GENRULE_SETUP_CMD + baseCommand;
+ String command = String.format("source %s; %s",
+ ruleContext.getPrerequisiteArtifact("$genrule_setup", Mode.HOST).getExecPath(),
+ baseCommand);
command = resolveCommand(ruleContext, command, resolvedSrcs, filesToBuild);