Commit Graph
7 Commits
Author SHA1 Message Date
Benjamin Cabé 1bdbb4fbf0 fix(build): check the submodules of parallel builds one at a time (#29178)
* fix(build): check the submodules of parallel builds one at a time

Each configure runs Tools/check_submodules.sh, which fetches the missing submodules. When two builds configured at the same time in one checkout, from two terminals, an IDE and a terminal, or a script building several targets, both fetched the same submodules and git failed in one of them, for example with "could not lock config file .git/config: File exists" and "Failed to register url for submodule path", which stopped that build.

The check now holds a lock in the git directory, which the worktrees of a repository share, as they share its submodule configuration. A build that configures while another one checks the submodules waits for it, then finds them fetched.

Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>

* fix(build): check the submodules without the lock when it can't be taken

A configure failed when the submodule lock couldn't be taken: when the git directory is read-only, such as an out-of-tree build from a read-only mount, or after the 30 minutes of the timeout, where it succeeded before the lock. It now warns, naming the lock file, and checks the submodules without the lock. As file(LOCK) fails the configure when it can't create its file, whatever its RESULT_VARIABLE, the lock file is created first with cmake -E touch. With GIT_SUBMODULES_ARE_EVIL set, where check_submodules.sh exits at once, as in every slot of build_all, no lock is taken.

Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>

---------

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-10-29 18:25:14 -06:00
Benjamin Cabé 700452758a build(git): check only the submodules a build needs (#29095)
* build(git): check only the submodules a build needs

Tools/check_submodules.sh fetches every missing submodule, so a build that uses a handful of PX4 libraries still clones NuttX, the simulators and the middleware. Paths given as arguments now limit the check, and the configure step passes PX4_GIT_SUBMODULES when it is set. Builds that do not set it check all submodules as before. A path that is not a submodule, or a submodule the build uses but that is not checked out, stops the configure instead of failing later in the build.

Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>

* docs(dev_setup): document PX4_GIT_SUBMODULES

The submodule check can be limited to the submodules a build needs. List the variable next to GIT_SUBMODULES_ARE_EVIL, the other way to control the check.

Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>

* test(git): cover the submodule check limited to given paths

A second top-level submodule gives the tests one to leave out, so they check that paths given to check_submodules.sh limit both the fetch of missing submodules and the report of changed ones, and that a path that is not a submodule fails the check.

Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>

---------

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-10-23 12:14:57 -08:00
Ramon Roche 14cf29bb31 fix(build): check submodules once per configure, never reset changes
Every px4_add_git_submodule call ran check_submodules.sh twice, at
configure and build time, and with CI=true force-updated each submodule
every time, a 2017 workaround for an interactive prompt that is gone.
VS Code and CLion force-updated too, resetting submodule changes under
development.

The check now runs once per configure. A missing submodule is fetched;
one at another commit is kept as it is, with a warning locally and an
error in CI.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-28 11:50:38 -07:00
Daniel Agar ea79bd733d cmake add a few include guards
- this is a minor cmake configure time optimization
2019-11-16 16:27:36 -05:00
Daniel Agar fb7521eb5e cmake px4_base -> px4_parse_function_args 2019-09-15 14:36:38 -04:00
Daniel Agar 11be2b8873 cmake split px4_base into px4_add_module, px4_add_library, px4_add_common_flags 2018-11-26 14:40:14 -08:00
Daniel Agar f692ad04d0 boards organization 2018-11-26 14:40:14 -08:00