fix invalid union access in build_runner.zig (#723)

This commit is contained in:
Techatrix 2022-10-28 06:37:54 +02:00 committed by GitHub
parent 13f3b200bc
commit bca02bfde5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -142,7 +142,11 @@ fn processStep(
) anyerror!void { ) anyerror!void {
if (step.cast(InstallArtifactStep)) |install_exe| { if (step.cast(InstallArtifactStep)) |install_exe| {
if (install_exe.artifact.root_src) |src| { if (install_exe.artifact.root_src) |src| {
try packages.append(allocator, .{ .name = "root", .path = src.path }); const path = switch (src) {
.path => |path| path,
.generated => |generated| generated.path,
};
try packages.append(allocator, .{ .name = "root", .path = path });
} }
try processIncludeDirs(allocator, include_dirs, install_exe.artifact.include_dirs.items); try processIncludeDirs(allocator, include_dirs, install_exe.artifact.include_dirs.items);
@ -152,7 +156,11 @@ fn processStep(
} }
} else if (step.cast(LibExeObjStep)) |exe| { } else if (step.cast(LibExeObjStep)) |exe| {
if (exe.root_src) |src| { if (exe.root_src) |src| {
try packages.append(allocator, .{ .name = "root", .path = src.path }); const path = switch (src) {
.path => |path| path,
.generated => |generated| generated.path,
};
try packages.append(allocator, .{ .name = "root", .path = path });
} }
try processIncludeDirs(allocator, include_dirs, exe.include_dirs.items); try processIncludeDirs(allocator, include_dirs, exe.include_dirs.items);
try processPkgConfig(allocator, include_dirs, exe); try processPkgConfig(allocator, include_dirs, exe);