Skip to content

Commit dd9cd7b

Browse files
authored
Upgrade to bazel modules ✨ ✨ ✨
Stay on bazel 7.x for now as there is a windows symlink related issue with bazel 8 when using rules_js node modules. use aspect_rules_js and vite instead of esbuild move to mainline zig hermetic_cc toolchain use multiarch image with rules_oci instead of separate image per arch many other things...
1 parent c6f8295 commit dd9cd7b

35 files changed

+11491
-1296
lines changed

.bazelignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bundle/node_modules

.bazelrc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1-
build --symlink_prefix=target/
21
build --incompatible_enable_cc_toolchain_resolution=1
2+
common --enable_bzlmod
3+
4+
# passes an argument `--skipLibCheck` to *every* spawn of the TypeScript compiler, tsc
5+
common --@aspect_rules_ts//ts:skipLibCheck=always
6+
7+
common:windows --enable_runfiles

.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.6.1

.github/workflows/build.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
- name: build opt
2626
run: bazel build //server:opt
2727
- name: build arm64 image
28-
# docker golang library not implemented on windows
28+
# rules_oci currently not working on windows
29+
# https://github.com/bazel-contrib/rules_oci/pull/827
2930
if: matrix.os != 'windows-latest'
30-
run: bazel build //server:image-arm64
31+
run: bazel build //server:image-multiarch

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/dist
33
node_modules
44
buck-out
5+
bazel-*

BUILD

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
load("@crate_index//:defs.bzl", "aliases", "all_crate_deps")
1+
load("@aspect_rules_js//js:defs.bzl", "js_library", "js_run_binary", "js_run_devserver", "js_test")
22
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
3-
load("@rules_rust//wasm_bindgen:defs.bzl", "rust_wasm_bindgen")
3+
load("@crate_index//:defs.bzl", "aliases", "all_crate_deps")
44
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library")
5+
load("@rules_rust_wasm_bindgen//:defs.bzl", "rust_wasm_bindgen")
56
load("//emsdk:emsdk.bzl", "wasmopt")
67

78
package(
@@ -41,7 +42,6 @@ rust_binary(
4142
],
4243
":fastbuild": [],
4344
"//conditions:default": [
44-
"-Clto",
4545
"-Ccodegen-units=1",
4646
"-Cpanic=abort",
4747
"-Copt-level=z",
@@ -51,7 +51,6 @@ rust_binary(
5151
normal = True,
5252
) + [
5353
":implfuture",
54-
"@rules_rust//wasm_bindgen/3rdparty:wasm_bindgen",
5554
],
5655
)
5756

@@ -97,37 +96,30 @@ filegroup(
9796
name = "static_files",
9897
srcs = glob(["static/**"]) + [
9998
":tailwind",
100-
":copybundletostatic",
99+
"//bundle",
101100
],
102101
)
103102

104-
genrule(
105-
name = "tailwind",
106-
srcs = glob(["src/**/*.rs"]) + ["tailwind.config.js"],
107-
outs = ["static/tailwind.css"],
108-
cmd = "$(execpath @root_npm//tailwindcss/bin:tailwindcss) --output=$(OUTS)",
109-
tools = ["@root_npm//tailwindcss/bin:tailwindcss"],
110-
visibility = ["//:__pkg__"],
111-
)
112-
113-
genrule(
114-
name = "copybundletostatic",
115-
srcs = ["//bundle"],
116-
outs = ["static/bundle.js"],
117-
cmd = "cp $(@D)/../bundle/bundle.js $(OUTS)",
118-
cmd_bat = "copy \"$(@D)\\..\\bundle\\bundle.js\" $(OUTS)",
119-
)
120-
121103
wasmopt(
122104
name = "app_wasm_opt",
123105
src = ":app_wasm",
124-
out = "app_wasm_bg_opt.wasm",
106+
out = "app_wasm/app_wasm_bg_opt.wasm",
125107
)
126108

127109
genrule(
128110
name = "app_wasm_opt_br",
129111
srcs = [":app_wasm_opt"],
130-
outs = ["app_wasm_bg_opt.wasm.br"],
112+
outs = ["app_wasm/app_wasm_bg_opt.wasm.br"],
131113
cmd = "$(execpath @brotli) -9 $<",
132114
tools = ["@brotli"],
133115
)
116+
117+
js_run_binary(
118+
name = "tailwind",
119+
srcs = glob(["src/**/*.rs"]) + [
120+
"tailwind.config.js",
121+
],
122+
args = ["--output=static/css/tailwind.css"],
123+
out_dirs = ["static/css"],
124+
tool = "//bundle:tailwindcss",
125+
)

Cargo.lock

Lines changed: 41 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ members = [".", "server"]
1212
name = "app"
1313

1414
[dependencies]
15-
wasm-bindgen = "=0.2.92"
15+
wasm-bindgen = "=0.2.100"
1616
log = "0.4"
1717
stylist = { version = "0.10.1", features = [
1818
"yew",

0 commit comments

Comments
 (0)