#what is the purpose of the zon .paths field?

1 messages · Page 1 of 1 (latest)

fleet edge
#

my project wasn't building, complaining that the .zon file was missing a .paths field. so i added an empty one here: https://github.com/travisstaloch/simdjzon-rpc/blob/main/build.zig.zon

this allows the project to build again. but i'm not sure what the field is supposed to be used for? i caught some of Andrew and Loris' orca stream where they copied the output of an 'ls' command into the .paths field. but i didn't really understand why there were doing that.

what is it used for?

polar nest
#

a list of files that are actually a part of the package - that way it automatically excludes .git and build artifacts, etc

fleet edge
#

ok so i should have a sting entry for everything from $ git ls-tree -r main --name-only ?

#

i was a little confused when i tried an empty tuple it gave an unhelpful compile error

#

that seems like its going to be easy to mess up and forget to include a file.

#

i guess the list of files will only be used by dependees of my package?

polar nest
#

you can do just do a directory like src too

fleet edge
#

oh good. thats a lot easier.

#

here was the error message for an empty tuple:

error: expected paths expression to be a struct
    .paths = .{
              ^
#

hmm would it be valid to just do .paths = .{ "." }, ?

fleet edge
#

☝️ this doesn't seem to work out when i try to depend on the module.

#

it works if i list all top level files and directories i want to include

fleet edge
fleet edge
rain peak
#

would be nice if you could tell it to use all files that are part of the git repo instead of listing them manually

fleet edge
#

i thought thats what .paths = .{"."} does. haven't verfied yet w/ new patch.

plucky rock
#

I assume by "all files that are part of the git repo" they mean excluding things from gitignore

#

and I also assume that there's no logic yet in zig to do that

#

maybe they could add it like .paths = .git

rain peak
#

yes only files that are tracked by git (files can also be untracked without being excluded by .gitignore)

#

kinda like nix flakes work by default

copper orchid
#

One thing I'm uncertain of is whether you should include the build.zig and build.zig.zon of a package in the .paths field. Does the compiler automatically include them? If not I would think every package using them would need to make sure they are included, or am I misunderstanding something?