Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nmattia committed Nov 4, 2024
1 parent f697bf8 commit 0522c21
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 17 deletions.
22 changes: 13 additions & 9 deletions Cargo.Bazel.json.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "0f968bb13a23433173eea3d49515a1711cc6e4731fba155d32bf7a6bc949d3e7",
"checksum": "48649a7946d4c66d40482e351dabdafcfef5e5a4fca240019e226c6cd6eee10e",
"crates": {
"abnf 0.12.0": {
"name": "abnf",
Expand Down Expand Up @@ -70445,10 +70445,12 @@
"**"
],
"data": {
"common": [
"@jemalloc//:libjemalloc"
],
"selects": {}
"common": [],
"selects": {
"x86_64-unknown-linux-gnu": [
"@jemalloc//:libjemalloc"
]
}
},
"data_glob": [
"**"
Expand All @@ -70463,10 +70465,12 @@
"selects": {}
},
"build_script_env": {
"common": {
"JEMALLOC_OVERRIDE": "$(location @jemalloc//:libjemalloc)"
},
"selects": {}
"common": {},
"selects": {
"x86_64-unknown-linux-gnu": {
"JEMALLOC_OVERRIDE": "$(location @jemalloc//:libjemalloc)"
}
}
},
"links": "jemalloc"
},
Expand Down
1 change: 0 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ bazel_dep(name = "rules_foreign_cc", version = "0.12.0")
register_toolchains(
"@rules_foreign_cc//toolchains:preinstalled_pkgconfig_toolchain",
"@rules_foreign_cc//toolchains:preinstalled_make_toolchain",
"@rules_foreign_cc//toolchains:preinstalled_autoconf_toolchain",
)

# use HEAD to include
Expand Down
24 changes: 18 additions & 6 deletions bazel/external_crates.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,24 @@ def external_crates_repository(name, cargo_lockfile, lockfile, sanitizers_enable
"tikv-jemalloc-sys": [crate.annotation(
# TODO: fix wording, we _are_ indeed building from source but not from the crate's build.rs
# Avoid building jemalloc from source (in part bc it creates builder-specific config files)
build_script_data = [
"@jemalloc//:libjemalloc",
],
build_script_env = {
"JEMALLOC_OVERRIDE": "$(location @jemalloc//:libjemalloc)",
},

build_script_data = crate.select([], {
"x86_64-unknown-linux-gnu":
[
"@jemalloc//:libjemalloc",
],
}),
build_script_env = crate.select({},
{
"x86_64-unknown-linux-gnu":
{ "JEMALLOC_OVERRIDE": "$(location @jemalloc//:libjemalloc)" },
}),
#build_script_data = [
# "@jemalloc//:libjemalloc",
#],
#build_script_env = {
# "JEMALLOC_OVERRIDE": "$(location @jemalloc//:libjemalloc)",
#},
)],
"cranelift-isle": [crate.annotation(
# Patch for determinism issues
Expand Down
28 changes: 28 additions & 0 deletions bazel/rules_rust.patch
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,31 @@ index 2dab3578..b5bb4fca 100644
.unwrap_or_else(|_| panic!("Unable to write file {:?}", stderr_path));

let CompileAndLinkFlags {
diff --git a/crate_universe/private/crate.bzl b/crate_universe/private/crate.bzl
index c493e9a6..ad317abf 100644
--- a/crate_universe/private/crate.bzl
+++ b/crate_universe/private/crate.bzl
@@ -230,7 +230,22 @@ def _stringify_label(value):
def _stringify_list(values):
if not values:
return values
- return [str(x) for x in values]
+
+ if type(values) == "list":
+ return [str(x) for x in values]
+
+
+
+
+ if type(values) == "struct" and type(values.selects) != "NoneType":
+ new_selects = {}
+
+ for k, v in values.selects.items():
+ new_selects[k] = [str(x) for x in values.selects[k]]
+
+ return struct(common = [str(x) for x in values.common], selects = new_selects)
+
+ fail("Cannot stringify unknown type for list '{}'".format(values))

def _select(common, selects):
"""A Starlark Select for `crate.annotation()`.
2 changes: 1 addition & 1 deletion bin/bazel-pin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ fi
if [ "${CRATES:-}" == "" ]; then
echo "Repinning all crates"
CARGO_BAZEL_REPIN=1 bazel sync --only=crate_index
SANITIZERS_ENABLED=1 CARGO_BAZEL_REPIN=1 bazel sync --only=crate_index
#SANITIZERS_ENABLED=1 CARGO_BAZEL_REPIN=1 bazel sync --only=crate_index
else
echo "Repinning ${#CRATES[@]} crates"
for crate in "${CRATES[@]}"; do
Expand Down

0 comments on commit 0522c21

Please sign in to comment.