Conversation
The previous commit deleted the deprecated API and then made all the follow-up changes; this commit reverts only the breaking API changes. This commit can be reverted once 0.12.0 is tagged.
Contributor
It wasn't unnecessary and was required specifically for // foo/build.zig
const std = @import("std");
pub fn build(b: *std.Build) void {
const libfoo = b.addStaticLibrary(.{
.name = "foo",
.target = b.resolveTargetQuery(.{}),
.optimize = .Debug,
});
libfoo.addCSourceFile(.{ .file = b.addWriteFiles().add("empty.c", "") });
libfoo.installHeader(.{ .path = "header.h" }, "foo/foo.h"); // <------------ Note: .path, not .src_path
b.installArtifact(libfoo);
}// foo/header.h
#define FOO_FOO "FOO"// build.zig
const std = @import("std");
pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = "main",
.target = b.resolveTargetQuery(.{}),
.link_libc = true,
});
exe.addCSourceFile(.{ .file = b.addWriteFiles().add("main.c",
\\#include <stdio.h>
\\#include <foo/foo.h>
\\int main(void) {
\\ printf(FOO_FOO "\n");
\\ return 0;
\\}
) });
const foo_dep = b.dependency("foo", .{});
const libfoo = foo_dep.artifact("foo");
exe.linkLibrary(libfoo);
exe.installLibraryHeaders(libfoo);
b.getInstallStep().dependOn(&b.addInstallArtifact(exe, .{
.h_dir = .{ .override = .header }, // <---------------- This is the thing that fails
}).step);
const run_exe = b.addRunArtifact(exe);
run_exe.step.dependOn(b.getInstallStep());
const run = b.step("run", "Run the app");
run.dependOn(&run_exe.step);
}// build.zig.zon
.{
.name = "main",
.version = "0.0.0",
.dependencies = .{
.foo = .{
.path = "foo",
},
},
.paths = .{""},
}zig build runNote that 0b7123f made installing headers to the It's probably not worth keeping the workaround; the fix is just to use the new |
Inve1951
reviewed
Apr 11, 2024
| pub fn path(b: *Build, sub_path: []const u8) LazyPath { | ||
| assert(!fs.path.isAbsolute(sub_path)); | ||
| if (fs.path.isAbsolute(sub_path)) { | ||
| std.debug.panic("sub_path is expected to be relative to the build root, but was this absolute path: '{s}'. It is best avoid absolute paths, but if you must, it is supported by LazyPath.cwd_relative", .{ |
Member
Author
|
Understood, thank you for the clarification! |
scheibo
added a commit
to pkmn/engine
that referenced
this pull request
Apr 13, 2024
yamashitax
added a commit
to yamashitax/zig-curl-fork
that referenced
this pull request
Apr 13, 2024
yamashitax
added a commit
to yamashitax/zig-curl-fork
that referenced
this pull request
Apr 13, 2024
yamashitax
added a commit
to yamashitax/zig-curl-fork
that referenced
this pull request
Apr 13, 2024
jiacai2050
pushed a commit
to jiacai2050/zig-curl
that referenced
this pull request
Apr 14, 2024
) Ref: ziglang/zig#19623 The changes here are trivial, only a small change required to be up to date with master. Tested with `0.12.0-dev.3639+9cfac4718`
This was referenced May 29, 2024
raysan5
pushed a commit
to raysan5/raylib
that referenced
this pull request
May 29, 2024
* Fix for issue #4010 Split the code for Zig's master branch and >= 0.12.0 due to changes in ziglang/zig#19623 * Restore the cache_include path which was removed in error Accidently removed a couple lines I didn't mean to 🙈
CorrectRoadH
pushed a commit
to CorrectRoadH/ncdu
that referenced
this pull request
Mar 26, 2025
* LazyPath now stores `Build` owner inside in ziglang/zig#19623 and ziglang/zig#19597 . Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The first commit deletes the deprecated API and then makes all the upgrades needed to pass the standalone tests.
The second commit reverts the API breakage. The second commit can be reverted once 0.12.0 is tagged.
@castholm re:
The
*Buildargument to LazyPath.dupe was only being used for its allocator, and all instances share the same allocator. So converting a path prematurely to an absolute path was unnecessary and introduced unwanted absolute paths.