-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enforce build.zig.zon declares paths that are accessed by the build #20510
base: master
Are you sure you want to change the base?
Conversation
Preventing people from shipping broken packages that reference non-existent paths is a good thing, but it should be noted that the approach this PR takes means that larger scale projects might no longer be able to use the same build.zig for both building as the root project and building as a dependency. For example, imagine you have a single build.zig for a large library which in addition to artifacts and modules also includes integration tests, example programs and other things which are irrelevant for package consumers. Depending on the size of these redundant files, you might want to exclude them from the But with this change making referencing files not matched by Another thing worth considering is that only the files matched by Instead of checking that a path is matched by the package manifest immediately when invoking |
I'm not sure this is true. There was in fact a similar example in this repo that I had to fix in this PR in There's also another solution currently available which is to just add these extra files to your There's also things you can do in your
This feels a bit "off-topic" to this PR but I do have thoughts to share :) I believe that being able to determine that certain files accessed by a build can NEVER affect certain outputs "in general" is "undecidable" (i.e. determine that certain documentation/examples file can have no affect on certain outputs). There is a lot you can do here with containerized builds that can track/audit all files accessed by a process, but those can also be less fine-grained than you'd like as you'd have to treat each process as an atomic unit, where you couldn't de-couple particular inputs/outputs given to the same process. Without a full-proof general solution like containerization, I don't see enough benefit to try and exclude files from affecting particular output files of a build to try and implement a system that is sophisticated enough to do it correctly (especially in the general case).
"Lazy enforcment" is a good idea to consider. However, I'd recommend first trying "greedy enforcement" as this more restrictive design may lead to simpler packages with less bugs/problems, unless we find real use cases that this doesn't work with and that don't have reasonable alternatives. |
a80e022
to
de2acba
Compare
This one's been sitting for about 3 months and a whole bunch of conflicts have come in since. It doesn't seem like I should take time to rebase it as no one from the core team has indicated this is a change that would be accepted. Is there anything I can do to help here? Should we close this, leave it open, keep waiting until the core team has time? |
I'm not focused on the build system right now. I suggest to just leave it as is, if I want the change it looks like it would be trivial to rework a 200 line diff onto whatever the current state of the codebase is at the time. This change also offers a chance to rethink how paths work because there are some flaws with the current setup so I wont merge a bandage without considering that. |
Updates
std.Build.path
andstd.Build.Dependency.path
to verify that path names are included in the correspondingbuild.zig.zon
if present.This would have caught a mistake in this commit allyourcodebase/SDL@b77d252 where I forgot to add a new directory
include-pregen
to thebuild.zig.zon
file, which, caused my local testing to pass but ultimately push a broken commit that only manifests when newly downloading dependencies.