Skip to content

Commit 11af20f

Browse files
committed
chore: update to Zig v0.14.0
1 parent 04b53ca commit 11af20f

8 files changed

Lines changed: 45 additions & 45 deletions

File tree

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
# Zig recommends LF line endings
12
*.zig text eol=lf
23
*.zon text eol=lf

.github/workflows/cd.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99

1010
jobs:
1111
emit:
12+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
13+
1214
runs-on: ubuntu-latest
1315

1416
steps:
@@ -17,14 +19,16 @@ jobs:
1719

1820
- name: Set up Zig
1921
uses: mlugg/setup-zig@v1
22+
with:
23+
version: master
2024

21-
- name: Run `doc`
25+
- name: Run doc step
2226
run: zig build doc
2327

2428
- name: Upload artifact for GitHub Pages
2529
uses: actions/upload-pages-artifact@v3
2630
with:
27-
path: zig-out/doc/
31+
path: zig-out/docs/
2832

2933
deploy:
3034
needs: emit

.github/workflows/ci.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ jobs:
1919

2020
- name: Set up Zig
2121
uses: mlugg/setup-zig@v1
22+
with:
23+
version: master
2224

23-
- name: Run `test`
25+
- name: Run test step
2426
run: zig build test --summary all
2527

2628
fmt:
@@ -32,6 +34,8 @@ jobs:
3234

3335
- name: Set up Zig
3436
uses: mlugg/setup-zig@v1
37+
with:
38+
version: master
3539

36-
- name: Run `fmt`
40+
- name: Run fmt step
3741
run: zig build fmt

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
# Zig artifacts
12
.zig-cache/
23
zig-out/

README.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
# zig-cookie
22

3-
[![CI][ci-shd]][ci-url]
4-
[![CD][cd-shd]][cd-url]
5-
[![DC][dc-shd]][dc-url]
6-
[![LC][lc-shd]][lc-url]
7-
8-
## Zig port of [cookie library](https://github.com/rwf2/cookie-rs) for HTTP cookie storage.
3+
## Zig port of [cookie-rs library](https://github.com/rwf2/cookie-rs) for HTTP cookie storage.
94

105
### Usage
116

127
- Add `cookie` dependency to `build.zig.zon`.
138

149
```sh
15-
zig fetch --save git+https://github.com/tensorush/zig-cookie#<git_tag_or_commit_hash>
10+
zig fetch --save git+https://github.com/tensorush/zig-cookie
1611
```
1712

