waf : wscript add submoduleclean & submodule_force_clean

This commit is contained in:
Joshua Henderson 2024-01-16 01:17:00 -05:00 committed by Andrew Tridgell
parent b42138bfb6
commit f1ca5bea49
2 changed files with 28 additions and 0 deletions

View File

@ -102,6 +102,11 @@ list some basic and more used commands as example.
Cleaning the build is very often not necessary and discouraged. We do Cleaning the build is very often not necessary and discouraged. We do
incremental builds reducing the build time by orders of magnitude. incremental builds reducing the build time by orders of magnitude.
If submodules are failing to be synchronized, `submodulesync` may be used
to resync the submodules. This is usually necessary when shifting development
between stable releases or a stable release and the master branch.
In some some cases `submodule_force_clean` may be necessary. This removes all submodules and then performs a `submodulesync`. (Note whitelisted modules like esp_idf is not removed.)
* **Upload or install** * **Upload or install**

23
wscript
View File

@ -86,6 +86,29 @@ def _set_build_context_variant(board):
continue continue
c.variant = board c.variant = board
# Remove all submodules and then sync
@conf
def submodule_force_clean(ctx):
whitelist = {
'COLCON_IGNORE',
'esp_idf',
}
# Get all items in the modules folder
module_list = os.scandir('modules')
# Delete all directories except those in the whitelist
for module in module_list:
if (module.is_dir()) and (module.name not in whitelist):
shutil.rmtree(module)
submodulesync(ctx)
# run Tools/gittools/submodule-sync.sh to sync submodules
@conf
def submodulesync(ctx):
subprocess.call(['Tools/gittools/submodule-sync.sh'])
def init(ctx): def init(ctx):
# Generate Task List, so that VS Code extension can keep track # Generate Task List, so that VS Code extension can keep track
# of changes to possible build targets # of changes to possible build targets