@@ -52,15 +52,28 @@ build_files: std.ArrayListUnmanaged(*BuildFile),
52
52
build_runner_path : []const u8 ,
53
53
build_runner_cache_path : []const u8 ,
54
54
std_uri : ? []const u8 ,
55
+ zig_cache_root : []const u8 ,
56
+ zig_global_cache_root : []const u8 ,
55
57
56
- pub fn init (self : * DocumentStore , allocator : std.mem.Allocator , zig_exe_path : ? []const u8 , build_runner_path : []const u8 , build_runner_cache_path : []const u8 , zig_lib_path : ? []const u8 ) ! void {
58
+ pub fn init (
59
+ self : * DocumentStore ,
60
+ allocator : std.mem.Allocator ,
61
+ zig_exe_path : ? []const u8 ,
62
+ build_runner_path : []const u8 ,
63
+ build_runner_cache_path : []const u8 ,
64
+ zig_lib_path : ? []const u8 ,
65
+ zig_cache_root : []const u8 ,
66
+ zig_global_cache_root : []const u8 ,
67
+ ) ! void {
57
68
self .allocator = allocator ;
58
69
self .handles = std .StringHashMap (* Handle ).init (allocator );
59
70
self .zig_exe_path = zig_exe_path ;
60
71
self .build_files = .{};
61
72
self .build_runner_path = build_runner_path ;
62
73
self .build_runner_cache_path = build_runner_cache_path ;
63
74
self .std_uri = try stdUriFromLibPath (allocator , zig_lib_path );
75
+ self .zig_cache_root = zig_cache_root ;
76
+ self .zig_global_cache_root = zig_global_cache_root ;
64
77
}
65
78
66
79
fn loadBuildAssociatedConfiguration (allocator : std.mem.Allocator , build_file : * BuildFile , build_file_path : []const u8 ) ! void {
@@ -98,6 +111,8 @@ const LoadPackagesContext = struct {
98
111
build_runner_cache_path : []const u8 ,
99
112
zig_exe_path : []const u8 ,
100
113
build_file_path : ? []const u8 = null ,
114
+ cache_root : []const u8 ,
115
+ global_cache_root : []const u8 ,
101
116
};
102
117
103
118
fn loadPackages (context : LoadPackagesContext ) ! void {
@@ -123,6 +138,11 @@ fn loadPackages(context: LoadPackagesContext) !void {
123
138
"@build@" ,
124
139
build_file_path ,
125
140
"--pkg-end" ,
141
+ "--" ,
142
+ zig_exe_path ,
143
+ directory_path ,
144
+ context .cache_root ,
145
+ context .global_cache_root ,
126
146
},
127
147
});
128
148
@@ -229,6 +249,8 @@ fn newDocument(self: *DocumentStore, uri: []const u8, text: [:0]u8) anyerror!*Ha
229
249
.build_runner_cache_path = self .build_runner_cache_path ,
230
250
.zig_exe_path = self .zig_exe_path .? ,
231
251
.build_file_path = build_file_path ,
252
+ .cache_root = self .zig_cache_root ,
253
+ .global_cache_root = self .zig_global_cache_root ,
232
254
}) catch | err | {
233
255
log .debug ("Failed to load packages of build file {s} (error: {})" , .{ build_file .uri , err });
234
256
};
@@ -496,6 +518,8 @@ pub fn applySave(self: *DocumentStore, handle: *Handle) !void {
496
518
.build_runner_path = self .build_runner_path ,
497
519
.build_runner_cache_path = self .build_runner_cache_path ,
498
520
.zig_exe_path = self .zig_exe_path .? ,
521
+ .cache_root = self .zig_cache_root ,
522
+ .global_cache_root = self .zig_global_cache_root ,
499
523
}) catch | err | {
500
524
log .debug ("Failed to load packages of build file {s} (error: {})" , .{ build_file .uri , err });
501
525
};
0 commit comments