Cambios principales: - build.zig: root_source_file → root_module con b.createModule() - stdout: std.io.getStdOut() → std.fs.File.stdout().deprecatedWriter() - ArrayList: std.ArrayList → std.array_list.Managed - file.reader(): deprecatedReader() para compatibilidad - HTTP Client: client.open/send/wait → client.fetch() - sleep: std.time.sleep → std.Thread.sleep Código funciona correctamente con Zig 0.15.2. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
44 lines
1.3 KiB
Zig
44 lines
1.3 KiB
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
const exe = b.addExecutable(.{
|
|
.name = "service-monitor",
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("src/main.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
}),
|
|
});
|
|
|
|
// Instalar en carpeta raíz del proyecto (no en zig-out/)
|
|
b.getInstallStep().dependOn(&b.addInstallArtifact(exe, .{
|
|
.dest_dir = .{ .override = .{ .custom = ".." } },
|
|
}).step);
|
|
|
|
// Comando: zig build run
|
|
const run_cmd = b.addRunArtifact(exe);
|
|
run_cmd.step.dependOn(b.getInstallStep());
|
|
|
|
if (b.args) |args| {
|
|
run_cmd.addArgs(args);
|
|
}
|
|
|
|
const run_step = b.step("run", "Ejecutar service-monitor");
|
|
run_step.dependOn(&run_cmd.step);
|
|
|
|
// Tests
|
|
const unit_tests = b.addTest(.{
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("src/main.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
}),
|
|
});
|
|
|
|
const run_unit_tests = b.addRunArtifact(unit_tests);
|
|
const test_step = b.step("test", "Ejecutar tests");
|
|
test_step.dependOn(&run_unit_tests.step);
|
|
}
|