Skip to content

Commit

Permalink
更新信息
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhongjia committed Jan 5, 2024
1 parent c8207a2 commit 2c73905
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions learn/advanced/package_management.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ pub fn build(b: *std.Build) void {
}
```

:::warning

注意:zig `nightly` 已经将上方代码中的 `source_file` 字段更换为 `root_source_file`

:::

这就是一个最基本的包暴露实现,通过 `addModule` 函数暴露的模块是完全公开的。

::: info 🅿️ 提示
Expand Down
3 changes: 3 additions & 0 deletions learn/engineering/build-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ pub fn build(b: *std.Build) void {
// 添加一个匿名的依赖 // [!code focus]
exe.addAnonymousModule("hello", .{ .source_file = .{ .path = "src/hello.txt" } }); // [!code focus]
// 注意:zig `nightly` 已经将上行代码中的 `source_file` 字段更换为 `root_source_file` ! // [!code focus]
// 添加到顶级 install step 中作为依赖
b.installArtifact(exe);
Expand Down Expand Up @@ -563,6 +564,8 @@ pub fn build(b: *std.Build) !void {
// 添加一个匿名的依赖 // [!code focus]
exe.addAnonymousModule("hello", .{ .source_file = output }); // [!code focus]
// 注意:zig `nightly` 已经将上行代码中的 `source_file` 字段更换为 `root_source_file` ! // [!code focus]
// 添加到顶级 install step 中作为依赖
b.installArtifact(exe);
Expand Down

0 comments on commit 2c73905

Please sign in to comment.