Build system tricks

done. I wonder if somebody eventually comes up with a gigantic project with all the tricks shown, just because they can ^^

3 Likes

FYI

For version 0.13.0, It must not use cwd_relative variant of LazyPath in package build script.
(but absolute path does not affect)

The cwd_relative variant is the relative path from root module.
Using cwd_relative in package build script lead to occur File not found error.

2 Likes

Thanks for the feedback - feel free to update the doc if you can. If you can’t, someone can implement your changes if you 'd like to suggest an alternative (just post some code and we’ll work out the details).

1 Like

just changed two more of those, hope we got them all now.

2 Likes

In " 3) Declare dependencies as well as their artifacts and modules upfront",
Add description for bundling the dependency artifact.

From Package Management in 0.11.0 Release Notes

any artifact which is installed (for instance, via std.Build.installArtifact) is exposed to dependant packages.

In following situation, it need calling installArtifact for dependency artifact.

/ (project root)
  |_ owner module (exe)
  |_ child_1 module (exe)
  |_ child_2 module (exe)

where owner module is depends on child_1 module and child_2 module because of spawning `these artifacts.

Probably, if dependency artifact is linked only as the static library, it will not need calling installArtifact.


…And in this case, it did not need to call dependsOn.

Why not? Even the build.zig from zig init calls it:

addInstallArtifact is installArtifact without establishing the install step dependency.

1 Like

Added:

    1. System tool Tricks under “Extra Steps”
    1. Code generation tricks under “Extra Steps”
    1. Code generation tricks under “C Dependencies”

Since I recently had to do some of this stuff! Double checked all I added on 12.0.0 so should be correct but sanity checks are encouraged.

4 Likes

I activated to show the table of contents for this topic.

I don’t know why its only showing the top headings from the docs view,
but from the forum view it also shows the sub-headings.

1 Like