Mercurial
diff third_party/bun/BUILD @ 12:de54585a40f1
Adding bun and node modules.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Thu, 02 Oct 2025 14:39:48 -0700 |
| parents | |
| children | 7d3fa1a7a854 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/third_party/bun/BUILD Thu Oct 02 14:39:48 2025 -0700 @@ -0,0 +1,51 @@ +load("//gui_ze:gui_ze.bzl", "bun_binary") + +alias( + name = "bun", + actual = select({ + "//config:macos": ":bun_darwin_arm64", + "//config:linux": ":bun_linux_aarch64", + "//conditions:default": ":bun_linux_aarch64", + }), + visibility = ["//visibility:public"], +) + +bun_binary( + name = "bun_darwin_arm64", + srcs = ["@bun_darwin_arm64_zip//file"], + target_compatible_with = [ + "@platforms//os:osx", + ], + visibility = ["//visibility:public"], +) + +genrule( + name = "bun_linux_aarch64", + srcs = ["@bun_linux_aarch64_zip//file"], + outs = ["bun_linux"], # must be a file, not a directory + cmd = """ + mkdir -p $(@D) + unzip -j $(SRCS) bun-linux-aarch64/bun -d $(@D) + chmod +x $(@D)/bun + mv $(@D)/bun $@ + """, + executable = True, + target_compatible_with = [ + "@platforms//os:linux", + ], + visibility = ["//visibility:public"], +) + +filegroup( + name = "node_modules", + srcs = [ + "package.json", "tsconfig.json", "bun.lock", + ] + glob(["node_modules/**"]), + visibility = ["//visibility:public"], +) + +filegroup( + name = "bun_dir", + srcs = glob(["**"], exclude = ["BUILD", "bun"],), + visibility = ["//visibility:public"], +)