From fcc96a2c466fda19f4d5985b61a1df706a589ea2 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 7 Jan 2022 14:02:54 +0100 Subject: [PATCH] tool/run: way to obtain list of build artifacts The new function 'build_artifacts' returns a list of artifacts created by the Genode build system. The list can be supplied as argument to the 'build_boot_image' function. Note that the list covers only program targets and shared libraries. Other artifacts created as side effects of custom rules are not covered. Fixes #4368 --- tool/run/run | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tool/run/run b/tool/run/run index 43f27c4ec5..863c20f3d0 100755 --- a/tool/run/run +++ b/tool/run/run @@ -44,6 +44,8 @@ proc assert_spec {spec} { # proc build {targets} { + global _collected_build_artifacts + if {[llength $targets] == 0} return if {[get_cmd_switch --skip-build]} return @@ -57,10 +59,33 @@ proc build {targets} { puts "Error: Genode build failed" exit -4 } + + # record the build artifacts created during the build process + set artifacts_log [exec sed -n "/^#/s/^# Build artifact //p" progress.log] + lappend _collected_build_artifacts {*}[split $artifacts_log "\n"] + puts "genode build completed" } +## +# Return list of build artifacts created during 'build' +# +# The returned artifacts can be used as boot-modules arguments for +# the 'build_boot_image' step. +# +proc build_artifacts { } { + + global _collected_build_artifacts + + if {![info exists _collected_build_artifacts]} { + return { } } + + # use lsort to remove duplicates + return [lsort -unique $_collected_build_artifacts] +} + + ## # Create a fresh boot directory #