refactor: Broke comma into a separate package.

This commit is contained in:
2026-04-20 17:08:20 -04:00
parent 33b0063c67
commit 8a503cedfb
4 changed files with 90 additions and 74 deletions

View File

@@ -21,6 +21,11 @@ pub fn build(b: *std.Build) void {
// target and optimize options) will be listed when running `zig build --help`
// in this directory.
const comma = b.addModule("comma", .{
.root_source_file = b.path("src/comma.zig"),
.target = target,
});
// This creates a module, which represents a collection of source files alongside
// some compilation options, such as optimization mode and linked system libraries.
// Zig modules are the preferred way of making Zig code available to consumers.
@@ -39,6 +44,9 @@ pub fn build(b: *std.Build) void {
// Later on we'll use this module as the root module of a test executable
// which requires us to specify a target.
.target = target,
.imports = &.{
.{ .name = "comma", .module = comma },
},
});
// Here we define an executable. An executable needs to have a root module
@@ -78,6 +86,7 @@ pub fn build(b: *std.Build) void {
// repeated because you are allowed to rename your imports, which
// can be extremely useful in case of collisions (which can happen
// importing modules from different packages).
.{ .name = "comma", .module = comma },
.{ .name = "envr", .module = mod },
},
}),