From e409ca652f636b0e68f172f185c1680dfd2c77af Mon Sep 17 00:00:00 2001 From: John Cormie Date: Thu, 6 Jun 2024 10:13:57 -0700 Subject: [PATCH] [build] rename android platforms to match CPU arch (#36715) Work around for https://github.com/bazelbuild/bazel/issues/15837#issuecomment-2127758141 Fixes a problem where the example client and server APKs would build but could not be installed (`INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries`) Closes #36715 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36715 from jdcormie:android-platforms f71e994b14b94153536f9776a3dc8a3d537180a4 PiperOrigin-RevId: 640938680 --- BUILD | 24 ------------ bazel/platforms/android/BUILD | 37 +++++++++++++++++++ .../binder/java/io/grpc/binder/cpp/README.md | 2 +- ...pc_binder_transport_apk_build_in_docker.sh | 2 +- 4 files changed, 39 insertions(+), 26 deletions(-) create mode 100644 bazel/platforms/android/BUILD diff --git a/BUILD b/BUILD index ebd41076cf9..ab89e5ea2dc 100644 --- a/BUILD +++ b/BUILD @@ -66,30 +66,6 @@ bool_flag( build_setting_default = False, ) -platform( - name = "android_x86_64", - constraint_values = [ - "@platforms//os:android", - "@platforms//cpu:x86_64", - ], -) - -platform( - name = "android_arm64", - constraint_values = [ - "@platforms//os:android", - "@platforms//cpu:arm64", - ], -) - -platform( - name = "android_armv7", - constraint_values = [ - "@platforms//os:android", - "@platforms//cpu:armv7", - ], -) - config_setting( name = "grpc_no_rls_flag", flag_values = {":disable_grpc_rls": "true"}, diff --git a/bazel/platforms/android/BUILD b/bazel/platforms/android/BUILD new file mode 100644 index 00000000000..48226aa34ea --- /dev/null +++ b/bazel/platforms/android/BUILD @@ -0,0 +1,37 @@ +# Copyright 2024 gRPC authors. +# +# 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. + +platform( + name = "x86_64", + constraint_values = [ + "@platforms//os:android", + "@platforms//cpu:x86_64", + ], +) + +platform( + name = "arm64-v8a", + constraint_values = [ + "@platforms//os:android", + "@platforms//cpu:arm64", + ], +) + +platform( + name = "armeabi-v7a", + constraint_values = [ + "@platforms//os:android", + "@platforms//cpu:armv7", + ], +) diff --git a/examples/android/binder/java/io/grpc/binder/cpp/README.md b/examples/android/binder/java/io/grpc/binder/cpp/README.md index d4df89e277c..dbe8472b725 100644 --- a/examples/android/binder/java/io/grpc/binder/cpp/README.md +++ b/examples/android/binder/java/io/grpc/binder/cpp/README.md @@ -13,7 +13,7 @@ ``` bazel build \ --extra_toolchains=@androidndk//:all \ - --android_platforms=//:android_x86_64,//:android_armv7,//:android_arm64 \ + --android_platforms=//bazel/platforms/android:x86_64,//bazel/platforms/android:armeabi-v7a,//bazel/platforms/android:arm64-v8a \ --copt=-Wno-unknown-warning-option \ //examples/android/binder/java/io/grpc/binder/cpp/exampleserver:app \ //examples/android/binder/java/io/grpc/binder/cpp/exampleclient:app diff --git a/tools/internal_ci/linux/grpc_binder_transport_apk_build_in_docker.sh b/tools/internal_ci/linux/grpc_binder_transport_apk_build_in_docker.sh index 99f51b6d476..dafc453c72e 100755 --- a/tools/internal_ci/linux/grpc_binder_transport_apk_build_in_docker.sh +++ b/tools/internal_ci/linux/grpc_binder_transport_apk_build_in_docker.sh @@ -26,7 +26,7 @@ bazel_binder_example_app/bazel_wrapper \ --bazelrc=tools/remote_build/include/test_locally_with_resultstore_results.bazelrc \ build \ --extra_toolchains=@androidndk//:all \ - --android_platforms=//:android_x86_64,//:android_armv7,//:android_arm64 \ + --android_platforms=//bazel/platforms/android:x86_64,//bazel/platforms/android:armeabi-v7a,//bazel/platforms/android:arm64-v8a \ //examples/android/binder/java/io/grpc/binder/cpp/exampleclient:app \ //examples/android/binder/java/io/grpc/binder/cpp/exampleserver:app