-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
211 additions
and
0 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
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,49 @@ | ||
pub fn build(b: *std.Build) !void { | ||
const optimize = b.standardOptimizeOption(.{}); | ||
const target = b.standardTargetOptions(.{}); | ||
|
||
const overridden_runtime_pkg = b.dependency("overridden_runtime", .{}); | ||
const overridden_buildtime_pkg = b.dependency("overridden_buildtime", .{}); | ||
|
||
const overridden_runtime_module = overridden_runtime_pkg.module("module"); | ||
const overridden_buildtime_module = overridden_buildtime_pkg.module("module"); | ||
|
||
const test_step = b.step("test", "check package override behavior"); | ||
b.default_step = test_step; | ||
|
||
{ | ||
const exe = b.addExecutable(.{ | ||
.name = "dep-override-test-runtime", | ||
.root_source_file = b.path("src/main.zig"), | ||
.target = target, | ||
.optimize = optimize, | ||
}); | ||
exe.root_module.addImport("module", overridden_runtime_module); | ||
|
||
const run = b.addRunArtifact(exe); | ||
|
||
const step = b.step("runtime", "check error package is overridden at runtime"); | ||
step.dependOn(&run.step); | ||
|
||
test_step.dependOn(&run.step); | ||
} | ||
|
||
{ | ||
const exe = b.addExecutable(.{ | ||
.name = "dep-override-test-buildtime", | ||
.root_source_file = b.path("src/main.zig"), | ||
.target = target, | ||
.optimize = optimize, | ||
}); | ||
exe.root_module.addImport("module", overridden_buildtime_module); | ||
|
||
const run = b.addRunArtifact(exe); | ||
|
||
const step = b.step("buildtime", "check error package is overridden at buildtime"); | ||
step.dependOn(&run.step); | ||
|
||
test_step.dependOn(&run.step); | ||
} | ||
} | ||
|
||
const std = @import("std"); |
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 = "dependency_override", | ||
.version = "0.0.0", | ||
.paths = .{""}, | ||
.dependencies = .{ | ||
.overridden_runtime = .{ | ||
.url = "https://example.com", | ||
.hash = "1220af21050dd194c8500c038b2466dabf449cd4355861cc5473bd9dae99eed7c47e", | ||
}, | ||
.overridden_buildtime = .{ | ||
.url = "https://example.com", | ||
.hash = "12205377339014b33ba4f8ed6acaf863a2eb14b6769a9a1d5c2f23b04bac936897a3", | ||
}, | ||
}, | ||
} |
8 changes: 8 additions & 0 deletions
8
...bad-pkgs/p/12205377339014b33ba4f8ed6acaf863a2eb14b6769a9a1d5c2f23b04bac936897a3/build.zig
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,8 @@ | ||
pub fn build(b: *std.Build) !void { | ||
_ = b.addModule("module", .{ | ||
.root_source_file = b.path("src/root.zig"), | ||
}); | ||
@panic("overridden-buildtime package has not been overridden"); | ||
} | ||
|
||
const std = @import("std"); |
5 changes: 5 additions & 0 deletions
5
...pkgs/p/12205377339014b33ba4f8ed6acaf863a2eb14b6769a9a1d5c2f23b04bac936897a3/build.zig.zon
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,5 @@ | ||
.{ | ||
.name = "overriden-buildtime-pkg", | ||
.version = "0.0.0", | ||
.paths = .{""}, | ||
} |
5 changes: 5 additions & 0 deletions
5
...-pkgs/p/12205377339014b33ba4f8ed6acaf863a2eb14b6769a9a1d5c2f23b04bac936897a3/src/root.zig
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,5 @@ | ||
pub fn run() void { | ||
@panic("the overridden-buildtime package has not been overridden"); | ||
} | ||
|
||
const std = @import("std"); |
7 changes: 7 additions & 0 deletions
7
...bad-pkgs/p/1220af21050dd194c8500c038b2466dabf449cd4355861cc5473bd9dae99eed7c47e/build.zig
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,7 @@ | ||
pub fn build(b: *std.Build) !void { | ||
_ = b.addModule("module", .{ | ||
.root_source_file = b.path("src/root.zig"), | ||
}); | ||
} | ||
|
||
const std = @import("std"); |
5 changes: 5 additions & 0 deletions
5
...pkgs/p/1220af21050dd194c8500c038b2466dabf449cd4355861cc5473bd9dae99eed7c47e/build.zig.zon
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,5 @@ | ||
.{ | ||
.name = "overriden-runtime-pkg", | ||
.version = "0.0.0", | ||
.paths = .{""}, | ||
} |
5 changes: 5 additions & 0 deletions
5
...-pkgs/p/1220af21050dd194c8500c038b2466dabf449cd4355861cc5473bd9dae99eed7c47e/src/root.zig
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,5 @@ | ||
pub fn run() void { | ||
@panic("the overridden-runtime package has not been overridden"); | ||
} | ||
|
||
const std = @import("std"); |
7 changes: 7 additions & 0 deletions
7
...ood-pkgs/p/12205377339014b33ba4f8ed6acaf863a2eb14b6769a9a1d5c2f23b04bac936897a3/build.zig
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,7 @@ | ||
pub fn build(b: *std.Build) !void { | ||
_ = b.addModule("module", .{ | ||
.root_source_file = b.path("src/root.zig"), | ||
}); | ||
} | ||
|
||
const std = @import("std"); |
5 changes: 5 additions & 0 deletions
5
...pkgs/p/12205377339014b33ba4f8ed6acaf863a2eb14b6769a9a1d5c2f23b04bac936897a3/build.zig.zon
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,5 @@ | ||
.{ | ||
.name = "overriden-buildtime-pkg", | ||
.version = "0.0.0", | ||
.paths = .{""}, | ||
} |
5 changes: 5 additions & 0 deletions
5
...-pkgs/p/12205377339014b33ba4f8ed6acaf863a2eb14b6769a9a1d5c2f23b04bac936897a3/src/root.zig
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,5 @@ | ||
pub fn run() void { | ||
std.debug.print("this is the overridden-buildtime package\n", .{}); | ||
} | ||
|
||
const std = @import("std"); |
7 changes: 7 additions & 0 deletions
7
...ood-pkgs/p/1220af21050dd194c8500c038b2466dabf449cd4355861cc5473bd9dae99eed7c47e/build.zig
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,7 @@ | ||
pub fn build(b: *std.Build) !void { | ||
_ = b.addModule("module", .{ | ||
.root_source_file = b.path("src/root.zig"), | ||
}); | ||
} | ||
|
||
const std = @import("std"); |
5 changes: 5 additions & 0 deletions
5
...pkgs/p/1220af21050dd194c8500c038b2466dabf449cd4355861cc5473bd9dae99eed7c47e/build.zig.zon
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,5 @@ | ||
.{ | ||
.name = "overriden-runtime-pkg", | ||
.version = "0.0.0", | ||
.paths = .{""}, | ||
} |
5 changes: 5 additions & 0 deletions
5
...-pkgs/p/1220af21050dd194c8500c038b2466dabf449cd4355861cc5473bd9dae99eed7c47e/src/root.zig
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,5 @@ | ||
pub fn run() void { | ||
std.debug.print("this is the overridden-runtime package\n", .{}); | ||
} | ||
|
||
const std = @import("std"); |
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,10 @@ | ||
#!/bin/sh | ||
|
||
ZIG=$1 | ||
|
||
rm -r local-cache global-cache .zig-cache | ||
cp -r cache-with-good-pkgs local-cache | ||
cp -r cache-with-bad-pkgs global-cache | ||
$ZIG build test --global-cache-dir global-cache --cache-dir local-cache && \ | ||
$ZIG build test --cache-dir local-cache && \ | ||
$ZIG build test --system cache-with-good-pkgs/p |
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,5 @@ | ||
pub fn main() void { | ||
@import("module").run(); | ||
} | ||
|
||
const std = @import("std"); |