Skip to content

Commit 150eafa

Browse files
committed
Add an example to check the flags are being stripped
1 parent c435779 commit 150eafa

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

examples/ios/BUILD.bazel

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application")
22
load("@build_bazel_rules_apple//apple:macos.bzl", "macos_application")
33
load("@rules_cc//cc:defs.bzl", "cc_library", "objc_library")
44
load("@rules_rust//rust:defs.bzl", "rust_library")
5+
load("@rules_rust//cargo:cargo_build_script.bzl", "cargo_build_script")
56

67
cc_library(
78
name = "allocator_library",
@@ -90,3 +91,14 @@ platform(
9091
"@build_bazel_apple_support//constraints:device",
9192
],
9293
)
94+
95+
cargo_build_script(
96+
name = "build_script",
97+
srcs = ["build.rs"],
98+
)
99+
100+
rust_library(
101+
name = "build_script_consumer",
102+
srcs = ["empty.rs"],
103+
deps = [":build_script"],
104+
)

examples/ios/build.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
fn main() {
2+
let flags = std::env::var("CFLAGS").unwrap();
3+
// the host architecture used to run the build script should not leak into the
4+
// CFLAGS, or the build script may compile code for the wrong architecture
5+
assert!(!flags.contains("-isysroot"));
6+
assert!(!flags.contains("-target"));
7+
}

examples/ios/empty.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)