aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Philipp Wollermann <philwo@google.com>2016-06-21 14:58:09 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2016-06-21 15:04:52 +0000
commita5afe95e471827ab636a249fb0fd4a11076548e9 (patch)
tree2dc8f85279ee37e15131d5b5d382d1c3ebfe4b70 /tools
parentb5a06f3362b430d0f51d1f4da646f2de901e5707 (diff)
Replace #!/bin/bash -eu with #!/bin/bash and "set -eu". Otherwise, the "-eu" is not picked up when you run the scripts manually using "bash script.sh".
This is also in our shell style guide: "Executables must start with #!/bin/bash and a minimum number of flags. Use set to set shell options so that calling your script as bash <script_name> does not break its functionality." -- MOS_MIGRATED_REVID=125450962
Diffstat (limited to 'tools')
-rw-r--r--tools/android/android_sdk_repository_template.bzl45
-rw-r--r--tools/build_defs/docker/incremental_load.sh.tpl4
2 files changed, 27 insertions, 22 deletions
diff --git a/tools/android/android_sdk_repository_template.bzl b/tools/android/android_sdk_repository_template.bzl
index 1d09d4fbff..343d12546c 100644
--- a/tools/android/android_sdk_repository_template.bzl
+++ b/tools/android/android_sdk_repository_template.bzl
@@ -186,27 +186,30 @@ def create_android_sdk_rules(
])
)
- [native.genrule(
- name = tool + "_runner",
- outs = [tool + "_runner.sh"],
- srcs = [],
- cmd = "\n".join(["cat > $@ << 'EOF'",
- "#!/bin/bash -eu",
- # The tools under build-tools/VERSION require the libraries under build-tools/VERSION/lib,
- # so we can't simply depend on them as a file like we do with aapt.
- "SDK=$${0}.runfiles/%s" % name,
- "exec $${SDK}/build-tools/%s/%s $$*" % (build_tools_directory, tool),
- "EOF\n"]),
- ) for tool in ["aapt", "aidl", "zipalign"]]
-
- [native.sh_binary(
- name = tool + "_binary",
- srcs = [tool + "_runner.sh"],
- data = [
- ":build_tools_libs",
- "build-tools/%s/%s" % (build_tools_directory, tool)
- ],
- ) for tool in ["aapt", "aidl", "zipalign"]]
+ for tool in ["aapt", "aidl", "zipalign"]:
+ native.genrule(
+ name = tool + "_runner",
+ outs = [tool + "_runner.sh"],
+ srcs = [],
+ cmd = "\n".join([
+ "cat > $@ << 'EOF'",
+ "#!/bin/bash",
+ "set -eu",
+ # The tools under build-tools/VERSION require the libraries under build-tools/VERSION/lib,
+ # so we can't simply depend on them as a file like we do with aapt.
+ "SDK=$${0}.runfiles/%s" % name,
+ "exec $${SDK}/build-tools/%s/%s $$*" % (build_tools_directory, tool),
+ "EOF\n"]),
+ )
+
+ native.sh_binary(
+ name = tool + "_binary",
+ srcs = [tool + "_runner.sh"],
+ data = [
+ ":build_tools_libs",
+ "build-tools/%s/%s" % (build_tools_directory, tool)
+ ],
+ )
native.sh_binary(
name = "fail",
diff --git a/tools/build_defs/docker/incremental_load.sh.tpl b/tools/build_defs/docker/incremental_load.sh.tpl
index 5ca164df05..50ce4dbd34 100644
--- a/tools/build_defs/docker/incremental_load.sh.tpl
+++ b/tools/build_defs/docker/incremental_load.sh.tpl
@@ -1,4 +1,4 @@
-#!/bin/bash -eu
+#!/bin/bash
#
# Copyright 2015 The Bazel Authors. All rights reserved.
#
@@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+set -eu
+
# This is a generated file that loads all docker layers built by "docker_build".
RUNFILES="${PYTHON_RUNFILES:-${BASH_SOURCE[0]}.runfiles}"