diff hg-web/BUILD @ 249:c5129452493e

[deploy] Bundle Mercurial with hg-web Co-authored-by: Copilot <[email protected]>
author MrJuneJune <me@mrjunejune.com>
date Tue, 04 Aug 2026 04:16:45 -0700
parents 8bb0ac8f4587
children
line wrap: on
line diff
--- a/hg-web/BUILD	Tue Aug 04 02:44:06 2026 -0700
+++ b/hg-web/BUILD	Tue Aug 04 04:16:45 2026 -0700
@@ -1,5 +1,6 @@
 load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
 load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
+load("@rules_shell//shell:sh_test.bzl", "sh_test")
 load("//gui_ze:gui_ze.bzl", "move_files_into_dir", "bundle", "bun_bundle")
 
 # Source files
@@ -53,12 +54,38 @@
   srcs = glob(["src/**"]) + [":compiled_js", ":public_files", ":public_fonts_files"],
 )
 
+genrule(
+  name = "run_hg_web_launcher",
+  srcs = ["run.sh"],
+  outs = ["run_hg_web"],
+  cmd = "cp $(location run.sh) $@ && chmod 0555 $@",
+)
+
+filegroup(
+  name = "mercurial_runtime_data",
+  srcs = select({
+    "//config:linux_x86_64": ["//third_party/mercurial:runtime"],
+    "//conditions:default": [],
+  }),
+)
+
+filegroup(
+  name = "runtime_files",
+  srcs = [
+    ":run_hg_web_launcher",
+    ":mercurial_runtime_data",
+  ],
+)
+
 # Server binaries
 cc_binary(
   name = "hg_web_server",
   srcs = ["main.c"],
   deps = ["//seobeo:seobeo"],
-  data = [":all_assets"],
+  data = [
+    ":all_assets",
+    ":runtime_files",
+  ],
   visibility = ["//hg-web:__subpackages__"],
 )
 
@@ -66,7 +93,10 @@
   name = "hg_web_server_debug",
   srcs = ["main.c"],
   deps = ["//seobeo:seobeo"],
-  data = [":all_assets"],
+  data = [
+    ":all_assets",
+    ":runtime_files",
+  ],
 )
 
 sh_binary(
@@ -74,13 +104,30 @@
   srcs = ["dev.sh"],
   data = [
     ":hg_web_server",
+    ":mercurial_runtime_data",
     "@bazel_tools//tools/bash/runfiles",
   ],
 )
 
 test_suite(
   name = "tests",
-  tests = ["//hg-web/e2e:app_e2e_test"],
+  tests = [
+    ":repository_sync_test",
+    "//hg-web/e2e:app_e2e_test",
+  ],
+)
+
+sh_test(
+  name = "repository_sync_test",
+  srcs = ["repository_sync_test.sh"],
+  data = [
+    "//third_party/mercurial:runtime",
+    "@bazel_tools//tools/bash/runfiles",
+  ],
+  target_compatible_with = [
+    "@platforms//cpu:x86_64",
+    "@platforms//os:linux",
+  ],
 )
 
 bundle(
@@ -93,6 +140,8 @@
   srcs = ["deploy.sh"],
   data = [
     ":hg_web_server_bundle",
+    "nginx/hg-web.conf.template",
+    "systemd/hg-web.service.template",
     "@bazel_tools//tools/bash/runfiles",
   ],
 )