-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
38 lines (30 loc) · 1.38 KB
/
build.zig
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
const std = @import("std");
const zls = @import("zls");
const MyCustomStep = @import("src/MyCustomStep.zig");
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const variant = b.option(
MyCustomStep.Variant,
"variant",
"what custom step variant should be emitted? used to test zls-build-info.json reloading",
) orelse .hello;
const my_custom_step = MyCustomStep.create(b, variant);
const exe = b.addExecutable(.{
.name = "zls-as-step",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
exe.step.dependOn(&my_custom_step.step);
exe.addAnonymousModule("hello-or-goodbye", .{ .source_file = my_custom_step.getOutput() });
exe.addAnonymousModule("my-package", .{ .source_file = .{ .path = "my-package/lib.zig" } });
b.installArtifact(exe);
const extract_build_info = zls.ExtractBuildInfo.create(b);
// Depend on everything you want ZLS to be able to complete
extract_build_info.step.dependOn(&exe.step);
b.getInstallStep().dependOn(&extract_build_info.step);
const install_zls = b.addInstallArtifact(b.dependency("zls", .{}).artifact("zls"), .{});
const tooling_step = b.step("install-zls", "Install tooling (ZLS)");
tooling_step.dependOn(&install_zls.step);
}