1813
- Use `cookie` dependency in `build.zig`.
@@ -25,14 +20,3 @@ const cookie_dep = b.dependency("cookie", .{
2520
const cookie_mod = cookie_dep.module("cookie");
2621
<compile>.root_module.addImport("cookie", cookie_mod);
2722
```
28-
29-
<!-- MARKDOWN LINKS -->
30-
31-
[ci-shd]: https://img.shields.io/github/actions/workflow/status/tensorush/zig-cookie/ci.yaml?branch=main&style=for-the-badge&logo=github&label=CI&labelColor=black
32-
[ci-url]: https://github.com/tensorush/zig-cookie/blob/main/.github/workflows/ci.yaml
33-
[cd-shd]: https://img.shields.io/github/actions/workflow/status/tensorush/zig-cookie/cd.yaml?branch=main&style=for-the-badge&logo=github&label=CD&labelColor=black
34-
[cd-url]: https://github.com/tensorush/zig-cookie/blob/main/.github/workflows/cd.yaml
35-
[dc-shd]: https://img.shields.io/badge/click-F6A516?style=for-the-badge&logo=zig&logoColor=F6A516&label=docs&labelColor=black
36-
[dc-url]: https://tensorush.github.io/zig-cookie
37-
[lc-shd]: https://img.shields.io/github/license/tensorush/zig-cookie.svg?style=for-the-badge&labelColor=black
38-
[lc-url]: https://github.com/tensorush/zig-cookie/blob/main/LICENSE

build.zig

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,68 @@
11
const std = @import("std");
22

33
pub fn build(b: *std.Build) void {
4+
const install_step = b.getInstallStep();
45
const target = b.standardTargetOptions(.{});
56
const optimize = b.standardOptimizeOption(.{});
6-
const root_source_file = b.path("src/lib.zig");
7-
const version = std.SemanticVersion{ .major = 0, .minor = 2, .patch = 1 };
7+
const root_source_file = b.path("src/root.zig");
8+
const version = std.SemanticVersion{ .major = 0, .minor = 2, .patch = 2 };
89

910
// Module
10-
_ = b.addModule("cookie", .{ .root_source_file = root_source_file });
11+
const mod = b.addModule("cookie", .{
12+
.target = target,
13+
.optimize = optimize,
14+
.root_source_file = root_source_file,
15+
});
1116

1217
// Library
1318
const lib_step = b.step("lib", "Install library");
1419

15-
const lib = b.addStaticLibrary(.{
20+
const lib = b.addLibrary(.{
1621
.name = "cookie",
17-
.target = target,
1822
.version = version,
19-
.optimize = optimize,
20-
.root_source_file = root_source_file,
23+
.root_module = mod,
2124
});
2225

2326
const lib_install = b.addInstallArtifact(lib, .{});
2427
lib_step.dependOn(&lib_install.step);
25-
b.default_step.dependOn(lib_step);
28+
install_step.dependOn(lib_step);
2629

2730
// Documentation
28-
const doc_step = b.step("doc", "Emit documentation");
29-
30-
const doc_install = b.addInstallDirectory(.{
31+
const docs_step = b.step("doc", "Emit documentation");
32+
const docs_install = b.addInstallDirectory(.{
3133
.install_dir = .prefix,
32-
.install_subdir = "doc",
34+
.install_subdir = "docs",
3335
.source_dir = lib.getEmittedDocs(),
3436
});
35-
doc_step.dependOn(&doc_install.step);
36-
b.default_step.dependOn(doc_step);
37+
docs_step.dependOn(&docs_install.step);
38+
install_step.dependOn(docs_step);
3739

3840
// Test suite
3941
const tests_step = b.step("test", "Run test suite");
4042

4143
const tests = b.addTest(.{
42-
.target = target,
4344
.version = version,
44-
.root_source_file = root_source_file,
45+
.root_module = b.createModule(.{
46+
.target = target,
47+
.root_source_file = root_source_file,
48+
}),
4549
});
4650

4751
const tests_run = b.addRunArtifact(tests);
4852
tests_step.dependOn(&tests_run.step);
49-
b.default_step.dependOn(tests_step);
53+
install_step.dependOn(tests_step);
5054

51-
// Formatting checks
52-
const fmt_step = b.step("fmt", "Run formatting checks");
55+
// Formatting check
56+
const fmt_step = b.step("fmt", "Check formatting");
5357

5458
const fmt = b.addFmt(.{
5559
.paths = &.{
5660
"src/",
5761
"build.zig",
62+
"build.zig.zon",
5863
},
5964
.check = true,
6065
});
6166
fmt_step.dependOn(&fmt.step);
62-
b.default_step.dependOn(fmt_step);
67+
install_step.dependOn(fmt_step);
6368
}

build.zig.zon

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.{
2-
.name = "cookie",
3-
.version = "0.2.1",
2+
.name = .cookie,
3+
.fingerprint = 0x8ae0ba6611e7a9c1,
4+
.version = "0.2.2",
45
.minimum_zig_version = "0.14.0",
56
.paths = .{
67
"src/",

src/lib.zig renamed to src/root.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Root library file that exposes the public API.
1+
//! Root source file that exposes the library's API to users and Autodoc.
22

33
const std = @import("std");
44

0 commit comments

Comments
 (0)