Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate 'make git-submodule' to CLI command #19479

Merged
merged 1 commit into from
Jan 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Migrate 'make git-submodule' to CLI command
  • Loading branch information
zvecr committed Jan 2, 2023
commit 247efa1a177e29de85ce407a718a16edc45ac9d8
7 changes: 1 addition & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -430,12 +430,7 @@ lib/%:

.PHONY: git-submodule
git-submodule:
[ -e lib/ugfx ] && rm -rf lib/ugfx || true
[ -e lib/pico-sdk ] && rm -rf lib/pico-sdk || true
[ -e lib/chibios-contrib/ext/mcux-sdk ] && rm -rf lib/chibios-contrib/ext/mcux-sdk || true
[ -e lib/lvgl ] && rm -rf lib/lvgl || true
git submodule sync --recursive
git submodule update --init --recursive --progress
$(QMK_BIN) git-submodule

.PHONY: git-submodules
git-submodules: git-submodule
Expand Down
2 changes: 1 addition & 1 deletion builddefs/message.mk
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ MSG_CLEANING = Cleaning project:
MSG_CREATING_LIBRARY = Creating library:
MSG_GENERATING = Generating:
MSG_SUBMODULE_DIRTY = $(WARN_COLOR)WARNING:$(NO_COLOR) Some git submodules are out of date or modified.\n\
Please consider running $(BOLD)make git-submodule$(NO_COLOR).\n\n
Please consider running $(BOLD)qmk git-submodule$(NO_COLOR).\n\n
MSG_NO_CMP = $(ERROR_COLOR)Error:$(NO_COLOR)$(BOLD) cmp command not found, please install diffutils\n$(NO_COLOR)

define GENERATE_MSG_MAKE_KB
Expand Down
1 change: 1 addition & 0 deletions lib/python/qmk/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
'qmk.cli.generate.rgb_breathe_table',
'qmk.cli.generate.rules_mk',
'qmk.cli.generate.version_h',
'qmk.cli.git.submodule',
'qmk.cli.hello',
'qmk.cli.import.kbfirmware',
'qmk.cli.import.keyboard',
Expand Down
Empty file.
22 changes: 22 additions & 0 deletions lib/python/qmk/cli/git/submodule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import shutil
from qmk.path import normpath

from milc import cli

REMOVE_DIRS = [
'lib/ugfx',
'lib/pico-sdk',
'lib/chibios-contrib/ext/mcux-sdk',
'lib/lvgl',
]


@cli.subcommand('Git Submodule actions.')
def git_submodule(cli):
for folder in REMOVE_DIRS:
if normpath(folder).is_dir():
print(f"Removing '{folder}'")
shutil.rmtree(folder)

cli.run(['git', 'submodule', 'sync', '--recursive'], capture_output=False)
cli.run(['git', 'submodule', 'update', '--init', '--recursive', '--progress'], capture_output=False)