aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/shell/bazel/external_integration_test.sh
diff options
context:
space:
mode:
authorGravatar jcater <jcater@google.com>2017-03-30 20:09:33 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2017-03-31 17:11:00 +0200
commit18a4c841d48df2eb52f27817ed566833809a92cc (patch)
tree7d2963e4e82f34f1cf4d039e6d8e62df4e8874a1 /src/test/shell/bazel/external_integration_test.sh
parent63111882e794f786ab857c92b01383a457e843a4 (diff)
Add workspace_file and workspace_file_content attributes to new_foo_repository rules.
Change-Id: Iadcc24bb2a207126cec9aa31faba6d76ee80da41 PiperOrigin-RevId: 151739968
Diffstat (limited to 'src/test/shell/bazel/external_integration_test.sh')
-rwxr-xr-xsrc/test/shell/bazel/external_integration_test.sh57
1 files changed, 35 insertions, 22 deletions
diff --git a/src/test/shell/bazel/external_integration_test.sh b/src/test/shell/bazel/external_integration_test.sh
index 21d5c0dcf4..c37200c6e5 100755
--- a/src/test/shell/bazel/external_integration_test.sh
+++ b/src/test/shell/bazel/external_integration_test.sh
@@ -510,6 +510,14 @@ function test_new_remote_repo_with_build_file_content() {
do_new_remote_repo_test "build_file_content"
}
+function test_new_remote_repo_with_workspace_file() {
+ do_new_remote_repo_test "workspace_file"
+}
+
+function test_new_remote_repo_with_workspace_file_content() {
+ do_new_remote_repo_test "workspace_file_content"
+}
+
function do_new_remote_repo_test() {
# Create a zipped-up repository HTTP response.
local repo2=$TEST_TMPDIR/repo2
@@ -526,38 +534,43 @@ function do_new_remote_repo_test() {
cd ${WORKSPACE_DIR}
- if [ "$1" = "build_file" ] ; then
- cat > fox.BUILD <<EOF
+ # Create the build file for the http archive based on the requested attr style.
+ local build_file_attr=""
+ local workspace_file_attr=""
+
+ local build_file_content="
filegroup(
- name = "fox",
- srcs = ["fox/male"],
- visibility = ["//visibility:public"],
+ name = \"fox\",
+ srcs = [\"fox/male\"],
+ visibility = [\"//visibility:public\"],
)
-EOF
+ "
- cat > WORKSPACE <<EOF
-new_http_archive(
- name = 'endangered',
- url = 'http://localhost:$nc_port/repo.zip',
- sha256 = '$sha256',
- build_file = 'fox.BUILD'
-)
-EOF
+ if [ "$1" = "build_file" ] ; then
+ echo ${build_file_content} > fox.BUILD
+ build_file_attr="build_file = 'fox.BUILD'"
else
- cat > WORKSPACE <<EOF
+ build_file_attr="build_file_content=\"\"\"${build_file_content}\"\"\""
+ fi
+
+ if [ "$1" = "workspace_file" ]; then
+ cat > fox.WORKSPACE <<EOF
+workspace(name="endangered-fox")
+EOF
+ workspace_file_attr="workspace_file = 'fox.WORKSPACE'"
+ elif [ "$1" = "workspace_file_content" ]; then
+ workspace_file_attr="workspace_file_content = 'workspace(name=\"endangered-fox\")'"
+ fi
+
+ cat > WORKSPACE <<EOF
new_http_archive(
name = 'endangered',
url = 'http://localhost:$nc_port/repo.zip',
sha256 = '$sha256',
- build_file_content = """
-filegroup(
- name = "fox",
- srcs = ["fox/male"],
- visibility = ["//visibility:public"],
-)"""
+ ${build_file_attr},
+ ${workspace_file_attr}
)
EOF
- fi
mkdir -p zoo
cat > zoo/BUILD <<EOF