Skip to content

Commit

Permalink
Add build and run steps for CLI test
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhongjia committed Feb 8, 2024
1 parent 82b882e commit 7324ec9
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- 连接类型,支持tcp,stdin/out,socket(socket优先支持)
27 changes: 27 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,31 @@ pub fn build(b: *std.Build) void {
msgpack_rpc_unit_tests.root_module.addImport("msgpack_rpc", msgpack_rpc);
const run_msgpack_rpc_tests = b.addRunArtifact(msgpack_rpc_unit_tests);
test_step.dependOn(&run_msgpack_rpc_tests.step);

{
//// build test cli
const build_step = b.step("build_cli", "build cli test");
const exe = b.addExecutable(.{
.name = "msgpack_rpc",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});

exe.root_module.addImport("msgpack_rpc", msgpack_rpc);

const install = b.addInstallArtifact(exe, .{});

build_step.dependOn(&install.step);

const run_exe = b.addRunArtifact(exe);

run_exe.step.dependOn(&install.step);

// 指定一个 step 为 run
const run_step = b.step("run_cli", "Run the cli");

// 指定该 step 依赖于 run_exe,即实际的运行
run_step.dependOn(&run_exe.step);
}
}
6 changes: 6 additions & 0 deletions src/main.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const std = @import("std");
const msgpack_rpc = @import("msgpack_rpc");

pub fn main() !void {
std.debug.print("hello, world", .{});
}
1 change: 0 additions & 1 deletion src/msgpack_rpc.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ const Header = struct {
t: MessageType,
id: ?u32,
};

0 comments on commit 7324ec9

Please sign in to comment.