aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google
diff options
context:
space:
mode:
authorGravatar Julio Merino <jmmv@google.com>2016-06-21 12:47:37 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2016-06-21 14:47:33 +0000
commit0c0bfe6297bdc6c061a88c91c4eaff1776f6ef23 (patch)
tree7f6f36a8940632baea20e01b7e0c2492710e26d2 /src/main/java/com/google
parentff43ef42fdbbf57f4551085012a3f7077ac99222 (diff)
Allow any filename in the srcs attribute of the sh_* rules.
There is no reason for shell scripts to end in .sh or .bash: shell scripts can, and often do, have no extension because they are intended to be directly runnable from the source tree. Therefore, change the sh_* rules to allow any filename in their srcs attribute. -- MOS_MIGRATED_REVID=125442088
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShLibraryRule.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShRuleClasses.java5
2 files changed, 3 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShLibraryRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShLibraryRule.java
index bfde7bb583..ad95e47546 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShLibraryRule.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShLibraryRule.java
@@ -21,6 +21,7 @@ import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
import com.google.devtools.build.lib.bazel.rules.sh.BazelShRuleClasses.ShRule;
import com.google.devtools.build.lib.packages.RuleClass;
import com.google.devtools.build.lib.packages.RuleClass.Builder;
+import com.google.devtools.build.lib.util.FileTypeSet;
/**
* Rule definition for the sh_library rule.
@@ -37,7 +38,7 @@ public final class BazelShLibraryRule implements RuleDefinition {
or <code>.</code> command.
</p>
<!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .override(attr("srcs", LABEL_LIST).allowedFileTypes(BazelShRuleClasses.SH_FILES))
+ .override(attr("srcs", LABEL_LIST).allowedFileTypes(FileTypeSet.ANY_FILE))
.build();
}
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShRuleClasses.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShRuleClasses.java
index d0740e54aa..d92f819027 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShRuleClasses.java
@@ -27,7 +27,6 @@ import com.google.devtools.build.lib.packages.PredicateWithMessage;
import com.google.devtools.build.lib.packages.RuleClass;
import com.google.devtools.build.lib.packages.RuleClass.Builder;
import com.google.devtools.build.lib.packages.RuleClass.Builder.RuleClassType;
-import com.google.devtools.build.lib.util.FileType;
import com.google.devtools.build.lib.util.FileTypeSet;
import java.util.Collection;
@@ -43,8 +42,6 @@ public final class BazelShRuleClasses {
static final Collection<String> ALLOWED_RULES_IN_DEPS_WITH_WARNING = ImmutableSet.of(
"filegroup", "genrule", "sh_binary", "sh_test", "test_suite");
- static final FileTypeSet SH_FILES = FileTypeSet.of(FileType.of(".sh"), FileType.of(".bash"));
-
/**
* Common attributes for shell rules.
*/
@@ -63,7 +60,7 @@ public final class BazelShRuleClasses {
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(attr("srcs", LABEL_LIST)
.mandatory()
- .allowedFileTypes(SH_FILES))
+ .allowedFileTypes(FileTypeSet.ANY_FILE))
/* <!-- #BLAZE_RULE($sh_target).ATTRIBUTE(deps) -->
The list of "library" targets to be aggregated into this target.
See general comments about <code>deps</code>