Skip to content

Commit 68c3f7b

Browse files
committed
Download .wasm and .js from official docs
1 parent 93d9359 commit 68c3f7b

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
zml/
2-
workspace/
2+
WORKSPACE/
3+
4+
.zig-cache/
5+
zig-out/

01-PREPARE-FOR-EDITS.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ else
1010
mkdir $WORKSPACE
1111
fi
1212

13+
curl https://ziglang.org/documentation/0.13.0/std/main.wasm -s -o WORKSPACE/main.wasm
14+
curl https://ziglang.org/documentation/0.13.0/std/main.js -s -o WORKSPACE/main.js
15+
1316
# link-in the assets and layouts
1417
for d in assets layouts ; do
1518
if [ ! -h ${WORKSPACE}/$d ] ; then

02-BUILD.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
cd zml
22
echo "Starting Bazel build..."
3-
bazel build //zml:docs
3+
bazel build //zml:sources
44
cd ..
5-
# we reference these outputs in build.zig
6-
# - ./zml/bazel-bin/zml/docs.docs/sources.tar
7-
# - ./zml/bazel-bin/zml/docs.docs/main.wasm
5+
cp ./zml/bazel-bin/zml/sources.tar WORKSPACE/
6+
87
cd WORKSPACE
98
echo "Starting Zine build..."
109
zig build $@

build.zig

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ pub fn build(b: *std.Build) !void {
1313
"zml.no_light.svg",
1414
},
1515
.build_assets = &.{
16-
.{
17-
.name = "main_wasm",
18-
.lp = b.path("../zml/bazel-bin/zml/docs.docs/main.wasm"),
19-
.install_path = "main.wasm",
20-
.install_always = true,
21-
},
22-
.{
23-
.name = "sources",
24-
.lp = b.path("../zml/bazel-bin/zml/docs.docs/sources.tar"),
25-
.install_path = "sources.tar",
26-
.install_always = true,
27-
},
16+
staticAsset(b, "main.wasm"),
17+
staticAsset(b, "main.js"),
18+
staticAsset(b, "sources.tar"),
2819
},
2920
.debug = true,
3021
});
3122
}
23+
24+
fn staticAsset(b: *std.Build, name: []const u8) zine.BuildAsset {
25+
return .{
26+
.name = name,
27+
.lp = b.path(name),
28+
.install_path = name,
29+
.install_always = true,
30+
};
31+
}

0 commit comments

Comments
 (0)