zig icon indicating copy to clipboard operation
zig copied to clipboard

use case: have a way for zon to define which `--build-file` to use

Open nektro opened this issue 2 years ago • 5 comments

this option is available to zig build when you want to run a build in a file other than build.zig. it should be available to consumers of packages as well.

nektro avatar Nov 01 '23 18:11 nektro

can you elaborate more on this use case?

andrewrk avatar Nov 01 '23 18:11 andrewrk

for instance if a package provided a module in build.foo.zig so as to not interfere with an incompatible root build.zig then users might be able to pass .build_file = "build.foo.zig", in their zon file to obtain access to the module

there's also been various talks about support for "monorepos" and they could also be supported through this with .build_file = "foo/build.zig",

nektro avatar Nov 01 '23 18:11 nektro

I think this needs a full example to remain open. It's difficult to understand based on this description alone.

andrewrk avatar Nov 01 '23 22:11 andrewrk

https://gist.github.com/nektro/a28d4aadca050d32ab8ea5723bcb6739

the expected output of cloning this and running zig build run is:

info: 184
info: 486

nektro avatar Nov 01 '23 22:11 nektro

another better alternative to the exact code i provided is if .build_file = "build.zig.zig", could be read from the zon of the package being depended on, rather than having to be a field on the consumer

nektro avatar Nov 04 '23 20:11 nektro