-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
83 lines (73 loc) · 2.68 KB
/
build.zig
File metadata and controls
83 lines (73 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
pub const Date_Time = tempora.Date_Time;
pub const Date = tempora.Date;
pub const Time = tempora.Time;
pub const Year = tempora.Year;
pub const Month = tempora.Month;
pub const Day = tempora.Day;
pub const Week_Day = tempora.Week_Day;
pub const Ordinal_Week = tempora.Ordinal_Week;
pub const Ordinal_Day = tempora.Ordinal_Day;
pub const ISO_Week_Date = tempora.ISO_Week_Date;
pub const ISO_Week = tempora.ISO_Week;
pub const Timezone = tempora.Timezone;
pub const tzdb = tempora.tzdb;
pub const now = tempora.now;
pub const now_local = tempora.now_local;
pub const now_tz = tempora.now_tz;
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const module = b.addModule("tempora", .{
.root_source_file = b.path("src/tempora.zig"),
});
const update_tzdb_exe = b.addExecutable(.{
.name = "update_tzdb",
.root_module = b.createModule(.{
.root_source_file = b.path("tools/update_tzdb.zig"),
.target = b.graph.host,
.optimize = .ReleaseSafe,
.imports = &.{
.{ .name = "tempora", .module = module },
},
}),
});
b.installArtifact(update_tzdb_exe);
_ = b.step("update_tzdb", "Rebuild tzdb data from the current host's /usr/share/zoneinfo/").dependOn(&b.addRunArtifact(update_tzdb_exe).step);
const dump_exe = b.addExecutable(.{
.name = "dump",
.root_module = b.createModule(.{
.root_source_file = b.path("tools/dump.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "tempora", .module = module },
},
}),
});
b.installArtifact(dump_exe);
const dump = b.addRunArtifact(dump_exe);
if (b.args) |args| dump.addArgs(args);
_ = b.step("dump", "Run dump utility").dependOn(&dump.step);
const run_all_tests = b.step("test", "Run all tests");
const tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/tempora.zig"),
.target = target,
.optimize = optimize,
}),
});
run_all_tests.dependOn(&b.addRunArtifact(tests).step);
const parser_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("test/parse_tzif.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "tempora", .module = module },
},
}),
});
run_all_tests.dependOn(&b.addRunArtifact(parser_tests).step);
}
const tempora = @import("src/tempora.zig");
const std = @import("std");