Extract packages from all top level steps

This commit is contained in:
Alexandros Naskos 2020-06-15 02:26:54 +03:00
parent bfdeecbd04
commit 819b367360

View File

@ -5,6 +5,7 @@ const fmt = std.fmt;
const Builder = std.build.Builder; const Builder = std.build.Builder;
const Pkg = std.build.Pkg; const Pkg = std.build.Pkg;
const InstallArtifactStep = std.build.InstallArtifactStep; const InstallArtifactStep = std.build.InstallArtifactStep;
const LibExeObjStep = std.build.LibExeObjStep;
const ArrayList = std.ArrayList; const ArrayList = std.ArrayList;
///! This is a modified build runner to extract information out of build.zig ///! This is a modified build runner to extract information out of build.zig
@ -26,11 +27,17 @@ pub fn main() !void {
// TODO: We currently add packages from every LibExeObj step that the install step depends on. // TODO: We currently add packages from every LibExeObj step that the install step depends on.
// Should we error out or keep one step or something similar? // Should we error out or keep one step or something similar?
// We also flatten them, we should probably keep the nested structure. // We also flatten them, we should probably keep the nested structure.
for (builder.getInstallStep().dependencies.items) |step| { for (builder.top_level_steps.items) |tls| {
for (tls.step.dependencies.items) |step| {
if (step.cast(InstallArtifactStep)) |install_exe| { if (step.cast(InstallArtifactStep)) |install_exe| {
for (install_exe.artifact.packages.items) |pkg| { for (install_exe.artifact.packages.items) |pkg| {
try processPackage(stdout_stream, pkg); try processPackage(stdout_stream, pkg);
} }
} else if (step.cast(LibExeObjStep)) |exe| {
for (exe.packages.items) |pkg| {
try processPackage(stdout_stream, pkg);
}
}
} }
} }
} }