Skip to content

Commit

Permalink
refactor: use git protocol to fetch dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
tensorush committed Sep 9, 2024
1 parent 4c8c9c1 commit 79847af
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const root_source_file = b.path("src/main.zig");
const version = std.SemanticVersion{ .major = 0, .minor = 5, .patch = 0 };
const version = std.SemanticVersion{ .major = 0, .minor = 6, .patch = 0 };

// Dependencies
const clap_dep = b.dependency("clap", .{
Expand Down
6 changes: 3 additions & 3 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.{
.name = "liza",
.version = "0.5.0",
.version = "0.6.0",
.minimum_zig_version = "0.13.0",
.dependencies = .{
.clap = .{
.url = "https://github.com/Hejsil/zig-clap/archive/c0193e9.tar.gz",
.hash = "12207ee987ce045596cb992cfb15b0d6d9456e50d4721c3061c69dabc2962053644d",
.url = "git+https://github.com/Hejsil/zig-clap?ref=0.9.1#d71cc39a94f3e6ccbad00c25d350c9147de4df9f",
.hash = "122062d301a203d003547b414237229b09a7980095061697349f8bef41be9c30266b",
},
},
.paths = .{
Expand Down
2 changes: 1 addition & 1 deletion src/liza.zig
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const LIB_EXAMPLE1 = @embedFile(TEMPLATES ++ LIB ++ EXAMPLE1 ++ EXE_ROOT);
const LIB_EXAMPLE2 = @embedFile(TEMPLATES ++ LIB ++ EXAMPLE2 ++ EXE_ROOT);

// Port templates.
const PRT_CI_STEP = "install";
const PRT_CI_STEP = "lib";
const PRT_README = @embedFile(TEMPLATES ++ PRT ++ README);
const PRT_BUILD_ZIG = @embedFile(TEMPLATES ++ PRT ++ BUILD_ZIG);
const PRT_BUILD_ZON = @embedFile(TEMPLATES ++ PRT ++ BUILD_ZON);
Expand Down
4 changes: 2 additions & 2 deletions src/templates/exe/build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
.minimum_zig_version = "0.13.0",
.dependencies = .{
.clap = .{
.url = "https://github.com/Hejsil/zig-clap/archive/c0193e9.tar.gz",
.hash = "12207ee987ce045596cb992cfb15b0d6d9456e50d4721c3061c69dabc2962053644d",
.url = "git+https://github.com/Hejsil/zig-clap?ref=0.9.1#d71cc39a94f3e6ccbad00c25d350c9147de4df9f",
.hash = "122062d301a203d003547b414237229b09a7980095061697349f8bef41be9c30266b",
},
},
.paths = .{
Expand Down
2 changes: 1 addition & 1 deletion src/templates/lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- Add `?r` dependency to `build.zig.zon`.

```sh
zig fetch --save https://github.com/?u/?r/archive/<git_tag_or_commit_hash>.tar.gz
zig fetch --save git+https://github.com/?u/?r#<git_tag_or_commit_hash>
```

- Use `?r` dependency in `build.zig`.
Expand Down
2 changes: 1 addition & 1 deletion src/templates/prt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- Add `?r` dependency to `build.zig.zon`.

```sh
zig fetch --save https://github.com/?u/?r/archive/<git_tag_or_commit_hash>.tar.gz
zig fetch --save git+https://github.com/?u/?r#<git_tag_or_commit_hash>
```

- Use `?r` dependency in `build.zig`.
Expand Down
6 changes: 2 additions & 4 deletions src/templates/prt/build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
.version = "?v",
.minimum_zig_version = "0.13.0",
.dependencies = .{
.?r = .{
.url = "https://github.com/?r/?r/archive/v?v.tar.gz",
.hash = "12200000000000000000000000000000000000000000000000000000000000000000",
},
// Depend on upstream repository by running:
// zig fetch --save git+https://github.com/?r/?r#v?v
},
.paths = .{
"src/",
Expand Down

0 comments on commit 79847af

Please sign in to comment.