Allow selection of subdirectory-scoped 'all' targets when using Makefiles - #48
Allow selection of subdirectory-scoped 'all' targets when using Makefiles#48cresswellp wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #48 +/- ##
===========================================
+ Coverage 49.20% 49.35% +0.14%
===========================================
Files 51 51
Lines 10385 10409 +24
===========================================
+ Hits 5110 5137 +27
+ Misses 5275 5272 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds Makefile support for CMake’s directory-scoped /all targets.
Changes:
- Routes
/alltargets throughCMakeFiles/Makefile2. - Refactors build-script test setup and adds target-routing tests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
ecbundle/build.py |
Selects Makefile2 for directory-scoped targets. |
tests/bundle_build/test_build.py |
Adds Make and Ninja routing tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if self._needs_directory_recursion_file(targets): | ||
| # "/all" targets only exist in Makefile2, not the top-level Makefile | ||
| command_list.append("-f CMakeFiles/Makefile2") | ||
| command_list.append(self.targets(targets)) |
There was a problem hiding this comment.
I think this is a valid concern don't you agree? How about also including a test for this?
|
Thanks @cresswellp this is a very nice consolidation between backends. Please check the copilot suggestion. |
Description
CMake gives each new
add_subdirectory()call its ownalltarget, for building everything in that scope. When using the Ninja generator we can select these targets as--target=foo/all(foo/bar/all, etc.), but when using Makefiles they're defined in CMakeFiles/Makefile2 and not visible to ecbundle. This change adds the relevant Makefile2 targets to the command list, so they can be selected with either generator. Other types of recursive targets (/clean,/installetc.) remain hidden.Note that Makefile2 targets don't come with the same
[XX%]progress counter that Makefile targets do, as they lack the necessarycmake_progress_startinfrastructure. We could fake this within ecbundle itself, but it'd either be progress against the whole build which isn't especially useful (e.g. it'd stop at 20% instead of 100%), or else we can try to set up counters per subproject, but then it's not clear what's being measured if targets spanning multiple subprojects are selected. So I've left this as is (no counter).A new helper function is used to streamline the new tests, so the existing build tests have been updated to use it too.
Contributor Declaration
By opening this pull request, I affirm the following: