comparison 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
comparison
equal deleted inserted replaced
248:b8b6e726964a 249:c5129452493e
1 load("@rules_cc//cc:cc_binary.bzl", "cc_binary") 1 load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
2 load("@rules_shell//shell:sh_binary.bzl", "sh_binary") 2 load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
3 load("@rules_shell//shell:sh_test.bzl", "sh_test")
3 load("//gui_ze:gui_ze.bzl", "move_files_into_dir", "bundle", "bun_bundle") 4 load("//gui_ze:gui_ze.bzl", "move_files_into_dir", "bundle", "bun_bundle")
4 5
5 # Source files 6 # Source files
6 filegroup( 7 filegroup(
7 name = "src_ts_files", 8 name = "src_ts_files",
51 filegroup( 52 filegroup(
52 name = "all_assets", 53 name = "all_assets",
53 srcs = glob(["src/**"]) + [":compiled_js", ":public_files", ":public_fonts_files"], 54 srcs = glob(["src/**"]) + [":compiled_js", ":public_files", ":public_fonts_files"],
54 ) 55 )
55 56
57 genrule(
58 name = "run_hg_web_launcher",
59 srcs = ["run.sh"],
60 outs = ["run_hg_web"],
61 cmd = "cp $(location run.sh) $@ && chmod 0555 $@",
62 )
63
64 filegroup(
65 name = "mercurial_runtime_data",
66 srcs = select({
67 "//config:linux_x86_64": ["//third_party/mercurial:runtime"],
68 "//conditions:default": [],
69 }),
70 )
71
72 filegroup(
73 name = "runtime_files",
74 srcs = [
75 ":run_hg_web_launcher",
76 ":mercurial_runtime_data",
77 ],
78 )
79
56 # Server binaries 80 # Server binaries
57 cc_binary( 81 cc_binary(
58 name = "hg_web_server", 82 name = "hg_web_server",
59 srcs = ["main.c"], 83 srcs = ["main.c"],
60 deps = ["//seobeo:seobeo"], 84 deps = ["//seobeo:seobeo"],
61 data = [":all_assets"], 85 data = [
86 ":all_assets",
87 ":runtime_files",
88 ],
62 visibility = ["//hg-web:__subpackages__"], 89 visibility = ["//hg-web:__subpackages__"],
63 ) 90 )
64 91
65 cc_binary( 92 cc_binary(
66 name = "hg_web_server_debug", 93 name = "hg_web_server_debug",
67 srcs = ["main.c"], 94 srcs = ["main.c"],
68 deps = ["//seobeo:seobeo"], 95 deps = ["//seobeo:seobeo"],
69 data = [":all_assets"], 96 data = [
97 ":all_assets",
98 ":runtime_files",
99 ],
70 ) 100 )
71 101
72 sh_binary( 102 sh_binary(
73 name = "dev", 103 name = "dev",
74 srcs = ["dev.sh"], 104 srcs = ["dev.sh"],
75 data = [ 105 data = [
76 ":hg_web_server", 106 ":hg_web_server",
107 ":mercurial_runtime_data",
77 "@bazel_tools//tools/bash/runfiles", 108 "@bazel_tools//tools/bash/runfiles",
78 ], 109 ],
79 ) 110 )
80 111
81 test_suite( 112 test_suite(
82 name = "tests", 113 name = "tests",
83 tests = ["//hg-web/e2e:app_e2e_test"], 114 tests = [
115 ":repository_sync_test",
116 "//hg-web/e2e:app_e2e_test",
117 ],
118 )
119
120 sh_test(
121 name = "repository_sync_test",
122 srcs = ["repository_sync_test.sh"],
123 data = [
124 "//third_party/mercurial:runtime",
125 "@bazel_tools//tools/bash/runfiles",
126 ],
127 target_compatible_with = [
128 "@platforms//cpu:x86_64",
129 "@platforms//os:linux",
130 ],
84 ) 131 )
85 132
86 bundle( 133 bundle(
87 name = "hg_web_server_bundle", 134 name = "hg_web_server_bundle",
88 binary = ":hg_web_server", 135 binary = ":hg_web_server",
91 sh_binary( 138 sh_binary(
92 name = "deploy", 139 name = "deploy",
93 srcs = ["deploy.sh"], 140 srcs = ["deploy.sh"],
94 data = [ 141 data = [
95 ":hg_web_server_bundle", 142 ":hg_web_server_bundle",
143 "nginx/hg-web.conf.template",
144 "systemd/hg-web.service.template",
96 "@bazel_tools//tools/bash/runfiles", 145 "@bazel_tools//tools/bash/runfiles",
97 ], 146 ],
98 ) 147 )