Skip to content

Commit

Permalink
Make AndroidTests pass with incompatible_disallow_empty_glob
Browse files Browse the repository at this point in the history
One of the reasons why is not possible to flip
incompatible_disallow_empty_glob is because AndroidTests are failing

//src/test/java/com/google/devtools/build/lib/bazel/rules/android:AndroidTests

This commit add allow_empty = True to reflect the default behavior and
make the tests pass.
  • Loading branch information
limdor committed Apr 29, 2022
1 parent 1f7affa commit 1398526
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ toolchain(

filegroup(
name = "%toolchainName%-all_files",
srcs = glob(["ndk/toolchains/%toolchainDirectory%/**"]) + glob([
srcs = glob(["ndk/toolchains/%toolchainDirectory%/**"], allow_empty = True) + glob([
%toolchainFileGlobs%
]) + [
], allow_empty = True) + [
":%dynamicRuntimeLibs%",
":%staticRuntimeLibs%",
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cc_library(
name = "cpufeatures",
srcs = glob(["ndk/sources/android/cpufeatures/*.c"]),
hdrs = glob(["ndk/sources/android/cpufeatures/*.h"]),
srcs = glob(["ndk/sources/android/cpufeatures/*.c"], allow_empty = True),
hdrs = glob(["ndk/sources/android/cpufeatures/*.h"], allow_empty = True),
linkopts = ["-ldl"],
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
filegroup(
name = "%name%",
srcs = glob(["%fileGlobPattern%"]),
srcs = glob(["%fileGlobPattern%"], allow_empty = True),
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cc_library(
name = "vulkan_validation_layers_%toolchainName%",
srcs = glob(["ndk/sources/third_party/vulkan/src/build-android/jniLibs/%cpu%/libVkLayer_*.so"]),
srcs = glob(["ndk/sources/third_party/vulkan/src/build-android/jniLibs/%cpu%/libVkLayer_*.so"], allow_empty = True),
)
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public void setupMockClient(MockToolsConfig config, List<String> workspaceConten
"java_host_runtime_alias(name = 'current_host_java_runtime')",
"filegroup(name='langtools', srcs=['jdk/lib/tools.jar'])",
"filegroup(name='bootclasspath', srcs=['jdk/jre/lib/rt.jar'])",
"filegroup(name='extdir', srcs=glob(['jdk/jre/lib/ext/*']))",
"filegroup(name='extdir', srcs=glob(['jdk/jre/lib/ext/*'], allow_empty = True))",
"filegroup(name='java', srcs = ['jdk/jre/bin/java'])",
"filegroup(name='JacocoCoverage', srcs = ['JacocoCoverage_deploy.jar'])",
"exports_files([",
Expand Down
4 changes: 2 additions & 2 deletions tools/android/android_sdk_repository_template.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def create_android_sdk_rules(
"build-tools/%s/lib/**" % build_tools_directory,
# Build tools version 24.0.0 added a lib64 folder.
"build-tools/%s/lib64/**" % build_tools_directory,
]),
], allow_empty = True),
)

for tool in ["aapt", "aapt2", "aidl", "zipalign"]:
Expand Down Expand Up @@ -432,7 +432,7 @@ def create_system_images_filegroups(system_image_dirs):
)
native.filegroup(
name = "%s_qemu2_extra" % name,
srcs = native.glob(["%s/kernel-ranchu" % system_image_dir]),
srcs = native.glob(["%s/kernel-ranchu" % system_image_dir], allow_empty = True),
)
else:
# For supported system images that are not installed in the SDK, we
Expand Down

0 comments on commit 1398526

Please sign in to comment.