From 990c417cd4d97f0603840a477a43ba73b4a96f1b Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Tue, 24 Dec 2024 17:51:56 +1030 Subject: [PATCH] Patch `rules_android_ndk` to add `allow_empty` (#1152) There was an attempt to make 'rules_android_ndk' compatible with '--incompatible_disallow_empty_glob' [1], but it seems that it was not complete. To unblock Mozc to enable '--incompatible_disallow_empty_glob' (#1150), let's work around this in the Mozc side for now. There must be no behavior change in the final artifacts. [1]: https://github.com/bazelbuild/rules_android_ndk/pull/37 PiperOrigin-RevId: 709015396 --- src/MODULE.bazel | 12 +++++++++++- src/bazel/rules_android_ndk.allow_empty_glob.patch | 11 +++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/bazel/rules_android_ndk.allow_empty_glob.patch diff --git a/src/MODULE.bazel b/src/MODULE.bazel index fd605d427..8da7bd9f2 100644 --- a/src/MODULE.bazel +++ b/src/MODULE.bazel @@ -72,7 +72,17 @@ bazel_dep( ) single_version_override( module_name = "rules_android_ndk", - patches = ["bazel/rules_android_ndk.patch"], + # Bazel's built-in patch engine cannot deal with a patch file that affects + # multiple files. This is why we have two separate patch files here. + # https://github.com/bazelbuild/bazel/issues/10267 + patches = [ + # Look like this should have been included in the following PR. + # https://github.com/bazelbuild/rules_android_ndk/pull/37 + "bazel/rules_android_ndk.allow_empty_glob.patch", + # Might be removed after the folloing PR. + # https://github.com/bazelbuild/rules_android_ndk/pull/63 + "bazel/rules_android_ndk.patch", + ], version = "0.1.2", ) diff --git a/src/bazel/rules_android_ndk.allow_empty_glob.patch b/src/bazel/rules_android_ndk.allow_empty_glob.patch new file mode 100644 index 000000000..97a883868 --- /dev/null +++ b/src/bazel/rules_android_ndk.allow_empty_glob.patch @@ -0,0 +1,11 @@ +--- BUILD.ndk_clang.tpl ++++ BUILD.ndk_clang.tpl +@@ -49,7 +49,7 @@ + "bin/*", + "lib64/**/*", + "lib/**/*", +- ]), ++ ], allow_empty = True), + ) + + filegroup(