Mercurial
annotate gui_ze/gui_ze.bzl @ 273:e02e2036ef84 default tip
add Layer 2 JRPG component system
Add reusable content and window modals, an isolated component sandbox, shared cyberpunk scroll areas, production-safe cache freshness, and server-rendered JRPG panel state.
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Sat, 08 Aug 2026 02:08:08 -0700 |
| parents | 1f9877b637e9 |
| children |
| rev | line source |
|---|---|
|
8
98f96b8032e5
[GuiZe] Creating custom bazel rule to deploy to github easily.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1 def _foo_impl(ctx): |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
2 out = ctx.actions.declare_file(ctx.label.name) |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
3 ctx.actions.write( |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
4 output = out, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
5 content = "Hello!\n", |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
6 ) |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
7 return [DefaultInfo(files = depset([out]))] |
|
8
98f96b8032e5
[GuiZe] Creating custom bazel rule to deploy to github easily.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
8 |
|
98f96b8032e5
[GuiZe] Creating custom bazel rule to deploy to github easily.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
9 foo_binary = rule( |
|
98f96b8032e5
[GuiZe] Creating custom bazel rule to deploy to github easily.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
10 implementation = _foo_impl, |
|
98f96b8032e5
[GuiZe] Creating custom bazel rule to deploy to github easily.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
11 ) |
|
98f96b8032e5
[GuiZe] Creating custom bazel rule to deploy to github easily.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
12 |
|
260
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
13 def _shell_quote(value): |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
14 return "'{}'".format(value.replace("'", "'\"'\"'")) |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
15 |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
16 def _bundle_impl(ctx): |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
17 """ |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
18 bundle binary target into a folder which can later be used to make a post to github easily. |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
19 """ |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
20 binary_target = ctx.attr.binary |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
21 binary = binary_target[DefaultInfo].files.to_list()[0] # First files are binary |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
22 runfiles_files = binary_target[DefaultInfo].default_runfiles.files.to_list() |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
23 |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
24 # Name as output directory |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
25 out_dir = ctx.actions.declare_directory(ctx.label.name) |
|
260
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
26 manifest = ctx.actions.declare_file(ctx.label.name + ".runfiles_manifest") |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
27 manifest_lines = [] |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
28 |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
29 for f in runfiles_files: |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
30 if f.path == binary.path: |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
31 continue |
|
15
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
12
diff
changeset
|
32 |
|
260
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
33 short_path = f.short_path |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
34 if f.short_path.startswith("../"): |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
35 short_path = short_path[3:] |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
36 paths = "/".join(short_path.split("/")[:-1]) |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
37 full_path = "{}/{}".format(out_dir.path, paths) |
|
260
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
38 manifest_lines.append("{}\t{}\n".format(f.path, full_path)) |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
39 |
|
260
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
40 ctx.actions.write( |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
41 output = manifest, |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
42 content = "".join(manifest_lines), |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
43 ) |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
44 |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
45 ctx.actions.run_shell( |
|
260
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
46 inputs = runfiles_files + [manifest], |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
47 outputs = [out_dir], |
|
260
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
48 command = """ |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
49 set -eu |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
50 mkdir -p {out_dir} |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
51 while IFS=$'\\t' read -r source destination; do |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
52 mkdir -p "$destination" |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
53 cp -rL "$source" "$destination" |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
54 done < {manifest} |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
55 cp {binary} {out_dir} |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
56 """.format( |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
57 binary = _shell_quote(binary.path), |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
58 manifest = _shell_quote(manifest.path), |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
59 out_dir = _shell_quote(out_dir.path), |
|
1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
MrJuneJune <mrjunejune@users.noreply.github.com>
parents:
247
diff
changeset
|
60 ), |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
61 progress_message = "Bundling {}".format(ctx.label.name), |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
62 ) |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
63 return [DefaultInfo(files = depset([out_dir]))] |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
64 |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
65 bundle = rule( |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
66 implementation = _bundle_impl, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
67 attrs = { |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
68 "binary": attr.label( |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
69 doc = "The cc_binary target to bundle", |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
70 providers = [DefaultInfo], |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
71 ), |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
72 }, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
73 ) |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
74 |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
75 |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
76 def _bun_binary_impl(ctx): |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
77 out = ctx.actions.declare_file("bun") |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
78 ctx.actions.run_shell( |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
79 inputs = ctx.files.srcs, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
80 outputs = [out], |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
81 command = """ |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
82 mkdir -p {outdir} |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
83 unzip -j {src} {inner} -d {outdir} |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
84 chmod +x {outdir}/bun |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
85 """.format( |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
86 outdir = out.dirname, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
87 src = ctx.files.srcs[0].path, |
|
24
7d3fa1a7a854
[GuiZe] Support x86 chip for bun.
June Park <parkjune1995@gmail.com>
parents:
15
diff
changeset
|
88 inner = ctx.attr.src_folder, |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
89 out = out.path, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
90 ), |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
91 ) |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
92 return DefaultInfo( |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
93 files = depset([out]), |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
94 executable = out, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
95 ) |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
96 |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
97 bun_binary = rule( |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
98 implementation = _bun_binary_impl, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
99 attrs = { |
|
25
342726584be2
[Bun] Fixed how bun would be ran within bazel.
June Park <parkjune1995@gmail.com>
parents:
24
diff
changeset
|
100 "srcs": attr.label_list(allow_files=True), |
|
342726584be2
[Bun] Fixed how bun would be ran within bazel.
June Park <parkjune1995@gmail.com>
parents:
24
diff
changeset
|
101 "src_folder": attr.string(), |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
102 }, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
103 executable = True, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
104 ) |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
105 |
|
190
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
106 def _bun_bundle_impl(ctx): |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
107 """ |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
108 Bundle TypeScript/JavaScript with Bun, resolving imports from bazel root. |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
109 |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
110 Copies all dependencies (dereferencing symlinks) to create a flat structure |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
111 where imports can resolve correctly relative to the bazel workspace root. |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
112 """ |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
113 out = ctx.actions.declare_file(ctx.label.name + ".js") |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
114 |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
115 inputs = depset( |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
116 direct = [ctx.file.src], |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
117 transitive = [dep[DefaultInfo].files for dep in ctx.attr.deps] |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
118 ) |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
119 |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
120 # Get the source file's package directory (e.g., "hg-web" from "hg-web/src/main.tsx") |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
121 src_package = ctx.file.src.path.split("/")[0] |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
122 |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
123 # Collect unique root directories to copy (deduped), excluding src_package (handled separately) |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
124 dirs_to_copy = {} |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
125 for f in ctx.files.deps: |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
126 # Find the root directory path by locating where short_path starts in full path |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
127 short_path_suffix = "/".join(f.short_path.split("/")[1:]) |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
128 pos = f.path.find(short_path_suffix) |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
129 if pos > 0: |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
130 root_dir = f.path[:pos].rstrip("/") |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
131 # Skip src_package - it's a symlink that needs special handling |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
132 if not root_dir.endswith(src_package): |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
133 dirs_to_copy[root_dir] = True |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
134 |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
135 # Build copy commands for each unique directory |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
136 copy_commands = ["cp -rL {dir} .".format(dir = d) for d in dirs_to_copy.keys()] |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
137 |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
138 ctx.actions.run_shell( |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
139 inputs = inputs, |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
140 outputs = [out], |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
141 tools = [ctx.executable._bun] + [ctx.file.src] + ctx.files.deps + ctx.files.node_modules, |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
142 command = """ |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
143 cp -rL {src_package} {src_package}_tmp && rm -rf {src_package} && mv {src_package}_tmp {src_package} |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
144 {copy_commands} |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
145 export NODE_PATH=./third_party/bun/node_modules |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
146 cp ./third_party/bun/tsconfig.json . |
| 193 | 147 {bun} build {entry} --outfile {output} --target browser |
|
190
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
148 """.format( |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
149 copy_commands = "\n".join(copy_commands), |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
150 src_package = src_package, |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
151 bun = ctx.executable._bun.path, |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
152 entry = ctx.file.src.path, |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
153 output = out.path, |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
154 ), |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
155 progress_message = "Bundling %s with Bun" % ctx.file.src.short_path, |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
156 ) |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
157 |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
158 return [DefaultInfo(files = depset([out]))] |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
159 |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
160 bun_bundle = rule( |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
161 implementation = _bun_bundle_impl, |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
162 attrs = { |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
163 "src": attr.label( |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
164 allow_single_file = [".ts", ".tsx", ".js", ".jsx"], |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
165 doc = "Entry point file to bundle", |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
166 ), |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
167 "deps": attr.label_list( |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
168 allow_files = True, |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
169 doc = "Source files and other dependencies to include", |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
170 ), |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
171 "node_modules": attr.label_list( |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
172 allow_files = True, |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
173 default = [Label("//third_party/bun:bun_files")], |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
174 doc = "Node modules for bundling (defaults to //third_party/bun:bun_files)", |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
175 ), |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
176 "_bun": attr.label( |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
177 default = Label("//third_party/bun:bun"), |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
178 executable = True, |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
179 cfg = "exec", |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
180 ), |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
181 }, |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
182 doc = "Bundle TypeScript/JavaScript using Bun with bazel root imports", |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
183 ) |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
184 |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
185 |
|
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
186 |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
187 def _bun_build_impl(ctx): |
|
15
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
12
diff
changeset
|
188 """ |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
12
diff
changeset
|
189 Run bun build on the folder |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
12
diff
changeset
|
190 |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
12
diff
changeset
|
191 This sucks because you need to either copy node module into the root folder where main.ts file |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
12
diff
changeset
|
192 exists or copy everything outwards. I chose to do it in this way. |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
12
diff
changeset
|
193 |
|
25
342726584be2
[Bun] Fixed how bun would be ran within bazel.
June Park <parkjune1995@gmail.com>
parents:
24
diff
changeset
|
194 TODO: If possible, maybe create a node_module inside of the main target path and create a symlink |
|
342726584be2
[Bun] Fixed how bun would be ran within bazel.
June Park <parkjune1995@gmail.com>
parents:
24
diff
changeset
|
195 TODO: Add a specific path for node_modules |
|
15
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
12
diff
changeset
|
196 """ |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
197 out = ctx.actions.declare_file(ctx.label.name + ".js") |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
198 inputs = [ctx.file.src] + ctx.files.data |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
199 |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
200 ctx.actions.run_shell( |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
201 inputs = inputs, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
202 outputs = [out], |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
203 tools = [ctx.executable._bun] + inputs, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
204 command = """ |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
205 cp -r third_party/bun/** . \ |
|
25
342726584be2
[Bun] Fixed how bun would be ran within bazel.
June Park <parkjune1995@gmail.com>
parents:
24
diff
changeset
|
206 && cp -r {src_folder}/** . \ |
|
176
fed99fc04e12
[HgWeb] Problem with the emscript lol
MrJuneJune <me@mrjunejune.com>
parents:
175
diff
changeset
|
207 && cp -r ./bazel-out/k8-fastbuild/bin/hg-web/src/** src \ |
|
fed99fc04e12
[HgWeb] Problem with the emscript lol
MrJuneJune <me@mrjunejune.com>
parents:
175
diff
changeset
|
208 && ls src \ |
|
190
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
209 && pwd \ |
|
175
71ad34a8bc9a
[HgWeb] Can stream hg response now. Added react page for hg web since we use json anyway.
MrJuneJune <me@mrjunejune.com>
parents:
168
diff
changeset
|
210 && export NODE_PATH=./node_modules && {bun_path} build {input_path} --outfile {output_path} --target browser |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
211 """.format( |
|
25
342726584be2
[Bun] Fixed how bun would be ran within bazel.
June Park <parkjune1995@gmail.com>
parents:
24
diff
changeset
|
212 bun_path = ctx.executable._bun.path, |
|
342726584be2
[Bun] Fixed how bun would be ran within bazel.
June Park <parkjune1995@gmail.com>
parents:
24
diff
changeset
|
213 src_folder = ctx.attr.src_folder, |
|
175
71ad34a8bc9a
[HgWeb] Can stream hg response now. Added react page for hg web since we use json anyway.
MrJuneJune <me@mrjunejune.com>
parents:
168
diff
changeset
|
214 # Fix this lol |
|
71ad34a8bc9a
[HgWeb] Can stream hg response now. Added react page for hg web since we use json anyway.
MrJuneJune <me@mrjunejune.com>
parents:
168
diff
changeset
|
215 input_path = "/".join(ctx.file.src.path.split("/")[-2:]), |
|
25
342726584be2
[Bun] Fixed how bun would be ran within bazel.
June Park <parkjune1995@gmail.com>
parents:
24
diff
changeset
|
216 output_path = out.path, |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
217 ), |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
218 progress_message = "Bundling {} with Bun!\n\n".format(ctx.file.src.path), |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
219 ) |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
220 |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
221 return [DefaultInfo(files=depset([out]))] |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
222 |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
223 bun_build = rule( |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
224 implementation = _bun_build_impl, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
225 attrs = { |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
226 "src": attr.label(allow_single_file = [".ts", ".tsx", ".js", ".jsx"]), |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
227 "_bun": attr.label( |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
228 default = Label("//third_party/bun:bun"), |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
229 executable = True, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
230 cfg = "exec", |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
231 ), |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
232 "data": attr.label_list(allow_files=True), |
|
25
342726584be2
[Bun] Fixed how bun would be ran within bazel.
June Park <parkjune1995@gmail.com>
parents:
24
diff
changeset
|
233 "src_folder": attr.string(), |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
234 }, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
235 ) |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
236 |
|
156
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
237 def _bun_run_impl(ctx): |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
238 actual_exe = ctx.actions.declare_file(ctx.label.name) |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
239 |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
240 # 1. Get the workspace name (crucial for runfiles paths) |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
241 workspace_name = ctx.workspace_name |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
242 |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
243 # 2. Define the paths relative to the runfiles root |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
244 bun_path = ctx.executable._bun.short_path |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
245 src_path = ctx.file.src.short_path |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
246 |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
247 # 3. Create the launcher script |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
248 # We use a template to handle the environment and pathing |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
249 script_content = """#!/bin/bash |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
250 # Find the runfiles directory |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
251 if [[ -z "$RUNFILES_DIR" ]]; then |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
252 if [[ -d "$0.runfiles" ]]; then |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
253 RUNFILES_DIR="$0.runfiles" |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
254 fi |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
255 fi |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
256 |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
257 # Navigate to the workspace root inside runfiles |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
258 cd "$RUNFILES_DIR/{workspace}" |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
259 pwd |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
260 # Execute bun with the src file and any extra arguments |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
261 exec "./{bun_bin}" run "./{src_file}" "$@" |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
262 """.format( |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
263 workspace = workspace_name, |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
264 bun_bin = bun_path, |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
265 src_file = src_path |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
266 ) |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
267 |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
268 ctx.actions.write( |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
269 output = actual_exe, |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
270 content = script_content, |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
271 is_executable = True, |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
272 ) |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
273 |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
274 return [ |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
275 DefaultInfo( |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
276 executable = actual_exe, |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
277 runfiles = ctx.runfiles( |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
278 files = [ctx.file.src] + ctx.files.data + ctx.files._bun_files |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
279 ).merge(ctx.attr._bun[DefaultInfo].default_runfiles), |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
280 ), |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
281 ] |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
282 |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
283 # TODO: Fix the rules so that it can do relative import. |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
284 bun_run = rule( |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
285 implementation = _bun_run_impl, |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
286 executable = True, |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
287 attrs = { |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
288 "src": attr.label(allow_single_file = True, mandatory = True), |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
289 "data": attr.label_list(allow_files = True), |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
290 "_bun": attr.label( |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
291 default = Label("//third_party/bun:bun"), |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
292 executable = True, |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
293 cfg = "exec" |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
294 ), |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
295 "_bun_files": attr.label(default = Label("//third_party/bun:bun_files")), |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
296 }, |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
297 ) |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
298 |
|
cd35e600ae34
[MarkDown Converter] Fixed few things and made a test
June Park <parkjune1995@gmail.com>
parents:
154
diff
changeset
|
299 |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
300 def _move_files_into_dir_impl(ctx): |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
301 srcs = ctx.files.srcs |
|
64
a30944e5719e
Added vibe coded markdown to html script since it is useful for me. Updated Dowa so that it can be compiled without dirnet for windows.
June Park <parkjune1995@gmail.com>
parents:
58
diff
changeset
|
302 outs = [] |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
303 for src in srcs: |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
304 out = ctx.actions.declare_file(ctx.attr.dest + "/" + src.basename) |
|
64
a30944e5719e
Added vibe coded markdown to html script since it is useful for me. Updated Dowa so that it can be compiled without dirnet for windows.
June Park <parkjune1995@gmail.com>
parents:
58
diff
changeset
|
305 ctx.actions.run_shell( |
|
a30944e5719e
Added vibe coded markdown to html script since it is useful for me. Updated Dowa so that it can be compiled without dirnet for windows.
June Park <parkjune1995@gmail.com>
parents:
58
diff
changeset
|
306 inputs = [src], |
|
a30944e5719e
Added vibe coded markdown to html script since it is useful for me. Updated Dowa so that it can be compiled without dirnet for windows.
June Park <parkjune1995@gmail.com>
parents:
58
diff
changeset
|
307 outputs = [out], |
|
176
fed99fc04e12
[HgWeb] Problem with the emscript lol
MrJuneJune <me@mrjunejune.com>
parents:
175
diff
changeset
|
308 command = "cp -r \"$1\" \"$2\"", |
|
64
a30944e5719e
Added vibe coded markdown to html script since it is useful for me. Updated Dowa so that it can be compiled without dirnet for windows.
June Park <parkjune1995@gmail.com>
parents:
58
diff
changeset
|
309 arguments = [src.path, out.path], |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
310 ) |
|
64
a30944e5719e
Added vibe coded markdown to html script since it is useful for me. Updated Dowa so that it can be compiled without dirnet for windows.
June Park <parkjune1995@gmail.com>
parents:
58
diff
changeset
|
311 outs.append(out) |
|
190
a2725419f988
Updated so that bun builds will with already existing js files.
MrJuneJune <me@mrjunejune.com>
parents:
186
diff
changeset
|
312 return [DefaultInfo(files = depset(outs), runfiles = ctx.runfiles(files = outs))] |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
313 |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
314 move_files_into_dir = rule( |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
315 implementation = _move_files_into_dir_impl, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
316 attrs = { |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
317 "srcs": attr.label_list(allow_files=True), |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
318 "dest": attr.string(), |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
319 }, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
320 ) |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
321 |
|
241
9c2eec61a152
[assets] Generate site images as WebP with Bazel
MrJuneJune <me@mrjunejune.com>
parents:
193
diff
changeset
|
322 def webp_image(name, src, out, quality = 90, lossless = False): |
|
9c2eec61a152
[assets] Generate site images as WebP with Bazel
MrJuneJune <me@mrjunejune.com>
parents:
193
diff
changeset
|
323 """Convert one image to WebP as a Bazel build action.""" |
|
9c2eec61a152
[assets] Generate site images as WebP with Bazel
MrJuneJune <me@mrjunejune.com>
parents:
193
diff
changeset
|
324 native.genrule( |
|
9c2eec61a152
[assets] Generate site images as WebP with Bazel
MrJuneJune <me@mrjunejune.com>
parents:
193
diff
changeset
|
325 name = name, |
|
9c2eec61a152
[assets] Generate site images as WebP with Bazel
MrJuneJune <me@mrjunejune.com>
parents:
193
diff
changeset
|
326 srcs = [src], |
|
9c2eec61a152
[assets] Generate site images as WebP with Bazel
MrJuneJune <me@mrjunejune.com>
parents:
193
diff
changeset
|
327 outs = [out], |
|
9c2eec61a152
[assets] Generate site images as WebP with Bazel
MrJuneJune <me@mrjunejune.com>
parents:
193
diff
changeset
|
328 tools = ["@libwebp_linux_x86_64//:bin/cwebp"], |
|
9c2eec61a152
[assets] Generate site images as WebP with Bazel
MrJuneJune <me@mrjunejune.com>
parents:
193
diff
changeset
|
329 cmd = "$(location @libwebp_linux_x86_64//:bin/cwebp) -quiet -m 6 {} -q {} $(location {}) -o $@".format( |
|
9c2eec61a152
[assets] Generate site images as WebP with Bazel
MrJuneJune <me@mrjunejune.com>
parents:
193
diff
changeset
|
330 "-lossless" if lossless else "", |
|
9c2eec61a152
[assets] Generate site images as WebP with Bazel
MrJuneJune <me@mrjunejune.com>
parents:
193
diff
changeset
|
331 quality, |
|
9c2eec61a152
[assets] Generate site images as WebP with Bazel
MrJuneJune <me@mrjunejune.com>
parents:
193
diff
changeset
|
332 src, |
|
9c2eec61a152
[assets] Generate site images as WebP with Bazel
MrJuneJune <me@mrjunejune.com>
parents:
193
diff
changeset
|
333 ), |
|
9c2eec61a152
[assets] Generate site images as WebP with Bazel
MrJuneJune <me@mrjunejune.com>
parents:
193
diff
changeset
|
334 ) |
|
9c2eec61a152
[assets] Generate site images as WebP with Bazel
MrJuneJune <me@mrjunejune.com>
parents:
193
diff
changeset
|
335 |
|
12
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
336 def _move_to_directory_impl(ctx): |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
337 srcs = ctx.files.data |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
338 res = [] |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
339 for src in srcs: |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
340 true = "/".join(src.path.split("/")[2:]) |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
341 path = ctx.attr.dest + "/" + true if ctx.attr.dest != "" else true |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
342 out = ctx.actions.declare_file( |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
343 path |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
344 ); |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
345 ctx.actions.symlink( |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
346 output = out, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
347 target_file = src, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
348 ) |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
349 res.append(out) |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
350 return [DefaultInfo(files = depset(res))] |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
351 |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
352 move_to_directory = rule( |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
353 implementation = _move_to_directory_impl, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
354 attrs = { |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
355 "data": attr.label_list(allow_files=True), |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
356 "dest": attr.string(), |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
357 }, |
|
de54585a40f1
Adding bun and node modules.
June Park <parkjune1995@gmail.com>
parents:
8
diff
changeset
|
358 ) |
|
58
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
359 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
360 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
361 def _macos_app_impl(ctx): |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
362 """Implementation for creating a macOS .app bundle from a binary.""" |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
363 binary = ctx.file.binary |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
364 app_name = ctx.attr.app_name |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
365 bundle_id = ctx.attr.bundle_id |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
366 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
367 # Declare the .app directory as output |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
368 app_dir = ctx.actions.declare_directory(app_name + ".app") |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
369 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
370 ctx.actions.run_shell( |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
371 inputs = [binary], |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
372 outputs = [app_dir], |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
373 command = """ |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
374 set -e |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
375 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
376 APPDIR="{app_dir}" |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
377 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
378 rm -rf "$APPDIR" |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
379 mkdir -p "$APPDIR/Contents/MacOS" |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
380 mkdir -p "$APPDIR/Contents/Resources" |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
381 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
382 cp {binary} "$APPDIR/Contents/MacOS/{app_name}" |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
383 chmod +x "$APPDIR/Contents/MacOS/{app_name}" |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
384 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
385 cat > "$APPDIR/Contents/Info.plist" <<EOF |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
386 <?xml version="1.0" encoding="UTF-8"?> |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
387 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
388 "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
389 <plist version="1.0"> |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
390 <dict> |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
391 <key>CFBundleExecutable</key> |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
392 <string>{app_name}</string> |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
393 <key>CFBundleIdentifier</key> |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
394 <string>{bundle_id}</string> |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
395 <key>CFBundleName</key> |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
396 <string>{app_name}</string> |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
397 <key>CFBundleVersion</key> |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
398 <string>1.0</string> |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
399 </dict> |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
400 </plist> |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
401 EOF |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
402 """.format( |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
403 app_dir = app_dir.path, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
404 binary = binary.path, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
405 app_name = app_name, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
406 bundle_id = bundle_id, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
407 ), |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
408 progress_message = "Creating macOS app bundle for {}".format(app_name), |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
409 ) |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
410 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
411 return [DefaultInfo(files = depset([app_dir]))] |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
412 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
413 _macos_app = rule( |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
414 implementation = _macos_app_impl, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
415 attrs = { |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
416 "binary": attr.label( |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
417 allow_single_file = True, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
418 mandatory = True, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
419 doc = "The binary to bundle into a .app", |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
420 ), |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
421 "app_name": attr.string( |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
422 mandatory = True, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
423 doc = "Name of the application", |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
424 ), |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
425 "bundle_id": attr.string( |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
426 mandatory = True, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
427 doc = "Bundle identifier (e.g., com.example.app)", |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
428 ), |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
429 }, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
430 ) |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
431 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
432 def _macos_signed_app_impl(ctx): |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
433 """Implementation for signing a macOS .app bundle.""" |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
434 app_dir = ctx.file.app |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
435 app_name = ctx.attr.app_name |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
436 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
437 # Declare the signed .app directory as output |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
438 signed_app_dir = ctx.actions.declare_directory(app_name + "_signed.app") |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
439 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
440 ctx.actions.run_shell( |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
441 inputs = [app_dir], |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
442 outputs = [signed_app_dir], |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
443 command = """ |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
444 set -e |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
445 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
446 APPDIR="{app_dir}" |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
447 SIGNEDDIR="{signed_dir}" |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
448 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
449 rm -rf "$SIGNEDDIR" |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
450 # Use -L to dereference symlinks, as codesign doesn't work with symlinks |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
451 cp -RL "$APPDIR" "$SIGNEDDIR" |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
452 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
453 codesign --deep --force --sign - "$SIGNEDDIR" |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
454 """.format( |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
455 app_dir = app_dir.path, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
456 signed_dir = signed_app_dir.path, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
457 ), |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
458 progress_message = "Signing macOS app bundle {}".format(app_name), |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
459 ) |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
460 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
461 return [DefaultInfo(files = depset([signed_app_dir]))] |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
462 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
463 _macos_signed_app = rule( |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
464 implementation = _macos_signed_app_impl, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
465 attrs = { |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
466 "app": attr.label( |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
467 allow_single_file = True, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
468 mandatory = True, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
469 doc = "The .app directory to sign", |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
470 ), |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
471 "app_name": attr.string( |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
472 mandatory = True, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
473 doc = "Name of the application", |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
474 ), |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
475 }, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
476 ) |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
477 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
478 def macos_app_and_dmg(name, binary, bundle_id = "com.example.app"): |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
479 """ |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
480 Creates a macOS .app bundle, signs it, and packages it into a DMG. |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
481 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
482 Args: |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
483 name: Base name for the generated targets |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
484 binary: Label of the binary target to bundle |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
485 bundle_id: Bundle identifier for the app (default: com.example.app) |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
486 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
487 Generates: |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
488 {name}_app: The .app bundle |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
489 {name}_signed_app: The signed .app bundle |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
490 {name}_dmg: The final DMG file |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
491 """ |
|
168
f3084bca7317
[Misc] Fixed all errors and all tests should pass now.
MrJuneJune <me@mrjunejune.com>
parents:
156
diff
changeset
|
492 macos_constraint = ["@platforms//os:macos"] |
|
f3084bca7317
[Misc] Fixed all errors and all tests should pass now.
MrJuneJune <me@mrjunejune.com>
parents:
156
diff
changeset
|
493 |
|
58
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
494 # 1. Build the .app bundle |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
495 _macos_app( |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
496 name = name + "_app", |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
497 binary = binary, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
498 app_name = name, |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
499 bundle_id = bundle_id, |
|
168
f3084bca7317
[Misc] Fixed all errors and all tests should pass now.
MrJuneJune <me@mrjunejune.com>
parents:
156
diff
changeset
|
500 target_compatible_with = macos_constraint, |
|
58
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
501 ) |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
502 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
503 # 2. Sign the .app |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
504 _macos_signed_app( |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
505 name = name + "_signed_app", |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
506 app = ":" + name + "_app", |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
507 app_name = name, |
|
168
f3084bca7317
[Misc] Fixed all errors and all tests should pass now.
MrJuneJune <me@mrjunejune.com>
parents:
156
diff
changeset
|
508 target_compatible_with = macos_constraint, |
|
58
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
509 ) |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
510 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
511 # 3. Create the DMG |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
512 native.genrule( |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
513 name = name + "_dmg", |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
514 srcs = [":" + name + "_signed_app"], |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
515 outs = [name + ".dmg"], |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
516 cmd = """ |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
517 set -e |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
518 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
519 SIGNEDDIR="$(location :{name}_signed_app)" |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
520 |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
521 hdiutil create \ |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
522 -volname {name} \ |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
523 -srcfolder "$$SIGNEDDIR" \ |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
524 -ov -format UDZO "$@" |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
525 """.format(name = name), |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
526 local = 1, # Disable sandboxing for hdiutil |
|
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
527 tags = ["no-sandbox"], |
|
168
f3084bca7317
[Misc] Fixed all errors and all tests should pass now.
MrJuneJune <me@mrjunejune.com>
parents:
156
diff
changeset
|
528 target_compatible_with = macos_constraint, |
|
58
ccb42d5bf8fd
[PostDog] Somewhat working copy. That would use for testing.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
529 ) |