From 94570c4b602c7f0ae5c31a12905622daaf849844 Mon Sep 17 00:00:00 2001 From: Jonathan Marler Date: Mon, 25 Nov 2024 06:19:38 -0700 Subject: [PATCH] fix zig fetch command in README (#130) * fix zig fetch command in README All URLs within build.zig.zon files must point to archives that never change. However, the zig fetch command in the README.md adds a URL that points to the `devel` git branch whose content changes whenever the `devel` branch is updated. I've updated the README a url that zig will resolve to a SHA before it writes it to the zon file. * Update template scripts --------- Co-authored-by: Not-Nik --- README.md | 2 +- project_setup.ps1 | 8 ++------ project_setup.sh | 8 ++------ 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 4d14f2b..61f48d0 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ want to run an example, say `basic_window` run `zig build basic_window` Download and add raylib-zig as a dependency by running the following command in your project root: ``` -zig fetch --save https://github.com/Not-Nik/raylib-zig/archive/devel.tar.gz +zig fetch --save git+https://github.com/Not-Nik/raylib-zig#devel ``` Then add raylib-zig as a dependency and import its modules and artifact in your `build.zig`: diff --git a/project_setup.ps1 b/project_setup.ps1 index 50e17e2..88033d4 100644 --- a/project_setup.ps1 +++ b/project_setup.ps1 @@ -61,22 +61,18 @@ pub fn build(b: *std.Build) !void { New-Item -Name "build.zig" -ItemType "file" -Value $BUILD_DOT_ZIG -Force -$HASH = $(zig fetch https://github.com/Not-Nik/raylib-zig/archive/devel.tar.gz) - $ZON_FILE = @" .{ .name = "$PROJECT_NAME", .version = "0.0.1", .dependencies = .{ - .@"raylib-zig" = .{ - .url = "https://github.com/Not-Nik/raylib-zig/archive/devel.tar.gz", - .hash = "$HASH", - }, }, .paths = .{""}, } "@ +zig fetch --save git+https://github.com/Not-Nik/raylib-zig#devel + New-Item -Name "build.zig.zon" -ItemType "file" -Value $ZON_FILE -Force New-Item -Name "src" -ItemType "directory" diff --git a/project_setup.sh b/project_setup.sh index e005929..450ffd4 100755 --- a/project_setup.sh +++ b/project_setup.sh @@ -57,20 +57,16 @@ pub fn build(b: *std.Build) !void { b.installArtifact(exe); }' >> build.zig -HASH=$(zig fetch https://github.com/Not-Nik/raylib-zig/archive/devel.tar.gz) - echo '.{ .name = "'$PROJECT_NAME'", .version = "0.0.1", .dependencies = .{ - .@"raylib-zig" = .{ - .url = "https://github.com/Not-Nik/raylib-zig/archive/devel.tar.gz", - .hash = "'$HASH'", - }, }, .paths = .{""}, }' >> build.zig.zon +zig fetch --save git+https://github.com/Not-Nik/raylib-zig#devel + mkdir src mkdir resources touch resources/placeholder.txt