Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:
- uses: mlugg/setup-zig@v2
with:
version: 0.17.0-dev.633+9c5655093
version: 0.17.0-dev.1282+c0f9b51d8

- name: Checkout
uses: actions/checkout@v4
Expand All @@ -39,7 +39,7 @@ jobs:
steps:
- uses: mlugg/setup-zig@v2
with:
version: 0.17.0-dev.633+9c5655093
version: 0.17.0-dev.1282+c0f9b51d8

- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .zigversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.17.0-dev.633+9c5655093
0.17.0-dev.1282+c0f9b51d8
26 changes: 12 additions & 14 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,23 @@ pub fn build(b: *std.Build) void {
.optimize = mode,
});

_build.buildUtils(b);

const autodoc_main = _build.autodocMain(b);
b.addNamedLazyPath("autodoc/main.wasm", autodoc_main.getEmittedBin());
b.addNamedLazyPath("autodoc/main.js", b.path("src/autodoc/main.js"));
b.addNamedLazyPath("autodoc/main.css", b.path("src/autodoc/main.css"));

const docs_install = addDocs(
b,
b.addLibrary(.{
.name = "base-z",
.root_module = mod_base,
}),
.{
.dep_base = &dep_base_internal,
.html_logo = "base-z",
.install_dir = .prefix,
.install_subdir = "docs",
.repo_url = "https://github.com/kofi-q/base-z",
},
);
const docs_install = addDocs(b, b.addLibrary(.{
.name = "base-z",
.root_module = mod_base,
}), .{
.dep_base = &dep_base_internal,
.html_logo = "base-z",
.install_dir = .prefix,
.install_subdir = "docs",
.repo_url = "https://github.com/kofi-q/base-z",
});
step_docs.dependOn(&docs_install.step);

const lib_test = b.addTest(.{ .root_module = mod_base });
Expand Down
2 changes: 1 addition & 1 deletion build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.name = .base,
.fingerprint = 0xc0b4fe61a6f811ae,
.version = "0.1.0",
.minimum_zig_version = "0.17.0-dev.633+9c5655093",
.minimum_zig_version = "0.17.0-dev.1282+c0f9b51d8",
.dependencies = .{},
.paths = .{
"build.zig",
Expand Down
32 changes: 17 additions & 15 deletions src/_build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const std = @import("std");

pub const steps = @import("_build/steps.zig");

const Step = std.Build.Step;

pub const DocsOpts = struct {
dep_base: ?*std.Build.Dependency = null,
html_head_extra: []const u8 = "",
Expand All @@ -13,9 +15,9 @@ pub const DocsOpts = struct {

pub fn addDocs(
b: *std.Build,
lib: *std.Build.Step.Compile,
lib: *Step.Compile,
opts: DocsOpts,
) *std.Build.Step.InstallDir {
) *Step.InstallDir {
const dep_base = opts.dep_base orelse b.dependency("base", .{
.target = lib.root_module.resolved_target.?,
.optimize = lib.root_module.optimize.?,
Expand Down Expand Up @@ -63,7 +65,7 @@ pub fn addDocs(
return patch_install;
}

pub fn autodocMain(b: *std.Build) *std.Build.Step.Compile {
pub fn autodocMain(b: *std.Build) *Step.Compile {
const mod = b.createModule(.{
.link_libc = false,
.optimize = .ReleaseSmall,
Expand All @@ -89,20 +91,20 @@ pub fn autodocMain(b: *std.Build) *std.Build.Step.Compile {
return exe;
}

pub fn addDirRemove(b: *std.Build, path: std.Build.LazyPath) *steps.DirRemove {
return steps.DirRemove.create(b, path);
pub fn addDirRemove(b: *std.Build, cfg: steps.dir_remove.Cfg) *Step {
return steps.dir_remove.create(b, cfg);
}

pub fn addFileRemove(
b: *std.Build,
path: std.Build.LazyPath,
) *steps.FileRemove {
return steps.FileRemove.create(b, path);
pub fn addFileRemove(b: *std.Build, cfg: steps.file_remove.Cfg) *Step {
return steps.file_remove.create(b, cfg);
}

pub fn addPathsCopy(
b: *std.Build,
write_files: *std.Build.Step.WriteFile,
) *steps.PathCopy {
return steps.PathCopy.create(b, write_files);
pub fn addPathsCopy(b: *std.Build, cfg: steps.PathsCopy.Cfg) steps.PathsCopy {
return steps.PathsCopy.create(b, cfg);
}

pub fn buildUtils(b: *std.Build) void {
steps.dir_remove.build(b);
steps.file_remove.build(b);
steps.PathsCopy.build(b);
}
6 changes: 3 additions & 3 deletions src/_build/steps.zig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub const DirRemove = @import("steps/DirRemove.zig");
pub const FileRemove = @import("steps/FileRemove.zig");
pub const PathCopy = @import("steps/PathCopy.zig");
pub const dir_remove = @import("steps/dir_remove/step.zig");
pub const file_remove = @import("steps/file_remove/step.zig");
pub const PathsCopy = @import("steps/paths_copy/step.zig").PathsCopy;
73 changes: 0 additions & 73 deletions src/_build/steps/DirRemove.zig

This file was deleted.

52 changes: 0 additions & 52 deletions src/_build/steps/FileRemove.zig

This file was deleted.

94 changes: 0 additions & 94 deletions src/_build/steps/PathCopy.zig

This file was deleted.

15 changes: 15 additions & 0 deletions src/_build/steps/dir_remove/main.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const std = @import("std");

pub fn main(init: std.process.Init) !void {
const io = init.io;

var args = init.minimal.args.iterate();
_ = args.skip();
const path = args.next() orelse return error.MissingDirPath;

const cwd: std.Io.Dir = .cwd();
cwd.deleteTree(io, path) catch |err| {
std.log.err("recursively deleting dir {s}: {t}", .{ path, err });
return err;
};
}
Loading
Loading