CI: build system do not check submodule for CI

This commit is contained in:
He Yin Ling 2019-11-30 13:36:31 +08:00 committed by bot
parent 729451ef60
commit 6418be692a
3 changed files with 19 additions and 4 deletions

View File

@ -30,6 +30,8 @@ variables:
# jobs can overwrite this variable to only fetch submodules they required
# set to "none" if don't need to fetch submodules
SUBMODULES_TO_FETCH: "all"
# tell build system do not check submodule update as we download archive instead of clone
IDF_SKIP_CHECK_SUBMODULES: 1
UNIT_TEST_BUILD_SYSTEM: make
# IDF environment

View File

@ -144,7 +144,7 @@ EXTRA_COMPONENT_DIRS ?=
COMPONENT_DIRS := $(PROJECT_PATH)/components $(EXTRA_COMPONENT_DIRS) $(IDF_PATH)/components $(PROJECT_PATH)/main
endif
# Make sure that every directory in the list is an absolute path without trailing slash.
# This is necessary to split COMPONENT_DIRS into SINGLE_COMPONENT_DIRS and MULTI_COMPONENT_DIRS below.
# This is necessary to split COMPONENT_DIRS into SINGLE_COMPONENT_DIRS and MULTI_COMPONENT_DIRS below.
COMPONENT_DIRS := $(foreach cd,$(COMPONENT_DIRS),$(abspath $(cd)))
export COMPONENT_DIRS
@ -153,11 +153,11 @@ $(warning SRCDIRS variable is deprecated. These paths can be added to EXTRA_COMP
COMPONENT_DIRS += $(abspath $(SRCDIRS))
endif
# List of component directories, i.e. directories which contain a component.mk file
# List of component directories, i.e. directories which contain a component.mk file
SINGLE_COMPONENT_DIRS := $(abspath $(dir $(dir $(foreach cd,$(COMPONENT_DIRS),\
$(wildcard $(cd)/component.mk)))))
# List of components directories, i.e. directories which may contain components
# List of components directories, i.e. directories which may contain components
MULTI_COMPONENT_DIRS := $(filter-out $(SINGLE_COMPONENT_DIRS),$(COMPONENT_DIRS))
# The project Makefile can define a list of components, but if it does not do this
@ -583,6 +583,11 @@ clean: app-clean bootloader-clean config-clean ldgen-clean
#
# This only works for components inside IDF_PATH
check-submodules:
# for internal use:
# skip submodule check if running on Gitlab CI and job is configured as not clone submodules
ifeq ($(IDF_SKIP_CHECK_SUBMODULES),1)
@echo "skip submodule check on internal CI"
else
# Check if .gitmodules exists, otherwise skip submodule check, assuming flattened structure
ifneq ("$(wildcard ${IDF_PATH}/.gitmodules)","")
@ -610,7 +615,7 @@ endef
# so the argument is suitable for use with 'git submodule' commands
$(foreach submodule,$(subst $(IDF_PATH)/,,$(filter $(IDF_PATH)/%,$(COMPONENT_SUBMODULES))),$(eval $(call GenerateSubmoduleCheckTarget,$(submodule))))
endif # End check for .gitmodules existence
endif
# PHONY target to list components in the build and their paths
list-components:

View File

@ -11,6 +11,14 @@ if(NOT GIT_FOUND)
else()
function(git_submodule_check root_path)
# for internal use:
# skip submodule check if running on Gitlab CI and job is configured as not clone submodules
if($ENV{IDF_SKIP_CHECK_SUBMODULES})
if($ENV{IDF_SKIP_CHECK_SUBMODULES} EQUAL 1)
message("skip submodule check on internal CI")
return()
endif()
endif()
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule status