diff options
author | 2018-01-23 00:19:46 -0800 | |
---|---|---|
committer | 2018-01-23 00:21:44 -0800 | |
commit | b7272ecaab7eada2f1846597dc5bacc82d2c8821 (patch) | |
tree | 69c9816a13c92dfd8526814ff3a5b2bdd8726d52 /src/test/shell/bazel/external_integration_test.sh | |
parent | 40dc4b9372962a2c0de13ff3dbe7735fa0dff07a (diff) |
http_archive: allow using the shipped BUILD file
Bazel may also depend on external repositories that already contain
build files. When using http_archive from @bazel_tools also support
that use case, by supporting simply omitting `build_file` and
`build_file_contents`.
Change-Id: I40a9b85ae0aba850c73104d2e2fe7f7ee814e093
PiperOrigin-RevId: 182893460
Diffstat (limited to 'src/test/shell/bazel/external_integration_test.sh')
-rwxr-xr-x | src/test/shell/bazel/external_integration_test.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/test/shell/bazel/external_integration_test.sh b/src/test/shell/bazel/external_integration_test.sh index 49b9471857..ff3e0c4041 100755 --- a/src/test/shell/bazel/external_integration_test.sh +++ b/src/test/shell/bazel/external_integration_test.sh @@ -953,6 +953,7 @@ function test_missing_build() { mkdir ext echo foo> ext/foo EXTREPODIR=`pwd` + rm -f ext.zip zip ext.zip ext/* rm -rf ext @@ -998,4 +999,36 @@ EOF bazel build //:localfoo || fail 'Expected success' } + +function test_inherit_build() { + # Verify that http_archive can use a BUILD file shiped with the + # external archive. + mkdir ext + cat > ext/BUILD <<'EOF' +genrule( + name="hello", + outs=["hello.txt"], + cmd="echo Hello World > $@", +) +EOF + EXTREPODIR=`pwd` + rm -f ext.zip + zip ext.zip ext/* + rm -rf ext + + rm -rf main + mkdir main + cd main + cat > WORKSPACE <<EOF +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +http_archive( + name="ext", + strip_prefix="ext", + urls=["file://${EXTREPODIR}/ext.zip"], +) +EOF + + bazel build '@ext//:hello' || fail "expected success" +} + run_suite "external tests" |