Skip to content

Commit

Permalink
add zig package manager support
Browse files Browse the repository at this point in the history
  • Loading branch information
rdunnington committed May 21, 2024
1 parent cdc46cd commit d9346a2
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.12.0
- run: zig test stable_array.zig
- run: zig build test
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Typical usage is to specify a large size up-front that the array should not enco

Usage:
```zig
var array = StableArray(u8).init(TEST_VIRTUAL_ALLOC_SIZE);
var array = StableArray(u8).init(1024 * 1024 * 1024 * 128); // virtual address reservation of 128 GB
try array.appendSlice(&[_]u8{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 });
assert(array.calcTotalUsedBytes() == mem.page_size);
for (array.items) |v, i| {
Expand Down
22 changes: 22 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const std = @import("std");

pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

_ = b.addStaticLibrary(.{
.name = "zig-stable-array",
.root_source_file = b.path("stable_array.zig"),
.target = target,
.optimize = optimize,
});

const lib_unit_tests = b.addTest(.{
.root_source_file = b.path("stable_array.zig"),
.target = target,
.optimize = optimize,
});
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_lib_unit_tests.step);
}
12 changes: 12 additions & 0 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.{
.name = "zig-stable-array",
.version = "0.1.0",
.dependencies = .{},
.paths = .{
"build.zig",
"build.zig.zon",
"stable_array.zig",
"LICENSE",
"README.md",
}
}
6 changes: 0 additions & 6 deletions zigmod.yml

This file was deleted.

0 comments on commit d9346a2

Please sign in to comment.