Open-CMSIS-Pack / devtools

Open-CMSIS-Pack development tools - C++
Apache License 2.0
74 stars 55 forks source link

[csolution] Check that selected contexts satisfy cross-context dependencies early #1577

Closed jkrech closed 3 weeks ago

jkrech commented 3 months ago

Describe The Problem To Be Solved If the user does not select a set of contexts on invocation of cbuild/csolution that allow to resolve all dependencies between the contexts (related/dependent projects) the cmake build will fail, late in the build process. It is desirable to detect missing contexts by csolution during cbuild setup already.

Suggest A Solution Add validation step detecting all dependencies of selected contexts, either specified via *.cbuild-set.yml or via --context input from command line and checking whether the selected contexts are sufficient to satisfy the inter context dependencies. The output shall list the missing contexts.

brondani commented 3 months ago

Important note: selecting mixed build-types is allowed in accordance with https://github.com/Open-CMSIS-Pack/devtools/issues/1587

brondani commented 3 weeks ago

This has been solved as a consequence of https://github.com/Open-CMSIS-Pack/devtools/pull/1603 When a dependent cross-context is not selected, csolution throws the error:

ProjMgrLogger::Error("context '" + contextName + "' referenced by access sequence '" + sequenceName + "' does not exist or is not selected");
jkrech commented 3 weeks ago

I can confirm that the error message is present:

csolution-examples\SimpleTrustZone>cbuild SimpleTZ.csolution.yml -c CM33_ns.Debug
error csolution: context 'CM33_s' referenced by access sequence 'cmse-lib' does not exist or is not selected
+--------------------------------------------
(1/1) Cleaning context: "CM33_ns.Debug+CS300"
+--------------------------------------------
(1/1) Building context: "CM33_ns.Debug+CS300"
FAILED: CM33_ns.Debug+CS300/src/CM33_ns.Debug+CS300-stamp/CM33_ns.Debug+CS300-build C:/projects/GitHub/csolution-examples/SimpleTrustZone/out/CM33_ns/CS300/Debug/CM33_ns.axf C:/projects/GitHub/csolution-examples/SimpleTrustZone/tmp/CM33_ns.Debug+CS300/src/CM33_ns.Debug+CS300-stamp/CM33_ns.Debug+CS300-build
C:\WINDOWS\system32\cmd.exe /C "cd /D C:\projects\GitHub\csolution-examples\SimpleTrustZone\tmp\1 && C:\Users\jkrech\.vcpkg\downloads\artifacts\2139c4c6\tools.kitware.cmake\3.28.4\bin\cmake.exe -E echo "Building CMake target 'CM33_ns.Debug+CS300'" && C:\Users\jkrech\.vcpkg\downloads\artifacts\2139c4c6\tools.kitware.cmake\3.28.4\bin\cmake.exe --build C:/projects/GitHub/csolution-examples/SimpleTrustZone/tmp/1"
Building CMake target 'CM33_ns.Debug+CS300'
[1/4] Building C object CMakeFiles/Group_Non-secure_Code.dir/C_/projects/GitHub/csolution-examples/SimpleTrustZone/CM33_ns/main_ns.o
....

Once https://github.com/Open-CMSIS-Pack/devtools/issues/1714 is fixed this error should stop the invocation of cmake such that the user immediately sees the issue with the context selection.