comparison mrjunejune/BUILD @ 242:543df0fe7168

[tools] Add full HLS player support
author MrJuneJune <me@mrjunejune.com>
date Mon, 03 Aug 2026 13:14:41 -0700
parents 9c2eec61a152
children b8aa08503378
comparison
equal deleted inserted replaced
241:9c2eec61a152 242:543df0fe7168
1 load("@rules_cc//cc:cc_binary.bzl", "cc_binary") 1 load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
2 load("@rules_cc//cc:cc_library.bzl", "cc_library") 2 load("@rules_cc//cc:cc_library.bzl", "cc_library")
3 load("@aspect_rules_js//js:defs.bzl", "js_library")
3 load("@rules_shell//shell:sh_binary.bzl", "sh_binary") 4 load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
4 load("//gui_ze:gui_ze.bzl", "move_files_into_dir", "bundle", "webp_image") 5 load("//gui_ze:gui_ze.bzl", "move_files_into_dir", "bundle", "webp_image")
5 6
6 _PNG_ASSETS = [ 7 _PNG_ASSETS = [
7 "23k", 8 "23k",
64 ":webp_{}".format(asset.replace("-", "_")) 65 ":webp_{}".format(asset.replace("-", "_"))
65 for asset in _PNG_ASSETS 66 for asset in _PNG_ASSETS
66 ], 67 ],
67 ) 68 )
68 69
70 filegroup(
71 name = "sample_hls_mp4",
72 srcs = ["assets/video/sample_hls.mp4"],
73 visibility = [
74 "//mrjunejune:__pkg__",
75 "//third_party/ffmpeg:__pkg__",
76 ],
77 )
78
79 cc_binary(
80 name = "generate_hls_sample",
81 srcs = ["generate_hls_sample.c"],
82 args = [
83 "$(location :sample_hls_mp4)",
84 "mrjunejune/src/public/hls-sample",
85 ],
86 data = [":sample_hls_mp4"],
87 deps = ["//third_party/ffmpeg:ffmpeg_cli"],
88 )
89
69 move_files_into_dir( 90 move_files_into_dir(
70 name = "generated_public_webp", 91 name = "generated_public_webp",
71 srcs = [":generated_webp_assets"], 92 srcs = [":generated_webp_assets"],
72 dest = "src/public", 93 dest = "src/public",
73 ) 94 )
74 95
75 # Files 96 # Files
97 move_files_into_dir(
98 name = "hlsjs_runtime",
99 srcs = ["@hlsjs//:dist/hls.min.js"],
100 dest = "src/public",
101 )
102
76 move_files_into_dir( 103 move_files_into_dir(
77 name = "react_pages", 104 name = "react_pages",
78 srcs = [ 105 srcs = [
79 "//react_games:games" 106 "//react_games:games"
80 ], 107 ],
117 filegroup( 144 filegroup(
118 name = "public_files", 145 name = "public_files",
119 srcs = glob( 146 srcs = glob(
120 ["src/public/*"], 147 ["src/public/*"],
121 exclude = ["src/public/*.png"], 148 exclude = ["src/public/*.png"],
122 ) + [":generated_public_webp"], 149 ) + [":generated_public_webp", ":hlsjs_runtime"],
123 visibility = ["//visibility:public"], 150 visibility = ["//visibility:public"],
124 ) 151 )
125 152
126 filegroup( 153 filegroup(
127 name = "public_fonts_files", 154 name = "public_fonts_files",
132 filegroup( 159 filegroup(
133 name = "src_files", 160 name = "src_files",
134 srcs = glob( 161 srcs = glob(
135 ["src/**"], 162 ["src/**"],
136 exclude = ["src/**/*.png"], 163 exclude = ["src/**/*.png"],
137 ) + [":react_pages", ":shared_js_non_public", ":shared_js_file", ":rich_editor_js", ":icons", ":generated_public_webp"], 164 ) + [":react_pages", ":shared_js_non_public", ":shared_js_file", ":rich_editor_js", ":icons", ":generated_public_webp", ":hlsjs_runtime"],
165 visibility = ["//mrjunejune/test:__pkg__"],
166 )
167
168 js_library(
169 name = "hls_player_js",
170 srcs = ["src/tools/hls_player/hls-player.js"],
138 visibility = ["//mrjunejune/test:__pkg__"], 171 visibility = ["//mrjunejune/test:__pkg__"],
139 ) 172 )
140 173
141 # Server binary 174 # Server binary
142 cc_binary( 175 cc_binary(