File tree Expand file tree Collapse file tree 6 files changed +43
-9
lines changed
Expand file tree Collapse file tree 6 files changed +43
-9
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,14 @@ set -eu
1919# This is a generated file that loads all docker layers built by "docker_build".
2020
2121function guess_runfiles() {
22- pushd ${BASH_SOURCE[0]} .runfiles > /dev/null 2>&1
23- pwd
24- popd > /dev/null 2>&1
22+ if [ -d ${BASH_SOURCE[0]} .runfiles ]; then
23+ # Runfiles are adjacent to the current script.
24+ echo " $( cd ${BASH_SOURCE[0]} .runfiles && pwd ) "
25+ else
26+ # The current script is within some other script's runfiles.
27+ mydir=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
28+ echo $mydir | sed -e ' s|\(.*\.runfiles\)/.*|\1|'
29+ fi
2530}
2631
2732RUNFILES=" ${PYTHON_RUNFILES:- $(guess_runfiles)} "
Original file line number Diff line number Diff line change 1616set -eu
1717
1818function guess_runfiles() {
19- pushd ${BASH_SOURCE[0]} .runfiles > /dev/null 2>&1
20- pwd
21- popd > /dev/null 2>&1
19+ if [ -d ${BASH_SOURCE[0]} .runfiles ]; then
20+ # Runfiles are adjacent to the current script.
21+ echo " $( cd ${BASH_SOURCE[0]} .runfiles && pwd ) "
22+ else
23+ # The current script is within some other script's runfiles.
24+ mydir=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
25+ echo $mydir | sed -e ' s|\(.*\.runfiles\)/.*|\1|'
26+ fi
2227}
2328
2429RUNFILES=" ${PYTHON_RUNFILES:- $(guess_runfiles)} "
Original file line number Diff line number Diff line change 1515
1616set -eu
1717function guess_runfiles() {
18- pushd ${BASH_SOURCE[0]} .runfiles > /dev/null 2>&1
19- pwd
20- popd > /dev/null 2>&1
18+ if [ -d ${BASH_SOURCE[0]} .runfiles ]; then
19+ # Runfiles are adjacent to the current script.
20+ echo " $( cd ${BASH_SOURCE[0]} .runfiles && pwd ) "
21+ else
22+ # The current script is within some other script's runfiles.
23+ mydir=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
24+ echo $mydir | sed -e ' s|\(.*\.runfiles\)/.*|\1|'
25+ fi
2126}
2227
2328RUNFILES=" ${PYTHON_RUNFILES:- $(guess_runfiles)} "
Original file line number Diff line number Diff line change @@ -778,6 +778,14 @@ cc_image(
778778 binary = ":cc_binary" ,
779779)
780780
781+ # Test that we can also load image from within another script.
782+ sh_binary (
783+ name = "cc_image_wrapper" ,
784+ srcs = ["cc_image_wrapper.sh" ],
785+ args = ["$(location :cc_image)" ],
786+ data = [":cc_image" ],
787+ )
788+
781789load (
782790 "//java:image.bzl" ,
783791 "java_image" ,
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -euo pipefail
3+
4+ " $1 " || { echo " FAIL!" ; exit 1; }
Original file line number Diff line number Diff line change @@ -233,6 +233,12 @@ function test_cc_binary_as_image() {
233233 EXPECT_CONTAINS " $( bazel run " $@ " testdata:cc_binary_as_image) " " Hello World"
234234}
235235
236+ function test_cc_image_wrapper() {
237+ cd " ${ROOT} "
238+ clear_docker
239+ EXPECT_CONTAINS " $( bazel run " $@ " testdata:cc_image_wrapper) " " Hello World"
240+ }
241+
236242function test_go_image() {
237243 cd " ${ROOT} "
238244 clear_docker
@@ -375,6 +381,7 @@ test_cc_image -c opt
375381test_cc_image -c dbg
376382test_cc_binary_as_image -c opt
377383test_cc_binary_as_image -c dbg
384+ test_cc_image_wrapper
378385test_go_image -c opt
379386test_go_image -c dbg
380387test_go_image_busybox
You can’t perform that action at this time.
0 commit comments