From a3304c67b44a9ffa321f006cf453225b70c1bf92 Mon Sep 17 00:00:00 2001 From: Ryan Northey Date: Mon, 22 Jul 2024 15:17:11 +0100 Subject: [PATCH] bazel: Bump -> 7.4.1 Signed-off-by: Ryan Northey --- .bazelrc | 6 ++++ .bazelversion | 2 +- bazel/repository_locations.bzl | 2 +- mobile/.bazelrc | 10 ++++-- mobile/BUILD | 32 ++++++++++++++++++++ mobile/bazel/framework_imports_extractor.bzl | 3 +- mobile/library/jni/BUILD | 27 +++++++++++++---- tools/proto_format/format_api.py | 2 +- 8 files changed, 71 insertions(+), 13 deletions(-) diff --git a/.bazelrc b/.bazelrc index d74fafb8cddc3..2a6223e976f34 100644 --- a/.bazelrc +++ b/.bazelrc @@ -10,6 +10,8 @@ # Startup options cannot be selected via config. startup --host_jvm_args=-Xmx3g +common --noenable_bzlmod + fetch --color=yes run --color=yes @@ -85,6 +87,7 @@ build:clang --action_env=BAZEL_COMPILER=clang build:clang --linkopt=-fuse-ld=lld build:clang --action_env=CC=clang --host_action_env=CC=clang build:clang --action_env=CXX=clang++ --host_action_env=CXX=clang++ +build:clang --incompatible_enable_cc_toolchain_resolution=false # Flags for Clang + PCH build:clang-pch --spawn_strategy=local @@ -110,6 +113,7 @@ build:gcc --cxxopt=-Wno-missing-requires # not in GCC 11 and GCC 11 is what is used in docker-gcc # configuration currently build:gcc --cxxopt=-Wno-unknown-warning +build:gcc --incompatible_enable_cc_toolchain_resolution=false # Clang-tidy # TODO(phlax): enable this, its throwing some errors as well as finding more issues @@ -216,6 +220,7 @@ build:libc++ --action_env=BAZEL_LINKLIBS=-l%:libc++.a:-l%:libc++abi.a build:libc++ --action_env=BAZEL_LINKOPTS=-lm:-pthread build:libc++ --define force_libcpp=enabled build:clang-libc++ --config=libc++ +build:clang-libc++ --action_env=ARFLAGS=r build:libc++20 --config=libc++ # gRPC has a lot of deprecated-enum-enum-conversion warning. Remove once it is addressed @@ -267,6 +272,7 @@ build:cache-local --remote_cache=grpc://localhost:9092 # Remote execution: https://docs.bazel.build/versions/master/remote-execution.html build:rbe-toolchain --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 +build:rbe-toolchain --incompatible_enable_cc_toolchain_resolution=false build:rbe-toolchain-clang --config=rbe-toolchain build:rbe-toolchain-clang --platforms=@envoy//bazel/rbe/toolchains:rbe_linux_clang_platform diff --git a/.bazelversion b/.bazelversion index f22d756da39d4..a8a188756826d 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -6.5.0 +7.1.2 diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 34e56f8c964ac..9c094549266cf 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -1089,7 +1089,7 @@ REPOSITORY_LOCATIONS_SPEC = dict( release_date = "2024-12-06", strip_prefix = "rules_python-{version}", urls = ["https://github.com/bazelbuild/rules_python/archive/{version}.tar.gz"], - use_category = ["build"], + use_category = ["build", "controlplane", "dataplane_core"], license = "Apache-2.0", license_url = "https://github.com/bazelbuild/rules_python/blob/{version}/LICENSE", ), diff --git a/mobile/.bazelrc b/mobile/.bazelrc index e913fbd2edb99..338a8ebb6af0d 100644 --- a/mobile/.bazelrc +++ b/mobile/.bazelrc @@ -108,12 +108,13 @@ build:mobile-remote-release-clang --config=ci build:mobile-remote-release-clang --config=remote build:mobile-remote-release-clang-android --config=mobile-remote-release-clang -build:mobile-remote-release-clang-android --fat_apk_cpu=x86_64 +build:mobile-remote-release-clang-android --android_platforms=//:android_x86_64 build:mobile-remote-release-clang-android --linkopt=-fuse-ld=lld +build:mobile-remote-release-clang-android --incompatible_enable_cc_toolchain_resolution=false build:mobile-remote-release-clang-android-publish --config=mobile-remote-release-clang build:mobile-remote-release-clang-android-publish --config=mobile-release-android -build:mobile-remote-release-clang-android-publish --fat_apk_cpu=x86,x86_64,armeabi-v7a,arm64-v8a +build:mobile-remote-release-clang-android-publish --android_platforms=//:android_x86_32,//:android_x86_64,//:android_armv7,//:android_arm64 build:mobile-remote-release-clang-android-publish --linkopt=-fuse-ld=lld # Compile releases optimizing for size (eg -Os, etc). @@ -199,10 +200,13 @@ test:mobile-remote-ci-linux-tsan --test_env=ENVOY_IP_TEST_VERSIONS=v4only # Coverage environment variables (keep in sync with //third_party/rbe_configs) build:mobile-ci-linux-coverage --action_env=GCOV=/opt/llvm/bin/llvm-profdata build:mobile-ci-linux-coverage --test_env=GCOV=/opt/llvm/bin/llvm-profdata +build:mobile-ci-linux-coverage --repo_env=GCOV=/opt/llvm/bin/llvm-profdata build:mobile-ci-linux-coverage --action_env=BAZEL_LLVM_COV=/opt/llvm/bin/llvm-cov -build:mobile-ci-linux-coverage --test_env=BAZEL_LLVM_COV=/opt/llm/bin/llvm-cov +build:mobile-ci-linux-coverage --test_env=BAZEL_LLVM_COV=/opt/llvm/bin/llvm-cov +build:mobile-ci-linux-coverage --repo_env=BAZEL_LLVM_COV=/opt/llvm/bin/llvm-cov build:mobile-ci-linux-coverage --action_env=BAZEL_USE_LLVM_NATIVE_COVERAGE=1 build:mobile-ci-linux-coverage --test_env=BAZEL_USE_LLVM_NATIVE_COVERAGE=1 +build:mobile-ci-linux-coverage --repo_env=BAZEL_USE_LLVM_NATIVE_COVERAGE=1 build:mobile-ci-linux-coverage --build_tests_only ############################################################################# diff --git a/mobile/BUILD b/mobile/BUILD index 375b944ff3db2..59e8f0f5fb052 100644 --- a/mobile/BUILD +++ b/mobile/BUILD @@ -177,3 +177,35 @@ xcodeproj( "//test/swift:test", ], ) + +platform( + name = "android_armv7", + constraint_values = [ + "@platforms//cpu:armv7", + "@platforms//os:android", + ], +) + +platform( + name = "android_arm64", + constraint_values = [ + "@platforms//cpu:arm64", + "@platforms//os:android", + ], +) + +platform( + name = "android_x86_32", + constraint_values = [ + "@platforms//cpu:x86_32", + "@platforms//os:android", + ], +) + +platform( + name = "android_x86_64", + constraint_values = [ + "@platforms//cpu:x86_64", + "@platforms//os:android", + ], +) diff --git a/mobile/bazel/framework_imports_extractor.bzl b/mobile/bazel/framework_imports_extractor.bzl index dd64be5078511..66c8595433ddb 100644 --- a/mobile/bazel/framework_imports_extractor.bzl +++ b/mobile/bazel/framework_imports_extractor.bzl @@ -6,6 +6,7 @@ didn't have to enumerate the files in the framework zip, but that isn't supported by 'apple_static_framework_import'. """ +load("@build_bazel_rules_apple//apple/internal:transition_support.bzl", "transition_support") load("//bazel:config.bzl", "MINIMUM_IOS_VERSION") def _framework_imports_extractor(ctx): @@ -47,7 +48,7 @@ framework_imports_extractor = rule( attrs = dict( framework = attr.label( mandatory = True, - cfg = apple_common.multi_arch_split, + cfg = transition_support.apple_platform_split_transition, ), platform_type = attr.string(default = "ios"), minimum_os_version = attr.string(default = MINIMUM_IOS_VERSION), diff --git a/mobile/library/jni/BUILD b/mobile/library/jni/BUILD index 19e4a894b4113..0446560ebcfe7 100644 --- a/mobile/library/jni/BUILD +++ b/mobile/library/jni/BUILD @@ -5,6 +5,24 @@ licenses(["notice"]) # Apache 2 envoy_mobile_package() +genrule( + name = "jni_h", + srcs = ["@bazel_tools//tools/jdk:jni_header"], + outs = [":jni.h"], + cmd = "cp $< $@", +) + +genrule( + name = "jni_md_h", + srcs = select({ + "//conditions:default": ["@bazel_tools//tools/jdk:jni_md_header-linux"], + "@platforms//os:windows": ["@bazel_tools//tools/jdk:jni_md_header-windows"], + "@platforms//os:macos": ["@bazel_tools//tools/jdk:jni_md_header-darwin"], + }), + outs = [":jni_md.h"], + cmd = "cp $< $@", +) + envoy_cc_library( name = "jni_utility_lib", srcs = [ @@ -33,14 +51,11 @@ envoy_cc_library( ], hdrs = [ "jni_helper.h", + ":jni.h", + ":jni_md.h", ], repository = "@envoy", - deps = select({ - "@envoy//bazel:linux": ["//bazel:jni"], - "@envoy//bazel:apple": ["//bazel:jni"], - # On Android, we should use the JNI provided by the system. - "//conditions:default": [], - }) + [ + deps = [ "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/container:flat_hash_set", "@com_google_absl//absl/strings", diff --git a/tools/proto_format/format_api.py b/tools/proto_format/format_api.py index ca0b189c46cfd..10aca5387a61a 100644 --- a/tools/proto_format/format_api.py +++ b/tools/proto_format/format_api.py @@ -310,7 +310,7 @@ def format_api(mode, outfile, xformed, printed, build_file): dst_src_paths = defaultdict(list) for label in data["proto_targets"]: - _label = label[len('@envoy_api//'):].replace(':', '/') + _label = label[len('@@envoy_api//'):].replace(':', '/') for suffix in ["active_or_frozen", "next_major_version_candidate"]: xpath = xformed_dir.joinpath(f"pkg/{_label}.{suffix}.proto") path = printed_dir.joinpath(f"{_label}.proto")