build: raise error if requested application is unbuildable

Message ID 20240618125113.1591405-1-david.marchand@redhat.com (mailing list archive)
State Accepted
Delegated to: David Marchand
Headers
Series build: raise error if requested application is unbuildable |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

David Marchand June 18, 2024, 12:51 p.m. UTC
  Similarly to libraries, when setting a list of desired applications,
report if some application cannot be built because of a missing
dependency.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/meson.build | 10 ++++++++++
 1 file changed, 10 insertions(+)
  

Comments

Bruce Richardson June 18, 2024, 12:56 p.m. UTC | #1
On Tue, Jun 18, 2024 at 02:51:12PM +0200, David Marchand wrote:
> Similarly to libraries, when setting a list of desired applications,
> report if some application cannot be built because of a missing
> dependency.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  app/meson.build | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  
Tyler Retzlaff June 19, 2024, 12:13 a.m. UTC | #2
On Tue, Jun 18, 2024 at 02:51:12PM +0200, David Marchand wrote:
> Similarly to libraries, when setting a list of desired applications,
> report if some application cannot be built because of a missing
> dependency.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
  
David Marchand June 25, 2024, 12:36 p.m. UTC | #3
On Tue, Jun 18, 2024 at 2:57 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
> On Tue, Jun 18, 2024 at 02:51:12PM +0200, David Marchand wrote:
> > Similarly to libraries, when setting a list of desired applications,
> > report if some application cannot be built because of a missing
> > dependency.
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Applied, thanks.
  

Patch

diff --git a/app/meson.build b/app/meson.build
index 21b6da29b3..5b2c80c7a1 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -10,7 +10,9 @@  disable_apps = run_command(list_dir_globs, disable_apps, check: true).stdout().s
 
 enable_apps = ',' + get_option('enable_apps')
 enable_apps = run_command(list_dir_globs, enable_apps, check: true).stdout().split()
+require_apps = true
 if enable_apps.length() == 0
+    require_apps = false
     enable_apps = run_command(list_dir_globs, '*', check: true).stdout().split()
 endif
 
@@ -74,6 +76,10 @@  foreach app:apps
 
     if build
         subdir(name)
+        if not build and require_apps
+            error('Cannot build explicitly requested app "@0@".\n'.format(name)
+                  + '\tReason: ' + reason)
+        endif
     endif
 
     if build
@@ -84,6 +90,10 @@  foreach app:apps
                 build = false
                 reason = 'missing internal dependency, "@0@"'.format(d)
                 message('Missing dependency "@0@" for app "@1@"'.format(d, name))
+                if require_apps
+                    error('Cannot build explicitly requested app "@0@".\n'.format(name)
+                          + '\tPlease add missing dependency "@0@" to "enable_libs" option'.format(d))
+                endif
                 break
             endif
             dep_objs += [get_variable(var_name)]