Compare commits

...

12 Commits

Author SHA1 Message Date
Cornelius Riemenschneider
3888a4c2d0 apply rules_rust patch. 2024-06-12 16:22:40 +02:00
Cornelius Riemenschneider
ce1544aa27 Only upload log file. 2024-06-12 11:06:51 +02:00
Cornelius Riemenschneider
e557c80079 set fail-fast: true. 2024-06-12 10:57:58 +02:00
Cornelius Riemenschneider
f07a83665c upload whole bazel output base 2024-06-12 10:57:09 +02:00
Cornelius Riemenschneider
9284979096 add win 2022. 2024-06-12 01:28:31 +02:00
Cornelius Riemenschneider
f3bc1e1112 fix path. 2024-06-12 01:27:38 +02:00
Cornelius Riemenschneider
2b46ae4f2b move to windows 2019 2024-06-12 01:23:42 +02:00
Cornelius Riemenschneider
b4eb356a19 set output base path 2024-06-12 00:30:15 +02:00
Cornelius Riemenschneider
bfefeafa2c fix visibility. 2024-06-12 00:16:30 +02:00
Cornelius Riemenschneider
37da35e2c8 again 2024-06-12 00:06:37 +02:00
Cornelius Riemenschneider
f1c5d19e66 try to fix workflow. 2024-06-12 00:04:30 +02:00
Cornelius Riemenschneider
4d893ac66c Try to reproduce bazel problem in public repo. 2024-06-12 00:02:30 +02:00
6 changed files with 105 additions and 11 deletions

View File

@@ -16,6 +16,7 @@ test --build_tests_only
# this requires developer mode, but is required to have pack installer functioning
startup --windows_enable_symlinks
common --enable_runfiles
startup --output_base=C:/tmp
# with the above, we can avoid building python zips which is the default on windows as that's expensive
build --nobuild_python_zip

View File

@@ -1 +1 @@
7.2.0
76286491d0bacaf790ea8e6fa76ae5bdf6dd3db2

24
.github/workflows/criemen-debug.yml vendored Normal file
View File

@@ -0,0 +1,24 @@
name: Debug bazel problem
on:
workflow_dispatch:
push:
branches:
- criemen/repr-bazel-bug
jobs:
build:
strategy:
fail-fast: true
matrix:
os: [windows-2019, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: build
shell: powershell
run: bazel build "//ruby:ruby-arch-zip"
- uses: actions/upload-artifact@v4
if: failure()
with:
name: debug-${{ runner.os }}
path: C:\tmp\*log*

View File

@@ -29,7 +29,36 @@ bazel_dep(name = "googletest", version = "1.14.0.bcr.1")
bazel_dep(name = "rules_rust", version = "0.46.0")
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
single_version_override(
module_name = "rules_rust",
patch_strip = 1,
patches = ["//:rules_rust.patch"],
)
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
edition = "2021",
# We need to specify both here so that we can do cross-compilation for macos
extra_target_triples = [
"x86_64-apple-darwin",
"aarch64-apple-darwin",
],
versions = [
"1.74.0",
],
)
use_repo(
rust,
"rust_toolchains",
)
register_toolchains("@rust_toolchains//:all")
rust_host_tools = use_extension("//rust:extensions.bzl", "rust_host_tools")
# Don't download a second toolchain as host toolchain, make sure this is the same version as above
rust_host_tools.host_tools(version = "1.70.0", edition = "2021")
use_repo(rust_host_tools, "rust_host_tools")
crate = use_extension(
"@rules_rust//crate_universe:extension.bzl",
"crate",

View File

@@ -1,6 +1,4 @@
load("@rules_rust//rust:defs.bzl", "rust_binary")
load("@semmle_code//buildutils-internal:glibc_symbols_check.bzl", "glibc_symbols_check")
load("@semmle_code//buildutils-internal:lipo.bzl", "universal_binary")
def codeql_rust_binary(
name,
@@ -8,16 +6,18 @@ def codeql_rust_binary(
visibility = None,
symbols_test = True,
**kwargs):
rust_label_name = name + "_single_arch"
universal_binary(
# rust_label_name = name + "_single_arch"
# universal_binary(
# name = name,
# dep = ":" + rust_label_name,
# target_compatible_with = target_compatible_with,
# visibility = visibility,
# )
rust_binary(
name = name,
dep = ":" + rust_label_name,
target_compatible_with = target_compatible_with,
visibility = visibility,
)
rust_binary(
name = rust_label_name,
**kwargs
)
if symbols_test:
glibc_symbols_check(name = name + "symbols-test", binary = name)
# if symbols_test:
# glibc_symbols_check(name = name + "symbols-test", binary = name)

40
rules_rust.patch Normal file
View File

@@ -0,0 +1,40 @@
diff --git a/crate_universe/extension.bzl b/crate_universe/extension.bzl
index 509401d5..e946eb3a 100644
--- a/crate_universe/extension.bzl
+++ b/crate_universe/extension.bzl
@@ -228,7 +228,7 @@ def _package_to_json(p):
})
def _get_generator(module_ctx):
- """Query Network Resources to local a `cargo-bazel` binary.
+ """Query Network Resources to local a `cargo-bazel` binary.
Based off get_generator in crates_universe/private/generate_utils.bzl
@@ -348,16 +348,24 @@ def _crate_impl(module_ctx):
all_repos.append(cfg.name)
local_repos.append(cfg.name)
+ # Postpone actually calling _generate_hub_and_spokes as it's rather expensive, and _every_ module_ctx.path can cause
+ # a restart of the module extension. In partigular with multiple cargo configurations, we'd run `cargo-bazel`
+ # a lot of times for no good reason, because the restart mechanism would cause us to re-run the entire module extension.
+ # Save the parameters in this list, and only call _generate_hub_and_spokes once we have all labels resolved.
+ # We do not need to batch the calls from specs, as those do not call module_ctx.path, and don't cause restarts.
+ generate_hubs_and_spokes_calls = []
for cfg in mod.tags.from_cargo:
annotations = _annotations_for_repo(
module_annotations,
repo_specific_annotations.get(cfg.name),
)
-
cargo_lockfile = module_ctx.path(cfg.cargo_lockfile)
manifests = {str(module_ctx.path(m)): str(m) for m in cfg.manifests}
- _generate_hub_and_spokes(module_ctx, cargo_bazel, cfg, annotations, cargo_lockfile = cargo_lockfile, manifests = manifests)
+ generate_hubs_and_spokes_calls.append((cfg, annotations, cargo_lockfile, manifests))
+ for call in generate_hubs_and_spokes_calls:
+ cfg, annotations, cargo_lockfile, manifests = call
+ _generate_hub_and_spokes(module_ctx, cargo_bazel, cfg, annotations, cargo_lockfile = cargo_lockfile, manifests = manifests)
for cfg in mod.tags.from_specs:
# We don't have a Cargo.lock so the resolution can change.
# We could maybe make this reproducible by using `-minimal-version` during resolution.