Skip to content

Commit

Permalink
Add support for aarch64-apple-ios-sim (#1304)
Browse files Browse the repository at this point in the history
This adds / improves support for for the arm64 iOS simulator that's used
on M1 macs. Previously there was ambiguity in the constraints used for
this platform because bazel does not pick the best match, so this adds
the device constraint in this case to disambiguate. Ideally we could
rely on not having the `sim` suffix to be enough to add the device
constraint, but older triples like `x86_64-apple-ios` break this
pattern. I broke this logic out into a new function since it relies on
more info from the triple than just the ABI now.

bazelbuild/bazel#11454

Co-authored-by: UebelAndre <github@uebelandre.com>
  • Loading branch information
keith and UebelAndre committed May 4, 2022
1 parent 61eee54 commit 73d0164
Show file tree
Hide file tree
Showing 7 changed files with 470 additions and 403 deletions.
4 changes: 2 additions & 2 deletions docs/crate_universe.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ CARGO_BAZEL_REPIN=1 bazel sync --only=crate_index
| <a id="crates_repository-rust_toolchain_rustc_template"></a>rust_toolchain_rustc_template | The template to use for finding the host <code>rustc</code> binary. <code>{version}</code> (eg. '1.53.0'), <code>{triple}</code> (eg. 'x86_64-unknown-linux-gnu'), <code>{arch}</code> (eg. 'aarch64'), <code>{vendor}</code> (eg. 'unknown'), <code>{system}</code> (eg. 'darwin'), <code>{cfg}</code> (eg. 'exec'), and <code>{tool}</code> (eg. 'cargo.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}//:bin/{tool}" |
| <a id="crates_repository-rust_version"></a>rust_version | The version of Rust the currently registered toolchain is using. Eg. <code>1.56.0</code>, or <code>nightly-2021-09-08</code> | String | optional | "1.60.0" |
| <a id="crates_repository-splicing_config"></a>splicing_config | The configuration flags to use for splicing Cargo maniests. Use <code>//crate_universe:defs.bzl\%rsplicing_config</code> to generate the value for this field. If unset, the defaults defined there will be used. | String | optional | "" |
| <a id="crates_repository-supported_platform_triples"></a>supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | ["i686-apple-darwin", "i686-pc-windows-msvc", "i686-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "aarch64-apple-ios", "aarch64-linux-android", "aarch64-unknown-linux-gnu", "arm-unknown-linux-gnueabi", "armv7-unknown-linux-gnueabi", "i686-linux-android", "i686-unknown-freebsd", "powerpc-unknown-linux-gnu", "s390x-unknown-linux-gnu", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-ios", "x86_64-linux-android", "x86_64-unknown-freebsd"] |
| <a id="crates_repository-supported_platform_triples"></a>supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | ["i686-apple-darwin", "i686-pc-windows-msvc", "i686-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "aarch64-apple-ios", "aarch64-apple-ios-sim", "aarch64-linux-android", "aarch64-unknown-linux-gnu", "arm-unknown-linux-gnueabi", "armv7-unknown-linux-gnueabi", "i686-linux-android", "i686-unknown-freebsd", "powerpc-unknown-linux-gnu", "s390x-unknown-linux-gnu", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-ios", "x86_64-linux-android", "x86_64-unknown-freebsd"] |


<a id="#crates_vendor"></a>
Expand Down Expand Up @@ -357,7 +357,7 @@ bazel run //3rdparty:crates_vendor
| <a id="crates_vendor-packages"></a>packages | A set of crates (packages) specifications to depend on. See [crate.spec](#crate.spec). | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {} |
| <a id="crates_vendor-repository_name"></a>repository_name | The name of the repository to generate for <code>remote</code> vendor modes. If unset, the label name will be used | String | optional | "" |
| <a id="crates_vendor-splicing_config"></a>splicing_config | The configuration flags to use for splicing Cargo maniests. Use <code>//crate_universe:defs.bzl\%rsplicing_config</code> to generate the value for this field. If unset, the defaults defined there will be used. | String | optional | "" |
| <a id="crates_vendor-supported_platform_triples"></a>supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | ["i686-apple-darwin", "i686-pc-windows-msvc", "i686-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "aarch64-apple-ios", "aarch64-linux-android", "aarch64-unknown-linux-gnu", "arm-unknown-linux-gnueabi", "armv7-unknown-linux-gnueabi", "i686-linux-android", "i686-unknown-freebsd", "powerpc-unknown-linux-gnu", "s390x-unknown-linux-gnu", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-ios", "x86_64-linux-android", "x86_64-unknown-freebsd"] |
| <a id="crates_vendor-supported_platform_triples"></a>supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | ["i686-apple-darwin", "i686-pc-windows-msvc", "i686-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "aarch64-apple-ios", "aarch64-apple-ios-sim", "aarch64-linux-android", "aarch64-unknown-linux-gnu", "arm-unknown-linux-gnueabi", "armv7-unknown-linux-gnueabi", "i686-linux-android", "i686-unknown-freebsd", "powerpc-unknown-linux-gnu", "s390x-unknown-linux-gnu", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-ios", "x86_64-linux-android", "x86_64-unknown-freebsd"] |
| <a id="crates_vendor-vendor_path"></a>vendor_path | The path to a directory to write files into. Absolute paths will be treated as relative to the workspace root | String | optional | "crates" |


Expand Down
136 changes: 84 additions & 52 deletions examples/crate_universe/cargo_aliases/Cargo.Bazel.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "9ad48990a8663e815687344f038d7a5f809b2c5697e6bc0c5743814b0602587f",
"checksum": "4db863fcdc1f3dee93107cadf3262fa2c3a004faf707a8765b083a653da41b12",
"crates": {
"aho-corasick 0.7.18": {
"name": "aho-corasick",
Expand Down Expand Up @@ -150,7 +150,7 @@
],
"cfg(unix)": [
{
"id": "libc 0.2.122",
"id": "libc 0.2.125",
"target": "libc"
}
],
Expand Down Expand Up @@ -269,13 +269,13 @@
},
"license": "MIT/Apache-2.0"
},
"clap 3.1.8": {
"clap 3.1.12": {
"name": "clap",
"version": "3.1.8",
"version": "3.1.12",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/clap/3.1.8/download",
"sha256": "71c47df61d9e16dc010b55dba1952a57d8c215dbb533fd13cdd13369aac73b1c"
"url": "https://crates.io/api/v1/crates/clap/3.1.12/download",
"sha256": "7c167e37342afc5f33fd87bbc870cedd020d2a6dffa05d45ccd9241fbdd146db"
}
},
"targets": [
Expand Down Expand Up @@ -319,6 +319,10 @@
"id": "bitflags 1.3.2",
"target": "bitflags"
},
{
"id": "clap_lex 0.1.1",
"target": "clap_lex"
},
{
"id": "indexmap 1.8.1",
"target": "indexmap"
Expand All @@ -327,10 +331,6 @@
"id": "lazy_static 1.4.0",
"target": "lazy_static"
},
{
"id": "os_str_bytes 6.0.0",
"target": "os_str_bytes"
},
{
"id": "strsim 0.10.0",
"target": "strsim"
Expand All @@ -356,7 +356,7 @@
],
"selects": {}
},
"version": "3.1.8"
"version": "3.1.12"
},
"license": "MIT OR Apache-2.0"
},
Expand Down Expand Up @@ -406,11 +406,11 @@
"target": "proc_macro2"
},
{
"id": "quote 1.0.17",
"id": "quote 1.0.18",
"target": "quote"
},
{
"id": "syn 1.0.91",
"id": "syn 1.0.92",
"target": "syn"
}
],
Expand All @@ -421,6 +421,48 @@
},
"license": "MIT OR Apache-2.0"
},
"clap_lex 0.1.1": {
"name": "clap_lex",
"version": "0.1.1",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/clap_lex/0.1.1/download",
"sha256": "189ddd3b5d32a70b35e7686054371742a937b0d99128e76dde6340210e966669"
}
},
"targets": [
{
"Library": {
"crate_name": "clap_lex",
"crate_root": "src/lib.rs",
"srcs": {
"include": [
"**/*.rs"
],
"exclude": []
}
}
}
],
"library_target_name": "clap_lex",
"common_attrs": {
"compile_data_glob": [
"**"
],
"deps": {
"common": [
{
"id": "os_str_bytes 6.0.0",
"target": "os_str_bytes"
}
],
"selects": {}
},
"edition": "2018",
"version": "0.1.1"
},
"license": "MIT OR Apache-2.0"
},
"ctor 0.1.22": {
"name": "ctor",
"version": "0.1.22",
Expand Down Expand Up @@ -452,11 +494,11 @@
"deps": {
"common": [
{
"id": "quote 1.0.17",
"id": "quote 1.0.18",
"target": "quote"
},
{
"id": "syn 1.0.91",
"id": "syn 1.0.92",
"target": "syn"
}
],
Expand Down Expand Up @@ -579,7 +621,7 @@
],
"cfg(unix)": [
{
"id": "libc 0.2.122",
"id": "libc 0.2.125",
"target": "libc"
}
]
Expand Down Expand Up @@ -696,7 +738,7 @@
"deps": {
"common": [
{
"id": "libc 0.2.122",
"id": "libc 0.2.125",
"target": "libc"
}
],
Expand Down Expand Up @@ -848,13 +890,13 @@
},
"license": "MIT/Apache-2.0"
},
"libc 0.2.122": {
"libc 0.2.125": {
"name": "libc",
"version": "0.2.122",
"version": "0.2.125",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/libc/0.2.122/download",
"sha256": "ec647867e2bf0772e28c8bcde4f0d19a9216916e890543b5a03ed8ef27b8f259"
"url": "https://crates.io/api/v1/crates/libc/0.2.125/download",
"sha256": "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b"
}
},
"targets": [
Expand Down Expand Up @@ -891,14 +933,14 @@
"deps": {
"common": [
{
"id": "libc 0.2.122",
"id": "libc 0.2.125",
"target": "build_script_build"
}
],
"selects": {}
},
"edition": "2015",
"version": "0.2.122"
"version": "0.2.125"
},
"build_script_attrs": {
"data_glob": [
Expand Down Expand Up @@ -1145,7 +1187,7 @@
"deps": {
"common": [
{
"id": "clap 3.1.8",
"id": "clap 3.1.12",
"target": "clap"
},
{
Expand Down Expand Up @@ -1229,7 +1271,7 @@
"deps": {
"common": [
{
"id": "clap 3.1.8",
"id": "clap 3.1.12",
"target": "clap"
},
{
Expand Down Expand Up @@ -1282,19 +1324,8 @@
"**"
],
"crate_features": [
"default",
"memchr",
"raw_os_str"
],
"deps": {
"common": [
{
"id": "memchr 2.4.1",
"target": "memchr"
}
],
"selects": {}
},
"edition": "2018",
"version": "6.0.0"
},
Expand Down Expand Up @@ -1393,11 +1424,11 @@
"target": "proc_macro2"
},
{
"id": "quote 1.0.17",
"id": "quote 1.0.18",
"target": "quote"
},
{
"id": "syn 1.0.91",
"id": "syn 1.0.92",
"target": "syn"
}
],
Expand Down Expand Up @@ -1482,7 +1513,7 @@
"target": "proc_macro2"
},
{
"id": "quote 1.0.17",
"id": "quote 1.0.18",
"target": "quote"
}
],
Expand Down Expand Up @@ -1574,13 +1605,13 @@
},
"license": "MIT OR Apache-2.0"
},
"quote 1.0.17": {
"quote 1.0.18": {
"name": "quote",
"version": "1.0.17",
"version": "1.0.18",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/quote/1.0.17/download",
"sha256": "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58"
"url": "https://crates.io/api/v1/crates/quote/1.0.18/download",
"sha256": "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
}
},
"targets": [
Expand Down Expand Up @@ -1616,7 +1647,7 @@
"selects": {}
},
"edition": "2018",
"version": "1.0.17"
"version": "1.0.18"
},
"license": "MIT OR Apache-2.0"
},
Expand Down Expand Up @@ -1671,7 +1702,7 @@
"selects": {
"cfg(unix)": [
{
"id": "libc 0.2.122",
"id": "libc 0.2.125",
"target": "libc"
}
]
Expand Down Expand Up @@ -1904,13 +1935,13 @@
},
"license": "MIT"
},
"syn 1.0.91": {
"syn 1.0.92": {
"name": "syn",
"version": "1.0.91",
"version": "1.0.92",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/syn/1.0.91/download",
"sha256": "b683b2b825c8eef438b77c36a06dc262294da3d5a5813fac20da149241dcd44d"
"url": "https://crates.io/api/v1/crates/syn/1.0.92/download",
"sha256": "7ff7c592601f11445996a06f8ad0c27f094a58857c2f89e97974ab9235b92c52"
}
},
"targets": [
Expand Down Expand Up @@ -1961,11 +1992,11 @@
"target": "proc_macro2"
},
{
"id": "quote 1.0.17",
"id": "quote 1.0.18",
"target": "quote"
},
{
"id": "syn 1.0.91",
"id": "syn 1.0.92",
"target": "build_script_build"
},
{
Expand All @@ -1976,7 +2007,7 @@
"selects": {}
},
"edition": "2018",
"version": "1.0.91"
"version": "1.0.92"
},
"build_script_attrs": {
"data_glob": [
Expand Down Expand Up @@ -2509,6 +2540,7 @@
"cfg(unix)": [
"aarch64-apple-darwin",
"aarch64-apple-ios",
"aarch64-apple-ios-sim",
"aarch64-linux-android",
"aarch64-unknown-linux-gnu",
"arm-unknown-linux-gnueabi",
Expand Down
Loading

0 comments on commit 73d0164

Please sign in to comment.