@@ -1031,6 +1031,7 @@ fn extractBuildInformation(
10311031 modules : * std .StringArrayHashMapUnmanaged (shared.BuildConfig.Module ),
10321032 module : * std.Build.Module ,
10331033 compile : ? * Step.Compile ,
1034+ cwd : []const u8 ,
10341035 ) ! void {
10351036 const root_source_file = module .root_source_file orelse return ;
10361037
@@ -1084,8 +1085,6 @@ fn extractBuildInformation(
10841085 }
10851086 }
10861087
1087- const cwd = try std .process .getCwdAlloc (allocator );
1088-
10891088 const root_source_file_path = try std .fs .path .resolve (allocator , &.{ cwd , root_source_file .getPath2 (module .owner , null ) });
10901089
10911090 // All modules with the same root source file are merged. This limitation may be lifted in the future.
@@ -1190,11 +1189,12 @@ fn extractBuildInformation(
11901189 // - modules that are reachable from the "install" step
11911190 // - all other reachable modules
11921191 var modules : std .StringArrayHashMapUnmanaged (BuildConfig .Module ) = .empty ;
1192+ const cwd = try std .process .getCwdAlloc (arena );
11931193
11941194 for (b .modules .values ()) | root_module | {
11951195 const graph = root_module .getGraph ();
11961196 for (graph .modules ) | module | {
1197- try helper .processModule (arena , & modules , module , null );
1197+ try helper .processModule (arena , & modules , module , null , cwd );
11981198 }
11991199 }
12001200
@@ -1206,11 +1206,21 @@ fn extractBuildInformation(
12061206 const compile = step .cast (Step .Compile ) orelse continue ;
12071207 const graph = compile .root_module .getGraph ();
12081208 for (graph .modules ) | module | {
1209- try helper .processModule (arena , & modules , module , compile );
1209+ try helper .processModule (arena , & modules , module , compile , cwd );
12101210 }
12111211 }
12121212 }
12131213
1214+ var compilations : std .ArrayList (BuildConfig .Compile ) = .empty ;
1215+ for (all_steps .keys ()) | step | {
1216+ const compile = step .cast (Step .Compile ) orelse continue ;
1217+ const root_source_file = compile .root_module .root_source_file orelse continue ;
1218+ const root_source_file_path = try std .fs .path .resolve (arena , &.{ cwd , root_source_file .getPath2 (compile .root_module .owner , null ) });
1219+ try compilations .append (arena , .{
1220+ .root_module = root_source_file_path ,
1221+ });
1222+ }
1223+
12141224 // Sample `@dependencies` structure:
12151225 // pub const packages = struct {
12161226 // pub const @"1220363c7e27b2d3f39de6ff6e90f9537a0634199860fea237a55ddb1e1717f5d6a5" = struct {
@@ -1255,6 +1265,7 @@ fn extractBuildInformation(
12551265 BuildConfig {
12561266 .dependencies = .{ .map = root_dependencies },
12571267 .modules = .{ .map = modules },
1268+ .compilations = compilations .items ,
12581269 .top_level_steps = b .top_level_steps .keys (),
12591270 .available_options = .{ .map = available_options },
12601271 },
0 commit comments