diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | BUILD | 1 | ||||
-rw-r--r-- | WORKSPACE | 24 | ||||
-rwxr-xr-x | compile.sh | 2 | ||||
-rwxr-xr-x | scripts/workspace_user.sh | 76 | ||||
-rwxr-xr-x | src/test/shell/bazel/android/android_integration_test.sh | 12 |
6 files changed, 16 insertions, 100 deletions
diff --git a/.gitignore b/.gitignore index a345b8813d..62dc648893 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,6 @@ /.idea/ /.project /.settings -/WORKSPACE.user.bzl /bazel.iml # Ignore all bazel-* symlinks. There is no full list since this can change # based on the name of the directory bazel is cloned into. @@ -37,7 +37,6 @@ filegroup( "bazel-*", # convenience symlinks "out", # IntelliJ with setup-intellij.sh "output", # output of compile.sh - "WORKSPACE.user.bzl", # generated workspace file ".*", # mainly .git* files ], ) + [ @@ -8,17 +8,6 @@ bind( actual = "//:dummy", ) -# Bind to dummy targets if no android SDK/NDK is present. -bind( - name = "android_sdk_for_testing", - actual = "//:dummy", -) - -bind( - name = "android_ndk_for_testing", - actual = "//:dummy", -) - # Protobuf code generation for GRPC requires three external labels: # //external:grpc-java_plugin # //external:grpc-jar @@ -42,10 +31,15 @@ bind( load("//tools/cpp/test:docker_repository.bzl", "docker_repository") docker_repository() -# In order to run the Android integration tests, run -# scripts/workspace_user.sh and uncomment the next two lines. -# load("/WORKSPACE.user", "android_repositories") -# android_repositories() +# To run the Android integration tests in //src/test/shell/bazel/android:all or +# build the Android sample app in //examples/android/java/bazel:hello_world +# +# 1. Install an Android SDK and NDK from https://developer.android.com +# 2. Set the $ANDROID_HOME and $ANDROID_NDK_HOME environment variables +# 3. Uncomment the two lines below +# +# android_sdk_repository(name = "androidsdk") +# android_ndk_repository(name = "androidndk") # In order to run //src/test/shell/bazel:maven_skylark_test, follow the # instructions above for the Android integration tests and uncomment the diff --git a/compile.sh b/compile.sh index 2b5c073f43..7d9be4cbb1 100755 --- a/compile.sh +++ b/compile.sh @@ -179,7 +179,7 @@ if [ $DO_SRCS_TEST ]; then # See file BUILD for the list of grep -v exceptions. # tools/defaults package is hidden by Bazel so cannot be put in the srcs. find . -type f | sed -e 's|./||' \ - | grep -v '^bazel-' | grep -v '^WORKSPACE.user.bzl' \ + | grep -v '^bazel-' \ | grep -v '^\.' | grep -v '^out/' | grep -v '^output/' \ | grep -v '^derived' \ | grep -Ev "${SRCS_EXCLUDES}" \ diff --git a/scripts/workspace_user.sh b/scripts/workspace_user.sh deleted file mode 100755 index 4ad5ab8a79..0000000000 --- a/scripts/workspace_user.sh +++ /dev/null @@ -1,76 +0,0 @@ -#! /usr/bin/env bash -# -# Copyright 2016 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This script locates the android sdk (via ANDROID_HOME) and ndk -# (via ANDROID_NDK) on your system, and writes a WORKSPACE.user.bzl -# that points to them. - -set -euo pipefail - -while [ ! -f WORKSPACE ]; do - cd .. - if [ "/" = $(pwd) ] - then - echo "WORKSPACE not found." 1>&2 - exit 1 - fi -done - -function highest_api_level() { - ls $ANDROID_HOME/platforms | cut -d '-' -f 2 | sort -n | tail -n 1 -} - -if [ -n "${ANDROID_HOME:-}" ]; then - : ${ANDROID_API_LEVEL:=$(highest_api_level)} - cat <<EOF >WORKSPACE.user.bzl -def android_sdk(): - native.android_sdk_repository( - name = "androidsdk", - path = "${ANDROID_HOME}", - # Available versions are under /path/to/sdk/platforms/. - api_level = ${ANDROID_API_LEVEL}, - ) - native.bind(name = "android_sdk_for_testing", actual = "@androidsdk//:files") -EOF -else - cat <<EOF >WORKSPACE.user.bzl -def android_sdk(): - native.bind(name = "android_sdk_for_testing", actual = "//:dummy") -EOF -fi - -if [ -n "${ANDROID_NDK:-}" ]; then - cat <<EOF >>WORKSPACE.user.bzl -def android_ndk(): - native.android_ndk_repository( - name = "androidndk", - path = "${ANDROID_NDK}", - api_level = ${ANDROID_API_LEVEL}, - ) - native.bind(name = "android_ndk_for_testing", actual = "@androidndk//:files") -EOF -else - cat <<EOF >>WORKSPACE.user.bzl -def android_ndk(): - native.bind(name = "android_ndk_for_testing", actual = "//:dummy") -EOF -fi - -cat <<EOF >>WORKSPACE.user.bzl -def android_repositories(): - android_sdk() - android_ndk() -EOF diff --git a/src/test/shell/bazel/android/android_integration_test.sh b/src/test/shell/bazel/android/android_integration_test.sh index 35e9280874..783de96170 100755 --- a/src/test/shell/bazel/android/android_integration_test.sh +++ b/src/test/shell/bazel/android/android_integration_test.sh @@ -14,12 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -# For this tests to run do the following: -# 1. Uncomment the 2 lines regarding android integration tests in the WORKSPACE -# file. -# 2. Set the environment variables ANDROID_HOME and ANDROID_NDK accordingly to -# your Android SDK and NDK home directories. -# 3. Run scripts/workspace_user.sh. +# For these tests to run do the following: +# +# 1. Install an Android SDK and NDK from https://developer.android.com +# 2. Set the $ANDROID_HOME and $ANDROID_NDK_HOME environment variables +# 3. Uncomment the two lines in WORKSPACE containing android_sdk_repository +# and android_ndk_repository # # Note that if the environment is not set up as above android_integration_test # will silently be ignored and will be shown as passing. |