Skip to content

Commit 25febf3

Browse files
committed
Support submodules in repository-sourced dependencies
Although submodules should not be used in Arduino libraries, they are used in some popular boards platforms and thus supporting them is useful.
1 parent a52a021 commit 25febf3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compilesketches/compilesketches.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,8 @@ def clone_repository(self, url, git_ref, destination_path):
557557
"""
558558
if git_ref is None:
559559
# Shallow clone is only possible if using the tip of the branch
560-
clone_arguments = {"depth": 1}
560+
# Use `None` as value for `git clone` options with no argument
561+
clone_arguments = {"depth": 1, "shallow-submodules": None, "recurse-submodules": True}
561562
else:
562563
clone_arguments = {}
563564
cloned_repository = git.Repo.clone_from(url=url, to_path=destination_path, **clone_arguments)
@@ -573,6 +574,7 @@ def clone_repository(self, url, git_ref, destination_path):
573574

574575
# checkout ref
575576
cloned_repository.git.checkout(git_ref)
577+
cloned_repository.git.submodule("update", "--init", "--recursive", "--recommend-shallow")
576578

577579
def install_platforms_from_download(self, platform_list):
578580
"""Install libraries by downloading them

0 commit comments

Comments
 (0)