-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Remove zig-sqlite from vendored deps...use build.zig.zon instead - ansi-term isn't quite up to zig-0.13.0 yet so keep it vendored
- Loading branch information
1 parent
06d23ad
commit 5cfb116
Showing
50 changed files
with
216 additions
and
276,890 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
zig-out | ||
zig-cache | ||
.zig-cache | ||
bin | ||
clerk.db | ||
.clerk.db | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,70 @@ | ||
const std = @import("std"); | ||
|
||
pub fn build(b: *std.build.Builder) void { | ||
// Standard target options allows the person running `zig build` to choose | ||
// what target to build for. Here we do not override the defaults, which | ||
// means any target is allowed, and the default is native. Other options | ||
// for restricting supported target set are available. | ||
pub fn build(b: *std.Build) void { | ||
const target = b.standardTargetOptions(.{}); | ||
const optimize = b.standardOptimizeOption(.{}); | ||
|
||
// Standard release options allow the person running `zig build` to select | ||
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. | ||
const mode = b.standardReleaseOptions(); | ||
|
||
const sqlite = b.addStaticLibrary("sqlite", null); | ||
sqlite.addCSourceFile("lib/zig-sqlite/c/sqlite3.c", &[_][]const u8{ "-std=c99", "-DSQLITE_ENABLE_FTS5" }); | ||
sqlite.setTarget(target); | ||
sqlite.setBuildMode(mode); | ||
sqlite.linkLibC(); | ||
|
||
const exe = b.addExecutable("clerk", "src/main.zig"); | ||
exe.setTarget(target); | ||
exe.setBuildMode(mode); | ||
exe.addPackagePath("ansi-term", "lib/ansi-term/src/main.zig"); | ||
exe.linkLibrary(sqlite); | ||
exe.addPackagePath("sqlite", "lib/zig-sqlite/sqlite.zig"); | ||
exe.addIncludePath("lib/zig-sqlite/c"); | ||
exe.install(); | ||
|
||
const run_cmd = exe.run(); | ||
const sqlite = b.dependency("sqlite", .{ | ||
.target = target, | ||
.optimize = optimize, | ||
}); | ||
|
||
const @"ansi-term" = b.dependency("ansi-term", .{ | ||
.target = target, | ||
.optimize = optimize, | ||
}); | ||
|
||
const exe = b.addExecutable(.{ | ||
.name = "clerk", | ||
.root_source_file = b.path("src/main.zig"), | ||
.target = target, | ||
.optimize = optimize, | ||
}); | ||
exe.root_module.addImport("sqlite", sqlite.module("sqlite")); | ||
exe.root_module.addImport("ansi-term", @"ansi-term".module("ansi-term")); | ||
|
||
// links the bundled sqlite3, so leave this out if you link the system one | ||
exe.linkLibrary(sqlite.artifact("sqlite")); | ||
|
||
// This declares intent for the executable to be installed into the | ||
// standard location when the user invokes the "install" step (the default | ||
// step when running `zig build`). | ||
b.installArtifact(exe); | ||
|
||
// This *creates* a Run step in the build graph, to be executed when another | ||
// step is evaluated that depends on it. The next line below will establish | ||
// such a dependency. | ||
const run_cmd = b.addRunArtifact(exe); | ||
|
||
// By making the run step depend on the install step, it will be run from the | ||
// installation directory rather than directly from within the cache directory. | ||
// This is not necessary, however, if the application depends on other installed | ||
// files, this ensures they will be present and in the expected location. | ||
run_cmd.step.dependOn(b.getInstallStep()); | ||
|
||
// This allows the user to pass arguments to the application in the build | ||
// command itself, like this: `zig build run -- arg1 arg2 etc` | ||
if (b.args) |args| { | ||
run_cmd.addArgs(args); | ||
} | ||
|
||
// This creates a build step. It will be visible in the `zig build --help` menu, | ||
// and can be selected like this: `zig build run` | ||
// This will evaluate the `run` step rather than the default, which is "install". | ||
const run_step = b.step("run", "Run the app"); | ||
run_step.dependOn(&run_cmd.step); | ||
|
||
const exe_tests = b.addTest("src/main.zig"); | ||
exe_tests.setTarget(target); | ||
exe_tests.setBuildMode(mode); | ||
const exe_unit_tests = b.addTest(.{ | ||
.root_source_file = b.path("src/main.zig"), | ||
.target = target, | ||
.optimize = optimize, | ||
}); | ||
|
||
const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); | ||
|
||
// Similar to creating the run step earlier, this exposes a `test` step to | ||
// the `zig build --help` menu, providing a way for the user to request | ||
// running the unit tests. | ||
const test_step = b.step("test", "Run unit tests"); | ||
test_step.dependOn(&exe_tests.step); | ||
test_step.dependOn(&run_exe_unit_tests.step); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.{ | ||
.name = "clerk", | ||
.version = "0.0.0", | ||
.dependencies = .{ | ||
.sqlite = .{ | ||
.url = "https://github.com/vrischmann/zig-sqlite/archive/91e5fedd15c5ea3cb42ccceefb3d0f4bb9bad68f.tar.gz", | ||
.hash = "1220ba277845cb3cece7a7a1f929b920c97e9085bb644471c5dc8c72571f1485c75f", | ||
}, | ||
.@"ansi-term" = .{ | ||
// ansi-term not yet on zig-0.13.0 | ||
// .url = "https://github.com/ziglibs/ansi-term/archive/f9ea80dc9769dfffbb4c56a904149940c79168da.tar.gz", | ||
// .hash = "1220c650d57ceb323d3e74945189aaae7a9c0ac74afd023cba5533fb7d5874b2955c", | ||
.path = "lib/ansi-term", | ||
}, | ||
}, | ||
.paths = .{""}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Documentation | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
|
||
# Allow manually starting the workflow. | ||
workflow_dispatch: | ||
|
||
# If two concurrent runs are started, | ||
# prefer the latest one. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
|
||
build: | ||
name: Build docs website | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: goto-bus-stop/setup-zig@v2 | ||
with: | ||
version: 0.12.0 | ||
- name: Build | ||
run: zig build docs | ||
- name: Upload | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: "zig-out/docs/" | ||
|
||
publish: | ||
name: Publish website | ||
runs-on: ubuntu-latest | ||
needs: build # wait for build to finish | ||
permissions: | ||
# Request sufficient permissions to publish the website. | ||
pages: write | ||
id-token: write | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
zig-cache/ | ||
zig-out/ | ||
deps.zig | ||
gyro.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,30 @@ | ||
const Builder = @import("std").build.Builder; | ||
const Build = @import("std").Build; | ||
|
||
pub fn build(b: *Builder) void { | ||
pub fn build(b: *Build) void { | ||
const target = b.standardTargetOptions(.{}); | ||
const mode = b.standardReleaseOptions(); | ||
const optimize = b.standardOptimizeOption(.{}); | ||
|
||
var main_tests = b.addTest("src/main.zig"); | ||
main_tests.setTarget(target); | ||
main_tests.setBuildMode(mode); | ||
_ = b.addModule("ansi-term", .{ | ||
.root_source_file = b.path("src/main.zig"), | ||
}); | ||
|
||
var main_tests = b.addTest(.{ | ||
.root_source_file = b.path("src/main.zig"), | ||
.target = target, | ||
.optimize = optimize, | ||
}); | ||
|
||
const run_main_tests = b.addRunArtifact(main_tests); | ||
|
||
const test_step = b.step("test", "Run library tests"); | ||
test_step.dependOn(&main_tests.step); | ||
test_step.dependOn(&run_main_tests.step); | ||
|
||
const install_docs = b.addInstallDirectory(.{ | ||
.source_dir = main_tests.getEmittedDocs(), | ||
.install_dir = .prefix, | ||
.install_subdir = "docs", | ||
}); | ||
|
||
const docs_step = b.step("docs", "Generate documentation"); | ||
docs_step.dependOn(&install_docs.step); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.{ | ||
.name = "ansi-term", | ||
.version = "0.0.0", | ||
.paths = .{ | ||
"build.zig", | ||
"build.zig.zon", | ||
"src/", | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.