forked from ziglang/zig
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
.unpack = false
and --no-unpack to build.zig.zon and zig fetch
closes ziglang#17895 Enhances zig with the ability to fetch a dependency of any file type.
- Loading branch information
1 parent
a5d4ad1
commit a7abaff
Showing
10 changed files
with
130 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const std = @import("std"); | ||
|
||
pub fn build(b: *std.Build) !void { | ||
b.default_step = b.step("test", "Test it"); | ||
|
||
{ | ||
const run = b.addSystemCommand(&.{ | ||
b.graph.zig_exe, | ||
"build", | ||
"--build-file", | ||
}); | ||
run.addFileArg(b.path("example/build.zig")); | ||
b.default_step.dependOn(&run.step); | ||
} | ||
|
||
{ | ||
const run = b.addSystemCommand(&.{ | ||
b.graph.zig_exe, | ||
"build", | ||
"--build-file", | ||
}); | ||
run.addFileArg(b.path("unpacktrue/build.zig")); | ||
run.addCheck(.{ .expect_stderr_match = "error: unpack cannot be set to true, omit it instead" }); | ||
b.default_step.dependOn(&run.step); | ||
} | ||
|
||
{ | ||
const run = b.addSystemCommand(&.{ | ||
b.graph.zig_exe, | ||
"fetch", | ||
"--no-unpack", | ||
}); | ||
run.addFileArg(b.path("example/example_dep_file")); | ||
run.expectStdOutEqual("122008dbadc3bbdeaf08a92bcd337c2dc994efc3c8c1e9a7f59a23901df660e89d8f\n"); | ||
b.default_step.dependOn(&run.step); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const std = @import("std"); | ||
|
||
pub fn build(_: *std.Build) !void {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.{ | ||
.name = "fetch", | ||
.version = "0.0.0", | ||
.dependencies = .{ | ||
.somedependency = .{ | ||
.url = "file://localhost/example_dep_file", | ||
.hash = "122008dbadc3bbdeaf08a92bcd337c2dc994efc3c8c1e9a7f59a23901df660e89d8f", | ||
.unpack = false, | ||
}, | ||
}, | ||
.paths = .{ | ||
"build.zig", | ||
"build.zig.zon", | ||
"example_dep_file", | ||
}, | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is an example file. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const std = @import("std"); | ||
|
||
pub fn build(_: *std.Build) !void {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.{ | ||
.name = "unpacktrue", | ||
.version = "0.0.0", | ||
.dependencies = .{ | ||
.somedependency = .{ | ||
.url = "file://localhost/bar", | ||
.hash = "1220f3b02ca452c26a96b48d2912b7fc907bef8d0b85c2e8f7e4a5c8bd95cdbfbae6", | ||
.unpack = true, | ||
}, | ||
}, | ||
.paths = .{ | ||
"build.zig", | ||
"build.zig.zon", | ||
}, | ||
} |