Skip to content
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

std.Build: allow packages to expose arbitrary LazyPaths by name #21386

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

mlugg
Copy link
Member

@mlugg mlugg commented Sep 11, 2024

This is an enhancement to the build system. There's no corresponding issue -- @andrewrk, I'll therefore wait for your approval on this one.

It seems reasonable and useful for packages to be allowed to expose arbitrary LazyPaths to dependants; for instance, an output file/dir from a Step.Run. I ran into this when helping @sphaerophoria make a package which exposes a bunch of Qt stuff by calling into CMake rather than porting the build system to Zig. You can also imagine situations in pure-Zig-land where this would be helpful; for instance, perhaps a package wants to expose a file containing some kind of generated JSON/ZON data (generated by a Zig program).

(Also, use decl literals for a couple of inits :D)

@mlugg mlugg added release notes This PR should be mentioned in the release notes. zig build system std.Build, the build runner, `zig build` subcommand, package management labels Sep 11, 2024
@mlugg mlugg force-pushed the build-package-named-lazypath branch from 5f0c834 to aaf41ed Compare September 11, 2024 08:16
@alexrp
Copy link
Contributor

alexrp commented Sep 11, 2024

Seems like this PR could help address this use case?

@rohlem
Copy link
Contributor

rohlem commented Sep 11, 2024

From just the description this sounds like an alternate take on #21380 ?

@mlugg
Copy link
Member Author

mlugg commented Sep 11, 2024

No, it's the exact opposite @rohlem.

@InKryption
Copy link
Contributor

#21380 allows the dependee to pass lazy paths to the dependency; this allows the dependency to pass lazy paths to the dependee.

@kassane
Copy link
Contributor

kassane commented Sep 11, 2024

@mlugg Does this guarantee receiving the absolute path of the packet?

I ask this precisely because I have a possibly related issue.
#21232

lib/std/Build.zig Outdated Show resolved Hide resolved
@mlugg mlugg force-pushed the build-package-named-lazypath branch from aaf41ed to bf3bbda Compare September 11, 2024 16:00
@mlugg mlugg requested a review from andrewrk September 14, 2024 06:07
@andrewrk andrewrk merged commit 5d7fa55 into ziglang:master Sep 16, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes This PR should be mentioned in the release notes. zig build system std.Build, the build runner, `zig build` subcommand, package management
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants