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 " )
22load ("@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 " )
44load ("@rules_rust//rust:defs.bzl" , "rust_binary" , "rust_library" )
5+ load ("@rules_rust_wasm_bindgen//:defs.bzl" , "rust_wasm_bindgen" )
56load ("//emsdk:emsdk.bzl" , "wasmopt" )
67
78package (
@@ -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-
121103wasmopt (
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
127109genrule (
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+ )
0 commit comments