fix: make built artifact lazy dep

This commit is contained in:
Nurul Huda (Apon) 2026-03-14 19:53:32 +06:00
parent 06499cdb3e
commit 683a694003
No known key found for this signature in database
GPG key ID: 5D3F1DE2855A2F79
2 changed files with 14 additions and 11 deletions

View file

@ -21,9 +21,11 @@ pub fn build(b: *std.Build) !void {
const prebuilt_lib_path = b.fmt("{s}/{s}", .{ target_triple, lib_name });
// --- Pre-built resolution --- //
const libtemporal_dep = b.lazyDependency("libtemporal", .{});
var prebuilt_lib_file: ?std.Build.LazyPath = null;
var selected_lib_file: std.Build.LazyPath = undefined;
if (!force_build_rust) {
const libtemporal_dep = b.lazyDependency("libtemporal", .{});
if (libtemporal_dep) |dep| {
const lib_file_candidate = dep.path(prebuilt_lib_path);
const lib_full_path = lib_file_candidate.getPath(b);
@ -32,11 +34,11 @@ pub fn build(b: *std.Build) !void {
prebuilt_lib_file = lib_file_candidate;
} else |_| {}
}
}
var selected_lib_file: std.Build.LazyPath = undefined;
if (prebuilt_lib_file != null and !force_build_rust) {
if (prebuilt_lib_file) |plf| {
// std.debug.print("Using pre-built temporal_capi library from downloaded artifact at: {s}\n", .{prebuilt_lib_path});
selected_lib_file = prebuilt_lib_file.?;
selected_lib_file = plf;
} else {
// std.debug.print("building from source: {s}\n", .{prebuilt_lib_path});
const build_crab = @import("build_crab");

View file

@ -11,6 +11,7 @@
.libtemporal = .{
.url = "https://github.com/nurulhudaapon/temporalz/releases/download/v0.2.0/libtemporal.tar.gz",
.hash = "N-V-__8AAHgP2AWLC4ZLTr_3hWf6xtgtBI5moBrWDWg5kzSD",
.lazy = true,
},
.build_crab = .{
.url = "git+https://github.com/nurulhudaapon/build.crab?ref=zig-dev#1aabc836472d318e9756a43b17853aadc4599800",