aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeer <himbeer@disroot.org>2024-07-31 10:56:46 +0200
committerHimbeer <himbeer@disroot.org>2024-07-31 10:56:46 +0200
commit710185dfab1e104e799ed23d9ab5ecb7f77f9190 (patch)
tree4a5e66a871cb50f954bdbc6a8b42261bb0bb68c8
parent76942184fd7e50eabfff1fde4733eaad26cc5d9c (diff)
build: Remove executable artifact
-rw-r--r--build.zig44
-rw-r--r--src/main.zig28
2 files changed, 0 insertions, 72 deletions
diff --git a/build.zig b/build.zig
index 0b20280..01429a6 100644
--- a/build.zig
+++ b/build.zig
@@ -34,41 +34,6 @@ pub fn build(b: *std.Build) void {
// running `zig build`).
b.installArtifact(lib);
- const exe = b.addExecutable(.{
- .name = "sys",
- .root_source_file = b.path("src/main.zig"),
- .target = target,
- .optimize = optimize,
- });
-
- // 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);
-
// Creates a step for unit testing. This only builds the test executable
// but does not run it.
const lib_unit_tests = b.addTest(.{
@@ -79,18 +44,9 @@ pub fn build(b: *std.Build) void {
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
- 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(&run_lib_unit_tests.step);
- test_step.dependOn(&run_exe_unit_tests.step);
}
diff --git a/src/main.zig b/src/main.zig
deleted file mode 100644
index bb3c039..0000000
--- a/src/main.zig
+++ /dev/null
@@ -1,28 +0,0 @@
-// SPDX-FileCopyrightText: Zig contributors
-//
-// SPDX-License-Identifier: MIT
-
-const std = @import("std");
-
-pub fn main() !void {
- // Prints to stderr (it's a shortcut based on `std.io.getStdErr()`)
- std.debug.print("All your {s} are belong to us.\n", .{"codebase"});
-
- // stdout is for the actual output of your application, for example if you
- // are implementing gzip, then only the compressed bytes should be sent to
- // stdout, not any debugging messages.
- const stdout_file = std.io.getStdOut().writer();
- var bw = std.io.bufferedWriter(stdout_file);
- const stdout = bw.writer();
-
- try stdout.print("Run `zig build test` to run the tests.\n", .{});
-
- try bw.flush(); // don't forget to flush!
-}
-
-test "simple test" {
- var list = std.ArrayList(i32).init(std.testing.allocator);
- defer list.deinit(); // try commenting this out and see if zig detects the memory leak!
- try list.append(42);
- try std.testing.expectEqual(@as(i32, 42), list.pop());
-}