Skip to content

Commit 4e21d90

Browse files
lberkidamienmg
authored andcommitted
Remove BUILD.glob and incorporate the necessary filegroups into the android_{ndk,sdk}_repository rules themselves.
This is to that the Android tests also work on OS X (otherwise, we'd end up creating a file called "BUILD" in its root, which doesn't work, because it already has a directory called "build") -- MOS_MIGRATED_REVID=102484286
1 parent 895acf5 commit 4e21d90

7 files changed

Lines changed: 34 additions & 23 deletions

File tree

BUILD.glob

Lines changed: 0 additions & 1 deletion
This file was deleted.

WORKSPACE

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,18 @@ new_http_archive(
5858

5959
# In order to run the Android integration tests, uncomment these rules, point
6060
# them to the Android NDK and the SDK, and point the bind rules under them
61-
# to @repository//:all.
62-
# new_local_repository(
63-
# name = "globbed_android_sdk",
64-
# path = "/usr/local/google/home/lberki/android/android-sdk-linux",
65-
# build_file = "BUILD.glob"
61+
# to @repository//:files .
62+
# android_sdk_repository(
63+
# name = "androidsdk",
64+
# path = "/path/to/sdk",
65+
# build_tools_version = "21.1.1",
66+
# api_level = 19,
6667
# )
67-
#
68-
# new_local_repository(
69-
# name = "globbed_android_ndk",
70-
# path = "/usr/local/google/home/lberki/android/android-ndk",
71-
# build_file = "BUILD.glob"
68+
69+
# android_ndk_repository(
70+
# name = "androidndk",
71+
# path = "/path/to/ndk",
72+
# api_level = 19,
7273
# )
7374

7475
bind(

scripts/ci/build.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,28 +69,29 @@ function setup_android_repositories() {
6969
trap '[ -f WORKSPACE.bak ] && rm WORKSPACE && mv WORKSPACE.bak WORKSPACE' \
7070
EXIT
7171
cat >>WORKSPACE <<EOF
72-
new_local_repository(
73-
name = "globbed_android_sdk",
72+
android_sdk_repository(
73+
name = "androidsdk",
7474
path = "${ANDROID_SDK_PATH}",
75-
build_file = "BUILD.glob",
75+
build_tools_version = "${ANDROID_SDK_BUILD_TOOLS_VERSION:-22.0.1}",
76+
api_level = ${ANDROID_SDK_API_LEVEL:-21},
7677
)
7778
7879
bind(
7980
name = "android_sdk_for_testing",
80-
actual = "@globbed_android_sdk//:all",
81+
actual = "@androidsdk//:files",
8182
)
8283
EOF
8384
if [ -n "${ANDROID_NDK_PATH-}" ]; then
8485
cat >>WORKSPACE <<EOF
85-
new_local_repository(
86-
name = "globbed_android_ndk",
86+
android_ndk_repository(
87+
name = "androidndk",
8788
path = "${ANDROID_NDK_PATH}",
88-
build_file = "BUILD.glob",
89+
api_level = ${ANDROID_NDK_API_LEVEL:-21},
8990
)
9091
9192
bind(
9293
name = "android_ndk_for_testing",
93-
actual = "@globbed_android_ndk//:all",
94+
actual = "@androidndk//:files",
9495
)
9596
EOF
9697
fi

src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_ndk_cc_toolchain_suite_template.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717

1818
package(default_visibility = ["//visibility:public"])
1919

20+
filegroup(
21+
name = "files",
22+
srcs = ["ndk"],
23+
)
24+
2025
cc_toolchain_suite(
2126
name = "toolchain",
2227
toolchains = {

src/main/java/com/google/devtools/build/lib/bazel/rules/android/android_sdk_repository_template.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package(default_visibility = ["//visibility:public"])
22

3+
filegroup(
4+
name = "files",
5+
srcs = ["."],
6+
)
7+
38
java_import(
49
name = "appcompat_v7_import",
510
jars = ["extras/android/support/v7/appcompat/libs/android-support-v7-appcompat.jar"]

src/test/shell/bazel/android/android_integration_test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,12 @@ EOF
157157
bazel build -s //java/bazel:bin || fail "build failed"
158158
}
159159

160-
if [[ ! -r "${TEST_SRCDIR}/external/globbed_android_ndk/RELEASE.TXT" ]]; then
160+
if [[ ! -r "${TEST_SRCDIR}/external/androidndk/ndk/RELEASE.TXT" ]]; then
161161
echo "Not running Android tests due to lack of an Android NDK."
162162
exit 0
163163
fi
164164

165-
if [[ ! -r "${TEST_SRCDIR}/external/globbed_android_sdk/SDK Readme.txt" ]]; then
165+
if [[ ! -r "${TEST_SRCDIR}/external/androidsdk/SDK Readme.txt" ]]; then
166166
echo "Not running Android tests due to lack of an Android SDK."
167167
exit 0
168168
fi

src/test/shell/bazel/test-setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ EOF
188188
# TODO(bazel-team): This hard-codes the name of the Android repository in
189189
# the WORKSPACE file of Bazel. Change this once external repositories have
190190
# their own defined names under which they are mounted.
191-
NDK_SRCDIR=$TEST_SRCDIR/external/globbed_android_ndk
192-
SDK_SRCDIR=$TEST_SRCDIR/external/globbed_android_sdk
191+
NDK_SRCDIR=$TEST_SRCDIR/external/androidndk/ndk
192+
SDK_SRCDIR=$TEST_SRCDIR/external/androidsdk
193193

194194
mkdir -p $ANDROID_NDK
195195
mkdir -p $ANDROID_SDK

0 commit comments

Comments
 (0)