Skip to content

Commit

Permalink
Simplify the steps needed to run android_integration_test.
Browse files Browse the repository at this point in the history
As of Bazel 0.4.5, the android_sdk_for_test and android_ndk_for_test are bound in android.WORKSPACE, so we do not need to include them in the main Bazel WORKSPACE file. I've update the comments to reflect that all that is needed to run the tests is android_sdk_repository and android_ndk_repository and the environment variables that they read.

Also, delete scripts/workspace_user.sh. All of its functionality (reading environment variables, detecting api levels, build tools versions) is now part of android_{s,n}dk_repository.

Fixes bazelbuild#2284.

--
PiperOrigin-RevId: 151032551
MOS_MIGRATED_REVID=151032551
  • Loading branch information
aj-michael authored and hermione521 committed Mar 24, 2017
1 parent 40bf169 commit 9b7330f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 100 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
) + [
Expand Down
24 changes: 9 additions & 15 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}" \
Expand Down
76 changes: 0 additions & 76 deletions scripts/workspace_user.sh

This file was deleted.

12 changes: 6 additions & 6 deletions src/test/shell/bazel/android/android_integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9b7330f

Please sign in to comment.