Skip to content

std.Build.Dependency: add optional~ functions#21841

Open
dasimmet wants to merge 1 commit intoziglang:masterfrom
dasimmet:lazy-dependency-functions
Open

std.Build.Dependency: add optional~ functions#21841
dasimmet wants to merge 1 commit intoziglang:masterfrom
dasimmet:lazy-dependency-functions

Conversation

@dasimmet
Copy link
Copy Markdown
Contributor

When a std.Build.Dependency relies on a transitive b.lazyDependency to expose an artifact, module, namedWriteFiles or namedLazyPath, calls to these functions panic when the dependency was not downloaded yet, but work fine when it is available in the local cache.

We can prevent this by using optionalArtifact, returning an optional instead of panic.
Same for optionalModule , optionalNamedWriteFiles and optionalNamedLazyPath.
I think the optional~ prefix is better than lazy~ here to avoid confusion with LazyPath.

The downside I guess is it could lead to dead code if the named Item will never be available...

@dasimmet dasimmet force-pushed the lazy-dependency-functions branch 2 times, most recently from 9d2e043 to 9e1ba0d Compare October 29, 2024 18:23
@alexrp alexrp force-pushed the lazy-dependency-functions branch from 9e1ba0d to f0005dc Compare February 5, 2025 05:44
@dasimmet dasimmet force-pushed the lazy-dependency-functions branch from f0005dc to 6132cdb Compare February 16, 2025 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant