From f06979cd863fc22e0f7ea9dd4a240aefd41fa610 Mon Sep 17 00:00:00 2001 From: UebelAndre Date: Thu, 2 Jan 2025 22:08:28 -0800 Subject: [PATCH 1/3] Migrate iOS examples to bzlmod --- examples/ios/.bazelrc | 85 ++++++++++++++++--- examples/ios/.gitignore | 1 + examples/ios/MODULE.bazel | 48 +++++++++++ examples/ios/WORKSPACE.bazel | 57 +------------ examples/ios/platform_mappings | 37 -------- examples/ios_build/.bazelrc | 85 ++++++++++++++++--- examples/ios_build/.gitignore | 3 +- .../ios_build/3rdparty/crates/BUILD.bazel | 4 +- .../3rdparty/crates/BUILD.cc-1.0.73.bazel | 2 +- .../crates/BUILD.jobserver-0.1.25.bazel | 2 +- .../3rdparty/crates/BUILD.libc-0.2.134.bazel | 2 +- .../crates/BUILD.pkg-config-0.3.31.bazel | 81 ++++++++++++++++++ ...td.1.5.2.bazel => BUILD.zstd-0.13.2.bazel} | 6 +- ....5.2.bazel => BUILD.zstd-safe-7.2.1.bazel} | 13 ++- ...=> BUILD.zstd-sys-2.0.13+zstd.1.5.6.bazel} | 10 +-- examples/ios_build/3rdparty/crates/crates.bzl | 6 +- examples/ios_build/3rdparty/crates/defs.bzl | 52 +++++++----- examples/ios_build/BUILD.bazel | 36 +++++--- examples/ios_build/Cargo.lock | 23 +++-- examples/ios_build/Cargo.toml | 2 +- examples/ios_build/MODULE.bazel | 66 ++++++++++++++ examples/ios_build/WORKSPACE.bazel | 59 ------------- examples/ios_build/extensions.bzl | 23 +++++ examples/ios_build/ios_utils.bzl | 38 +++++++++ examples/ios_build/platform_mappings | 21 ----- 25 files changed, 500 insertions(+), 262 deletions(-) create mode 100644 examples/ios/MODULE.bazel delete mode 100644 examples/ios/platform_mappings create mode 100644 examples/ios_build/3rdparty/crates/BUILD.pkg-config-0.3.31.bazel rename examples/ios_build/3rdparty/crates/{BUILD.zstd-0.11.2+zstd.1.5.2.bazel => BUILD.zstd-0.13.2.bazel} (96%) rename examples/ios_build/3rdparty/crates/{BUILD.zstd-safe-5.0.2+zstd.1.5.2.bazel => BUILD.zstd-safe-7.2.1.bazel} (93%) rename examples/ios_build/3rdparty/crates/{BUILD.zstd-sys-2.0.1+zstd.1.5.2.bazel => BUILD.zstd-sys-2.0.13+zstd.1.5.6.bazel} (95%) create mode 100644 examples/ios_build/MODULE.bazel create mode 100644 examples/ios_build/extensions.bzl create mode 100644 examples/ios_build/ios_utils.bzl delete mode 100644 examples/ios_build/platform_mappings diff --git a/examples/ios/.bazelrc b/examples/ios/.bazelrc index da35d76a8d..f3e5a5d06f 100644 --- a/examples/ios/.bazelrc +++ b/examples/ios/.bazelrc @@ -1,16 +1,77 @@ -# Required on windows +############################################################################### +## Bazel Configuration Flags +## +## `.bazelrc` is a Bazel configuration file. +## https://bazel.build/docs/best-practices#bazelrc-file +############################################################################### + +# https://bazel.build/reference/command-line-reference#flag--enable_platform_specific_config common --enable_platform_specific_config -startup --windows_enable_symlinks -build:windows --enable_runfiles -# Enable CC toolchain that supports iOS from https://github.com/bazelbuild/apple_support -build --apple_crosstool_top=@local_config_apple_cc//:toolchain -build --crosstool_top=@local_config_apple_cc//:toolchain -build --host_crosstool_top=@local_config_apple_cc//:toolchain +# Enable the only currently supported report type +# https://bazel.build/reference/command-line-reference#flag--combined_report +coverage --combined_report=lcov + +# Avoid fully cached builds reporting no coverage and failing CI +# https://bazel.build/reference/command-line-reference#flag--experimental_fetch_all_coverage_outputs +coverage --experimental_fetch_all_coverage_outputs + +# Required for some of the tests +# https://bazel.build/reference/command-line-reference#flag--experimental_cc_shared_library +common --experimental_cc_shared_library + +############################################################################### +## Unique configuration groups +############################################################################### + +# Enable use of the nightly toolchains. +build:nightly --@rules_rust//rust/toolchain/channel=nightly + +# Enable rustfmt for all targets in the workspace +build:rustfmt --aspects=@rules_rust//rust:defs.bzl%rustfmt_aspect +build:rustfmt --output_groups=+rustfmt_checks + +# Enable clippy for all targets in the workspace +build:clippy --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect +build:clippy --output_groups=+clippy_checks + +# Enable unpretty for all targets in the workspace +build:unpretty --aspects=@rules_rust//rust:defs.bzl%rust_unpretty_aspect +build:unpretty --output_groups=+rust_unpretty + +# `unpretty` requires the nightly toolchain. See tracking issue: +# https://github.com/rust-lang/rust/issues/43364 +build:unpretty --config=nightly + +############################################################################### +## Incompatibility flags +############################################################################### + +# https://github.com/bazelbuild/bazel/issues/8195 +build --incompatible_disallow_empty_glob=true + +# https://github.com/bazelbuild/bazel/issues/12821 +build --nolegacy_external_runfiles + +# Required for cargo_build_script support before Bazel 7 +build --incompatible_merge_fixed_and_default_shell_env + +############################################################################### +## Bzlmod +############################################################################### + +# A configuration for disabling bzlmod. +common:no-bzlmod --noenable_bzlmod --enable_workspace + +# Disable the bzlmod lockfile, so we don't accidentally commit MODULE.bazel.lock +common --lockfile_mode=off -# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel -# https://github.com/bazelbuild/rules_rust/issues/2181 -common --noenable_bzlmod +############################################################################### +## Custom user flags +## +## This should always be the last thing in the `.bazelrc` file to ensure +## consistent behavior when setting flags in that file as `.bazelrc` files are +## evaluated top to bottom. +############################################################################### -# This isn't currently the defaut in Bazel, but we enable it to test we'll be ready if/when it flips. -build --incompatible_disallow_empty_glob +try-import %workspace%/user.bazelrc diff --git a/examples/ios/.gitignore b/examples/ios/.gitignore index a6ef824c1f..2a3bb2d902 100644 --- a/examples/ios/.gitignore +++ b/examples/ios/.gitignore @@ -1 +1,2 @@ /bazel-* +user.bazelrc diff --git a/examples/ios/MODULE.bazel b/examples/ios/MODULE.bazel new file mode 100644 index 0000000000..25d9c479a3 --- /dev/null +++ b/examples/ios/MODULE.bazel @@ -0,0 +1,48 @@ +module( + name = "rules_rust_example_ios", + version = "0.0.0", +) + +############################################################################### +# B A Z E L C E N T R A L R E G I S T R Y # https://registry.bazel.build/ +############################################################################### +# https://github.com/bazelbuild/rules_rust/releases +bazel_dep(name = "rules_rust", version = "0.46.0") +local_path_override( + module_name = "rules_rust", + path = "../..", +) + +bazel_dep( + name = "rules_apple", + version = "3.9.2", + repo_name = "build_bazel_rules_apple", +) +bazel_dep( + name = "apple_support", + version = "1.17.1", + repo_name = "build_bazel_apple_support", +) +bazel_dep( + name = "rules_swift", + version = "2.3.1", + repo_name = "build_bazel_rules_swift", +) + +############################################################################### +# T O O L C H A I N S +############################################################################### + +# Rust toolchain +rust = use_extension("@rules_rust//rust:extensions.bzl", "rust") +rust.toolchain( + extra_target_triples = [ + "aarch64-apple-ios-sim", + "x86_64-apple-ios", + "aarch64-apple-darwin", + "x86_64-apple-darwin", + ], +) +use_repo(rust, "rust_toolchains") + +register_toolchains("@rust_toolchains//:all") diff --git a/examples/ios/WORKSPACE.bazel b/examples/ios/WORKSPACE.bazel index d57a023341..1d05d4afb3 100644 --- a/examples/ios/WORKSPACE.bazel +++ b/examples/ios/WORKSPACE.bazel @@ -1,56 +1 @@ -workspace(name = "ios_examples") - -# Users of `rules_rust` will commonly be unable to load it -# using a `local_repository`. Instead, to setup the rules, -# please see https://bazelbuild.github.io/rules_rust/#setup -local_repository( - name = "rules_rust", - path = "../..", -) - -load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains") - -rules_rust_dependencies() - -rust_register_toolchains( - edition = "2018", - extra_target_triples = [ - "aarch64-apple-ios-sim", - "x86_64-apple-ios", - "aarch64-apple-darwin", - "x86_64-apple-darwin", - ], -) - -load("@rules_rust//rust:repositories_transitive.bzl", "rules_rust_transitive_dependencies") - -rules_rust_transitive_dependencies() - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "build_bazel_rules_apple", - sha256 = "ed432a2d5929452748bd53a4ff9e652f2332283eb3d7ffad6cb63aab96a06301", - url = "https://github.com/bazelbuild/rules_apple/releases/download/3.4.0/rules_apple.3.4.0.tar.gz", -) - -load( - "@build_bazel_rules_apple//apple:repositories.bzl", - "apple_rules_dependencies", -) - -apple_rules_dependencies() - -load( - "@build_bazel_rules_swift//swift:repositories.bzl", - "swift_rules_dependencies", -) - -swift_rules_dependencies() - -load( - "@build_bazel_apple_support//lib:repositories.bzl", - "apple_support_dependencies", -) - -apple_support_dependencies() +workspace(name = "rules_rust_example_ios") diff --git a/examples/ios/platform_mappings b/examples/ios/platform_mappings deleted file mode 100644 index 3da4fa6e19..0000000000 --- a/examples/ios/platform_mappings +++ /dev/null @@ -1,37 +0,0 @@ -# https://github.com/bazelbuild/rules_apple/issues/1658 -platforms: - //:macos_x86_64 - --cpu=darwin_x86_64 - - //:macos_arm64 - --cpu=darwin_arm64 - - //:ios_x86_64 - --cpu=ios_x86_64 - - //:ios_sim_arm64 - --cpu=ios_sim_arm64 - - //platforms:ios_arm64 - --cpu=ios_arm64 - -flags: - --cpu=darwin_x86_64 - --apple_platform_type=macos - //:macos_x86_64 - - --cpu=darwin_arm64 - --apple_platform_type=macos - //:macos_arm64 - - --cpu=ios_x86_64 - --apple_platform_type=ios - //:ios_x86_64 - - --cpu=ios_sim_arm64 - --apple_platform_type=ios - //:ios_sim_arm64 - - --cpu=ios_arm64 - --apple_platform_type=ios - //:ios_arm64 diff --git a/examples/ios_build/.bazelrc b/examples/ios_build/.bazelrc index da35d76a8d..f3e5a5d06f 100644 --- a/examples/ios_build/.bazelrc +++ b/examples/ios_build/.bazelrc @@ -1,16 +1,77 @@ -# Required on windows +############################################################################### +## Bazel Configuration Flags +## +## `.bazelrc` is a Bazel configuration file. +## https://bazel.build/docs/best-practices#bazelrc-file +############################################################################### + +# https://bazel.build/reference/command-line-reference#flag--enable_platform_specific_config common --enable_platform_specific_config -startup --windows_enable_symlinks -build:windows --enable_runfiles -# Enable CC toolchain that supports iOS from https://github.com/bazelbuild/apple_support -build --apple_crosstool_top=@local_config_apple_cc//:toolchain -build --crosstool_top=@local_config_apple_cc//:toolchain -build --host_crosstool_top=@local_config_apple_cc//:toolchain +# Enable the only currently supported report type +# https://bazel.build/reference/command-line-reference#flag--combined_report +coverage --combined_report=lcov + +# Avoid fully cached builds reporting no coverage and failing CI +# https://bazel.build/reference/command-line-reference#flag--experimental_fetch_all_coverage_outputs +coverage --experimental_fetch_all_coverage_outputs + +# Required for some of the tests +# https://bazel.build/reference/command-line-reference#flag--experimental_cc_shared_library +common --experimental_cc_shared_library + +############################################################################### +## Unique configuration groups +############################################################################### + +# Enable use of the nightly toolchains. +build:nightly --@rules_rust//rust/toolchain/channel=nightly + +# Enable rustfmt for all targets in the workspace +build:rustfmt --aspects=@rules_rust//rust:defs.bzl%rustfmt_aspect +build:rustfmt --output_groups=+rustfmt_checks + +# Enable clippy for all targets in the workspace +build:clippy --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect +build:clippy --output_groups=+clippy_checks + +# Enable unpretty for all targets in the workspace +build:unpretty --aspects=@rules_rust//rust:defs.bzl%rust_unpretty_aspect +build:unpretty --output_groups=+rust_unpretty + +# `unpretty` requires the nightly toolchain. See tracking issue: +# https://github.com/rust-lang/rust/issues/43364 +build:unpretty --config=nightly + +############################################################################### +## Incompatibility flags +############################################################################### + +# https://github.com/bazelbuild/bazel/issues/8195 +build --incompatible_disallow_empty_glob=true + +# https://github.com/bazelbuild/bazel/issues/12821 +build --nolegacy_external_runfiles + +# Required for cargo_build_script support before Bazel 7 +build --incompatible_merge_fixed_and_default_shell_env + +############################################################################### +## Bzlmod +############################################################################### + +# A configuration for disabling bzlmod. +common:no-bzlmod --noenable_bzlmod --enable_workspace + +# Disable the bzlmod lockfile, so we don't accidentally commit MODULE.bazel.lock +common --lockfile_mode=off -# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel -# https://github.com/bazelbuild/rules_rust/issues/2181 -common --noenable_bzlmod +############################################################################### +## Custom user flags +## +## This should always be the last thing in the `.bazelrc` file to ensure +## consistent behavior when setting flags in that file as `.bazelrc` files are +## evaluated top to bottom. +############################################################################### -# This isn't currently the defaut in Bazel, but we enable it to test we'll be ready if/when it flips. -build --incompatible_disallow_empty_glob +try-import %workspace%/user.bazelrc diff --git a/examples/ios_build/.gitignore b/examples/ios_build/.gitignore index ac51a054d2..2a3bb2d902 100644 --- a/examples/ios_build/.gitignore +++ b/examples/ios_build/.gitignore @@ -1 +1,2 @@ -bazel-* +/bazel-* +user.bazelrc diff --git a/examples/ios_build/3rdparty/crates/BUILD.bazel b/examples/ios_build/3rdparty/crates/BUILD.bazel index 1395e5012c..9061854e3e 100644 --- a/examples/ios_build/3rdparty/crates/BUILD.bazel +++ b/examples/ios_build/3rdparty/crates/BUILD.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//3rdparty:crates_vendor +# bazel run @@//3rdparty:crates_vendor ############################################################################### package(default_visibility = ["//visibility:public"]) @@ -33,6 +33,6 @@ filegroup( # Workspace Member Dependencies alias( name = "zstd", - actual = "@ios_build__zstd-0.11.2-zstd.1.5.2//:zstd", + actual = "@ios_build__zstd-0.13.2//:zstd", tags = ["manual"], ) diff --git a/examples/ios_build/3rdparty/crates/BUILD.cc-1.0.73.bazel b/examples/ios_build/3rdparty/crates/BUILD.cc-1.0.73.bazel index 892bd7ab30..d85a844552 100644 --- a/examples/ios_build/3rdparty/crates/BUILD.cc-1.0.73.bazel +++ b/examples/ios_build/3rdparty/crates/BUILD.cc-1.0.73.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//3rdparty:crates_vendor +# bazel run @@//3rdparty:crates_vendor ############################################################################### load("@rules_rust//rust:defs.bzl", "rust_library") diff --git a/examples/ios_build/3rdparty/crates/BUILD.jobserver-0.1.25.bazel b/examples/ios_build/3rdparty/crates/BUILD.jobserver-0.1.25.bazel index 06d11fc18b..749f6cda0c 100644 --- a/examples/ios_build/3rdparty/crates/BUILD.jobserver-0.1.25.bazel +++ b/examples/ios_build/3rdparty/crates/BUILD.jobserver-0.1.25.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//3rdparty:crates_vendor +# bazel run @@//3rdparty:crates_vendor ############################################################################### load("@rules_rust//rust:defs.bzl", "rust_library") diff --git a/examples/ios_build/3rdparty/crates/BUILD.libc-0.2.134.bazel b/examples/ios_build/3rdparty/crates/BUILD.libc-0.2.134.bazel index 4cca82ef89..50d9bf9a0e 100644 --- a/examples/ios_build/3rdparty/crates/BUILD.libc-0.2.134.bazel +++ b/examples/ios_build/3rdparty/crates/BUILD.libc-0.2.134.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//3rdparty:crates_vendor +# bazel run @@//3rdparty:crates_vendor ############################################################################### load("@rules_rust//cargo:defs.bzl", "cargo_build_script") diff --git a/examples/ios_build/3rdparty/crates/BUILD.pkg-config-0.3.31.bazel b/examples/ios_build/3rdparty/crates/BUILD.pkg-config-0.3.31.bazel new file mode 100644 index 0000000000..bcc3a424d8 --- /dev/null +++ b/examples/ios_build/3rdparty/crates/BUILD.pkg-config-0.3.31.bazel @@ -0,0 +1,81 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @@//3rdparty:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "pkg_config", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=pkg-config", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasip1": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "0.3.31", +) diff --git a/examples/ios_build/3rdparty/crates/BUILD.zstd-0.11.2+zstd.1.5.2.bazel b/examples/ios_build/3rdparty/crates/BUILD.zstd-0.13.2.bazel similarity index 96% rename from examples/ios_build/3rdparty/crates/BUILD.zstd-0.11.2+zstd.1.5.2.bazel rename to examples/ios_build/3rdparty/crates/BUILD.zstd-0.13.2.bazel index 517db66965..3f2a742dc9 100644 --- a/examples/ios_build/3rdparty/crates/BUILD.zstd-0.11.2+zstd.1.5.2.bazel +++ b/examples/ios_build/3rdparty/crates/BUILD.zstd-0.13.2.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//3rdparty:crates_vendor +# bazel run @@//3rdparty:crates_vendor ############################################################################### load("@rules_rust//rust:defs.bzl", "rust_library") @@ -83,8 +83,8 @@ rust_library( "@rules_rust//rust/platform:x86_64-unknown-none": [], "//conditions:default": ["@platforms//:incompatible"], }), - version = "0.11.2+zstd.1.5.2", + version = "0.13.2", deps = [ - "@ios_build__zstd-safe-5.0.2-zstd.1.5.2//:zstd_safe", + "@ios_build__zstd-safe-7.2.1//:zstd_safe", ], ) diff --git a/examples/ios_build/3rdparty/crates/BUILD.zstd-safe-5.0.2+zstd.1.5.2.bazel b/examples/ios_build/3rdparty/crates/BUILD.zstd-safe-7.2.1.bazel similarity index 93% rename from examples/ios_build/3rdparty/crates/BUILD.zstd-safe-5.0.2+zstd.1.5.2.bazel rename to examples/ios_build/3rdparty/crates/BUILD.zstd-safe-7.2.1.bazel index 2c15c02999..413c964c82 100644 --- a/examples/ios_build/3rdparty/crates/BUILD.zstd-safe-5.0.2+zstd.1.5.2.bazel +++ b/examples/ios_build/3rdparty/crates/BUILD.zstd-safe-7.2.1.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//3rdparty:crates_vendor +# bazel run @@//3rdparty:crates_vendor ############################################################################### load("@rules_rust//cargo:defs.bzl", "cargo_build_script") @@ -84,11 +84,10 @@ rust_library( "@rules_rust//rust/platform:x86_64-unknown-none": [], "//conditions:default": ["@platforms//:incompatible"], }), - version = "5.0.2+zstd.1.5.2", + version = "7.2.1", deps = [ - "@ios_build__libc-0.2.134//:libc", - "@ios_build__zstd-safe-5.0.2-zstd.1.5.2//:build_script_build", - "@ios_build__zstd-sys-2.0.1-zstd.1.5.2//:zstd_sys", + "@ios_build__zstd-safe-7.2.1//:build_script_build", + "@ios_build__zstd-sys-2.0.13-zstd.1.5.6//:zstd_sys", ], ) @@ -133,7 +132,7 @@ cargo_build_script( ), edition = "2018", link_deps = [ - "@ios_build__zstd-sys-2.0.1-zstd.1.5.2//:zstd_sys", + "@ios_build__zstd-sys-2.0.13-zstd.1.5.6//:zstd_sys", ], pkg_name = "zstd-safe", rustc_flags = [ @@ -146,7 +145,7 @@ cargo_build_script( "noclippy", "norustfmt", ], - version = "5.0.2+zstd.1.5.2", + version = "7.2.1", visibility = ["//visibility:private"], ) diff --git a/examples/ios_build/3rdparty/crates/BUILD.zstd-sys-2.0.1+zstd.1.5.2.bazel b/examples/ios_build/3rdparty/crates/BUILD.zstd-sys-2.0.13+zstd.1.5.6.bazel similarity index 95% rename from examples/ios_build/3rdparty/crates/BUILD.zstd-sys-2.0.1+zstd.1.5.2.bazel rename to examples/ios_build/3rdparty/crates/BUILD.zstd-sys-2.0.13+zstd.1.5.6.bazel index d0f60c29ea..daaab2fd5b 100644 --- a/examples/ios_build/3rdparty/crates/BUILD.zstd-sys-2.0.1+zstd.1.5.2.bazel +++ b/examples/ios_build/3rdparty/crates/BUILD.zstd-sys-2.0.13+zstd.1.5.6.bazel @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//3rdparty:crates_vendor +# bazel run @@//3rdparty:crates_vendor ############################################################################### load("@rules_rust//cargo:defs.bzl", "cargo_build_script") @@ -83,10 +83,9 @@ rust_library( "@rules_rust//rust/platform:x86_64-unknown-none": [], "//conditions:default": ["@platforms//:incompatible"], }), - version = "2.0.1+zstd.1.5.2", + version = "2.0.13+zstd.1.5.6", deps = [ - "@ios_build__libc-0.2.134//:libc", - "@ios_build__zstd-sys-2.0.1-zstd.1.5.2//:build_script_build", + "@ios_build__zstd-sys-2.0.13-zstd.1.5.6//:build_script_build", ], ) @@ -141,10 +140,11 @@ cargo_build_script( "noclippy", "norustfmt", ], - version = "2.0.1+zstd.1.5.2", + version = "2.0.13+zstd.1.5.6", visibility = ["//visibility:private"], deps = [ "@ios_build__cc-1.0.73//:cc", + "@ios_build__pkg-config-0.3.31//:pkg_config", ], ) diff --git a/examples/ios_build/3rdparty/crates/crates.bzl b/examples/ios_build/3rdparty/crates/crates.bzl index 4d8ddba93b..5ff3db0d09 100644 --- a/examples/ios_build/3rdparty/crates/crates.bzl +++ b/examples/ios_build/3rdparty/crates/crates.bzl @@ -12,7 +12,7 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("@rules_rust//crate_universe/private:crates_vendor.bzl", "crates_vendor_remote_repository") # buildifier: disable=bzl-visibility -load("@rules_rust_examples_ios_build//3rdparty/crates:defs.bzl", _crate_repositories = "crate_repositories") +load("//3rdparty/crates:defs.bzl", _crate_repositories = "crate_repositories") def crate_repositories(): """Generates repositories for vendored crates. @@ -23,8 +23,8 @@ def crate_repositories(): maybe( crates_vendor_remote_repository, name = "ios_build", - build_file = Label("@rules_rust_examples_ios_build//3rdparty/crates:BUILD.bazel"), - defs_module = Label("@rules_rust_examples_ios_build//3rdparty/crates:defs.bzl"), + build_file = Label("//3rdparty/crates:BUILD.bazel"), + defs_module = Label("//3rdparty/crates:defs.bzl"), ) direct_deps = [struct(repo = "ios_build", is_dev_dep = False)] diff --git a/examples/ios_build/3rdparty/crates/defs.bzl b/examples/ios_build/3rdparty/crates/defs.bzl index 00369eb4ba..a02c096c7f 100644 --- a/examples/ios_build/3rdparty/crates/defs.bzl +++ b/examples/ios_build/3rdparty/crates/defs.bzl @@ -3,7 +3,7 @@ # DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To # regenerate this file, run the following: # -# bazel run @//3rdparty:crates_vendor +# bazel run @@//3rdparty:crates_vendor ############################################################################### """ # `crates_repository` API @@ -295,7 +295,7 @@ def aliases( _NORMAL_DEPENDENCIES = { "": { _COMMON_CONDITION: { - "zstd": Label("@ios_build__zstd-0.11.2-zstd.1.5.2//:zstd"), + "zstd": Label("@ios_build__zstd-0.13.2//:zstd"), }, }, } @@ -410,7 +410,7 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/cc/1.0.73/download"], strip_prefix = "cc-1.0.73", - build_file = Label("@rules_rust_examples_ios_build//3rdparty/crates:BUILD.cc-1.0.73.bazel"), + build_file = Label("//3rdparty/crates:BUILD.cc-1.0.73.bazel"), ) maybe( @@ -420,7 +420,7 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/jobserver/0.1.25/download"], strip_prefix = "jobserver-0.1.25", - build_file = Label("@rules_rust_examples_ios_build//3rdparty/crates:BUILD.jobserver-0.1.25.bazel"), + build_file = Label("//3rdparty/crates:BUILD.jobserver-0.1.25.bazel"), ) maybe( @@ -430,39 +430,49 @@ def crate_repositories(): type = "tar.gz", urls = ["https://static.crates.io/crates/libc/0.2.134/download"], strip_prefix = "libc-0.2.134", - build_file = Label("@rules_rust_examples_ios_build//3rdparty/crates:BUILD.libc-0.2.134.bazel"), + build_file = Label("//3rdparty/crates:BUILD.libc-0.2.134.bazel"), ) maybe( http_archive, - name = "ios_build__zstd-0.11.2-zstd.1.5.2", - sha256 = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4", + name = "ios_build__pkg-config-0.3.31", + sha256 = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2", type = "tar.gz", - urls = ["https://static.crates.io/crates/zstd/0.11.2+zstd.1.5.2/download"], - strip_prefix = "zstd-0.11.2+zstd.1.5.2", - build_file = Label("@rules_rust_examples_ios_build//3rdparty/crates:BUILD.zstd-0.11.2+zstd.1.5.2.bazel"), + urls = ["https://static.crates.io/crates/pkg-config/0.3.31/download"], + strip_prefix = "pkg-config-0.3.31", + build_file = Label("//3rdparty/crates:BUILD.pkg-config-0.3.31.bazel"), ) maybe( http_archive, - name = "ios_build__zstd-safe-5.0.2-zstd.1.5.2", - sha256 = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db", + name = "ios_build__zstd-0.13.2", + sha256 = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9", type = "tar.gz", - urls = ["https://static.crates.io/crates/zstd-safe/5.0.2+zstd.1.5.2/download"], - strip_prefix = "zstd-safe-5.0.2+zstd.1.5.2", - build_file = Label("@rules_rust_examples_ios_build//3rdparty/crates:BUILD.zstd-safe-5.0.2+zstd.1.5.2.bazel"), + urls = ["https://static.crates.io/crates/zstd/0.13.2/download"], + strip_prefix = "zstd-0.13.2", + build_file = Label("//3rdparty/crates:BUILD.zstd-0.13.2.bazel"), ) maybe( http_archive, - name = "ios_build__zstd-sys-2.0.1-zstd.1.5.2", - sha256 = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b", + name = "ios_build__zstd-safe-7.2.1", + sha256 = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059", type = "tar.gz", - urls = ["https://static.crates.io/crates/zstd-sys/2.0.1+zstd.1.5.2/download"], - strip_prefix = "zstd-sys-2.0.1+zstd.1.5.2", - build_file = Label("@rules_rust_examples_ios_build//3rdparty/crates:BUILD.zstd-sys-2.0.1+zstd.1.5.2.bazel"), + urls = ["https://static.crates.io/crates/zstd-safe/7.2.1/download"], + strip_prefix = "zstd-safe-7.2.1", + build_file = Label("//3rdparty/crates:BUILD.zstd-safe-7.2.1.bazel"), + ) + + maybe( + http_archive, + name = "ios_build__zstd-sys-2.0.13-zstd.1.5.6", + sha256 = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa", + type = "tar.gz", + urls = ["https://static.crates.io/crates/zstd-sys/2.0.13+zstd.1.5.6/download"], + strip_prefix = "zstd-sys-2.0.13+zstd.1.5.6", + build_file = Label("//3rdparty/crates:BUILD.zstd-sys-2.0.13+zstd.1.5.6.bazel"), ) return [ - struct(repo = "ios_build__zstd-0.11.2-zstd.1.5.2", is_dev_dep = False), + struct(repo = "ios_build__zstd-0.13.2", is_dev_dep = False), ] diff --git a/examples/ios_build/BUILD.bazel b/examples/ios_build/BUILD.bazel index f4e8ef3b82..cd1d97217a 100644 --- a/examples/ios_build/BUILD.bazel +++ b/examples/ios_build/BUILD.bazel @@ -1,5 +1,6 @@ load("@rules_rust//rust:defs.bzl", "rust_static_library") load("@rules_shell//shell:sh_test.bzl", "sh_test") +load(":ios_utils.bzl", "platform_transition_filegroup") exports_files([ "Cargo.toml", @@ -15,17 +16,32 @@ rust_static_library( ], ) -filegroup( - name = "lib", - srcs = ["ios_build_lib"], -) +[ + platform_transition_filegroup( + name = "ios_build_lib.{}".format(plat), + srcs = [":ios_build_lib"], + platform = plat, + ) + for plat in [ + "macos_x86_64", + "macos_arm64", + "ios_x86_64", + "ios_arm64", + ] +] -sh_test( - name = "check_arch", - srcs = ["check_arch.sh"], - args = ["$(location :lib)"], - data = [":lib"], -) +[ + sh_test( + name = "check_arch.{}".format(plat), + srcs = ["check_arch.sh"], + args = ["$(rootpath :ios_build_lib.{})".format(plat)], + data = [":ios_build_lib.{}".format(plat)], + ) + for plat in [ + "ios_x86_64", + "ios_arm64", + ] +] platform( name = "macos_x86_64", diff --git a/examples/ios_build/Cargo.lock b/examples/ios_build/Cargo.lock index 919712a9c9..0327abeb22 100644 --- a/examples/ios_build/Cargo.lock +++ b/examples/ios_build/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "cc" @@ -33,31 +33,36 @@ version = "0.2.134" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "329c933548736bc49fd575ee68c89e8be4d260064184389a5b77517cddd99ffb" +[[package]] +name = "pkg-config" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" + [[package]] name = "zstd" -version = "0.11.2+zstd.1.5.2" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" +version = "7.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" dependencies = [ - "libc", "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.1+zstd.1.5.2" +version = "2.0.13+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" dependencies = [ "cc", - "libc", + "pkg-config", ] diff --git a/examples/ios_build/Cargo.toml b/examples/ios_build/Cargo.toml index de64c22abe..85a5057423 100644 --- a/examples/ios_build/Cargo.toml +++ b/examples/ios_build/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -zstd = "0.11.2" +zstd = "0.13.2" diff --git a/examples/ios_build/MODULE.bazel b/examples/ios_build/MODULE.bazel new file mode 100644 index 0000000000..9d3ccddf07 --- /dev/null +++ b/examples/ios_build/MODULE.bazel @@ -0,0 +1,66 @@ +module( + name = "rules_rust_examples_ios_build", + version = "0.0.0", +) + +############################################################################### +# B A Z E L C E N T R A L R E G I S T R Y # https://registry.bazel.build/ +############################################################################### +# https://github.com/bazelbuild/rules_rust/releases +bazel_dep(name = "rules_rust", version = "0.46.0") +local_path_override( + module_name = "rules_rust", + path = "../..", +) + +bazel_dep( + name = "rules_apple", + version = "3.9.2", + repo_name = "build_bazel_rules_apple", +) +bazel_dep( + name = "apple_support", + version = "1.17.1", + repo_name = "build_bazel_apple_support", +) +bazel_dep( + name = "rules_swift", + version = "2.3.1", + repo_name = "build_bazel_rules_swift", +) +bazel_dep( + name = "rules_shell", + version = "0.3.0", +) +bazel_dep( + name = "bazel_skylib", + version = "1.7.1", +) + +############################################################################### +# T O O L C H A I N S +############################################################################### + +# Rust toolchain +rust = use_extension("@rules_rust//rust:extensions.bzl", "rust") +rust.toolchain( + extra_target_triples = [ + "aarch64-apple-darwin", + "aarch64-apple-ios-sim", + "aarch64-apple-ios", + "x86_64-apple-darwin", + "x86_64-apple-ios", + ], +) +use_repo(rust, "rust_toolchains") + +register_toolchains("@rust_toolchains//:all") + +############################################################################### + +deps = use_extension("//:extensions.bzl", "rust_example") +use_repo( + deps, + "ios_build", + "ios_build__zstd-0.13.2", +) diff --git a/examples/ios_build/WORKSPACE.bazel b/examples/ios_build/WORKSPACE.bazel index 62d33507f3..e67f80e476 100644 --- a/examples/ios_build/WORKSPACE.bazel +++ b/examples/ios_build/WORKSPACE.bazel @@ -1,60 +1 @@ workspace(name = "rules_rust_examples_ios_build") - -local_repository( - name = "rules_rust", - path = "../../", -) - -load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains") - -rules_rust_dependencies() - -rust_register_toolchains( - edition = "2018", - extra_target_triples = [ - "aarch64-apple-ios-sim", - "x86_64-apple-ios", - ], -) - -load("@rules_rust//rust:repositories_transitive.bzl", "rules_rust_transitive_dependencies") - -rules_rust_transitive_dependencies() - -load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies") - -crate_universe_dependencies(bootstrap = True) - -load( - "//3rdparty/crates:crates.bzl", - ios_build_crate_repositories = "crate_repositories", -) - -ios_build_crate_repositories() - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -# Used for Bazel CI -http_archive( - name = "bazelci_rules", - sha256 = "eca21884e6f66a88c358e580fd67a6b148d30ab57b1680f62a96c00f9bc6a07e", - strip_prefix = "bazelci_rules-1.0.0", - url = "https://github.com/bazelbuild/continuous-integration/releases/download/rules-1.0.0/bazelci_rules-1.0.0.tar.gz", -) - -load("@bazelci_rules//:rbe_repo.bzl", "rbe_preconfig") - -# Creates a default toolchain config for RBE. -# Use this as is if you are using the rbe_ubuntu16_04 container, -# otherwise refer to RBE docs. -rbe_preconfig( - name = "buildkite_config", - toolchain = "ubuntu1804-bazel-java11", -) - -load( - "@build_bazel_apple_support//lib:repositories.bzl", - "apple_support_dependencies", -) - -apple_support_dependencies() diff --git a/examples/ios_build/extensions.bzl b/examples/ios_build/extensions.bzl new file mode 100644 index 0000000000..6118fa1264 --- /dev/null +++ b/examples/ios_build/extensions.bzl @@ -0,0 +1,23 @@ +"""Bzlmod module extensions""" + +load("//3rdparty/crates:crates.bzl", "crate_repositories") + +def _rust_example_impl(module_ctx): + # This should contain the subset of WORKSPACE.bazel that defines + # repositories. + direct_deps = [] + + direct_deps.extend(crate_repositories()) + + # is_dev_dep is ignored here. It's not relevant for internal_deps, as dev + # dependencies are only relevant for module extensions that can be used + # by other MODULES. + return module_ctx.extension_metadata( + root_module_direct_deps = [repo.repo for repo in direct_deps], + root_module_direct_dev_deps = [], + ) + +rust_example = module_extension( + doc = "Dependencies for the rules_rust examples.", + implementation = _rust_example_impl, +) diff --git a/examples/ios_build/ios_utils.bzl b/examples/ios_build/ios_utils.bzl new file mode 100644 index 0000000000..d3eef7a82b --- /dev/null +++ b/examples/ios_build/ios_utils.bzl @@ -0,0 +1,38 @@ +"""Utility rules""" + +def _transition_platform_impl(_, attr): + return {"//command_line_option:platforms": str(attr.platform)} + +_transition_platform = transition( + implementation = _transition_platform_impl, + inputs = [], + outputs = ["//command_line_option:platforms"], +) + +def _platform_transition_filegroup_impl(ctx): + files = depset(transitive = [src[DefaultInfo].files for src in ctx.attr.srcs]) + runfiles = ctx.runfiles().merge_all([src[DefaultInfo].default_runfiles for src in ctx.attr.srcs]) + + return [DefaultInfo( + files = files, + runfiles = runfiles, + )] + +platform_transition_filegroup = rule( + doc = "Transitions a target to the provided platform.", + implementation = _platform_transition_filegroup_impl, + attrs = { + "platform": attr.label( + doc = "The platform to transition to.", + mandatory = True, + ), + "srcs": attr.label_list( + doc = "The targets to transition", + allow_files = True, + cfg = _transition_platform, + ), + "_allowlist_function_transition": attr.label( + default = "@bazel_tools//tools/allowlists/function_transition_allowlist", + ), + }, +) diff --git a/examples/ios_build/platform_mappings b/examples/ios_build/platform_mappings deleted file mode 100644 index 3b9c09712b..0000000000 --- a/examples/ios_build/platform_mappings +++ /dev/null @@ -1,21 +0,0 @@ -# https://github.com/bazelbuild/rules_apple/issues/1658 -flags: - --cpu=darwin_x86_64 - --apple_platform_type=macos - //:macos_x86_64 - - --cpu=darwin_arm64 - --apple_platform_type=macos - //:macos_arm64 - - --cpu=ios_x86_64 - --apple_platform_type=ios - //:ios_x86_64 - - --cpu=ios_sim_arm64 - --apple_platform_type=ios - //:ios_sim_arm64 - - --cpu=ios_arm64 - --apple_platform_type=ios - //:ios_arm64 From acd65046b9bd7ec37f729164d16baac0677c3646 Mon Sep 17 00:00:00 2001 From: UebelAndre Date: Mon, 6 Jan 2025 10:24:19 -0800 Subject: [PATCH 2/3] Bump rules_apple --- examples/ios/MODULE.bazel | 2 +- examples/ios_build/MODULE.bazel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/ios/MODULE.bazel b/examples/ios/MODULE.bazel index 25d9c479a3..317aff7a83 100644 --- a/examples/ios/MODULE.bazel +++ b/examples/ios/MODULE.bazel @@ -15,7 +15,7 @@ local_path_override( bazel_dep( name = "rules_apple", - version = "3.9.2", + version = "3.16.1", repo_name = "build_bazel_rules_apple", ) bazel_dep( diff --git a/examples/ios_build/MODULE.bazel b/examples/ios_build/MODULE.bazel index 9d3ccddf07..79a388331a 100644 --- a/examples/ios_build/MODULE.bazel +++ b/examples/ios_build/MODULE.bazel @@ -15,7 +15,7 @@ local_path_override( bazel_dep( name = "rules_apple", - version = "3.9.2", + version = "3.16.1", repo_name = "build_bazel_rules_apple", ) bazel_dep( From ea1e0fa311c852764e3346c3ac1ab45633b049c4 Mon Sep 17 00:00:00 2001 From: UebelAndre Date: Mon, 6 Jan 2025 22:29:54 -0800 Subject: [PATCH 3/3] debug --- examples/ios/MODULE.bazel | 5 +++++ examples/ios/environment_plist.patch | 13 +++++++++++++ examples/ios_build/MODULE.bazel | 5 +++++ examples/ios_build/environment_plist.patch | 13 +++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 examples/ios/environment_plist.patch create mode 100644 examples/ios_build/environment_plist.patch diff --git a/examples/ios/MODULE.bazel b/examples/ios/MODULE.bazel index 317aff7a83..8c3f5535ca 100644 --- a/examples/ios/MODULE.bazel +++ b/examples/ios/MODULE.bazel @@ -18,6 +18,11 @@ bazel_dep( version = "3.16.1", repo_name = "build_bazel_rules_apple", ) +single_version_override( + module_name = "rules_apple", + patch_strip = 1, + patches = ["//:environment_plist.patch"], +) bazel_dep( name = "apple_support", version = "1.17.1", diff --git a/examples/ios/environment_plist.patch b/examples/ios/environment_plist.patch new file mode 100644 index 0000000000..b450ae3e45 --- /dev/null +++ b/examples/ios/environment_plist.patch @@ -0,0 +1,13 @@ +diff --git a/tools/environment_plist/environment_plist.sh b/tools/environment_plist/environment_plist.sh +index 1dca56d..926a179 100755 +--- a/tools/environment_plist/environment_plist.sh ++++ b/tools/environment_plist/environment_plist.sh +@@ -24,7 +24,7 @@ + # --platform - the target platform, e.g. 'iphoneos' or 'iphonesimulator8.3' + # + +-set -eu ++set -xeu + + while [[ $# > 1 ]] + do diff --git a/examples/ios_build/MODULE.bazel b/examples/ios_build/MODULE.bazel index 79a388331a..1b70ce8e69 100644 --- a/examples/ios_build/MODULE.bazel +++ b/examples/ios_build/MODULE.bazel @@ -18,6 +18,11 @@ bazel_dep( version = "3.16.1", repo_name = "build_bazel_rules_apple", ) +single_version_override( + module_name = "rules_apple", + patch_strip = 1, + patches = ["//:environment_plist.patch"], +) bazel_dep( name = "apple_support", version = "1.17.1", diff --git a/examples/ios_build/environment_plist.patch b/examples/ios_build/environment_plist.patch new file mode 100644 index 0000000000..b450ae3e45 --- /dev/null +++ b/examples/ios_build/environment_plist.patch @@ -0,0 +1,13 @@ +diff --git a/tools/environment_plist/environment_plist.sh b/tools/environment_plist/environment_plist.sh +index 1dca56d..926a179 100755 +--- a/tools/environment_plist/environment_plist.sh ++++ b/tools/environment_plist/environment_plist.sh +@@ -24,7 +24,7 @@ + # --platform - the target platform, e.g. 'iphoneos' or 'iphonesimulator8.3' + # + +-set -eu ++set -xeu + + while [[ $# > 1 ]] + do