kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'feature/remove_make_dependency_on_git' into 'master'
make: remove build system dependency on `git` using some hooks See merge request idf/esp-idf!2211pull/3290/head
commit
96b4a45cde
|
@ -185,7 +185,7 @@ The following variables are set at the project level, but exported for use in th
|
||||||
- ``CONFIG_*``: Each value in the project configuration has a corresponding variable available in make. All names begin with ``CONFIG_``.
|
- ``CONFIG_*``: Each value in the project configuration has a corresponding variable available in make. All names begin with ``CONFIG_``.
|
||||||
- ``CC``, ``LD``, ``AR``, ``OBJCOPY``: Full paths to each tool from the gcc xtensa cross-toolchain.
|
- ``CC``, ``LD``, ``AR``, ``OBJCOPY``: Full paths to each tool from the gcc xtensa cross-toolchain.
|
||||||
- ``HOSTCC``, ``HOSTLD``, ``HOSTAR``: Full names of each tool from the host native toolchain.
|
- ``HOSTCC``, ``HOSTLD``, ``HOSTAR``: Full names of each tool from the host native toolchain.
|
||||||
- ``IDF_VER``: Git version of ESP-IDF (produced by ``git describe``)
|
- ``IDF_VER``: ESP-IDF version, retrieved from either ``$(IDF_PATH)/version.txt`` file (if present) else using git command ``git describe``. Recommended format here is single liner that specifies major IDF release version, e.g. ``v2.0`` for a tagged release or ``v2.0-275-g0efaa4f`` for an arbitrary commit. Application can make use of this by calling :cpp:func:`esp_get_idf_version`.
|
||||||
|
|
||||||
If you modify any of these variables inside ``component.mk`` then this will not prevent other components from building but it may make your component hard to build and/or debug.
|
If you modify any of these variables inside ``component.mk`` then this will not prevent other components from building but it may make your component hard to build and/or debug.
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ Preprocessor Definitions
|
||||||
ESP-IDF build systems adds the following C preprocessor definitions on the command line:
|
ESP-IDF build systems adds the following C preprocessor definitions on the command line:
|
||||||
|
|
||||||
- ``ESP_PLATFORM`` — Can be used to detect that build happens within ESP-IDF.
|
- ``ESP_PLATFORM`` — Can be used to detect that build happens within ESP-IDF.
|
||||||
- ``IDF_VER`` — Defined to a git version string. E.g. ``v2.0`` for a tagged release or ``v1.0-275-g0efaa4f`` for an arbitrary commit.
|
- ``IDF_VER`` — ESP-IDF version, see `Preset Component Variables`_ for more details.
|
||||||
|
|
||||||
Build Process Internals
|
Build Process Internals
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
|
@ -227,7 +227,12 @@ endif
|
||||||
@echo $(ESPTOOLPY_WRITE_FLASH) $(ESPTOOL_ALL_FLASH_ARGS)
|
@echo $(ESPTOOLPY_WRITE_FLASH) $(ESPTOOL_ALL_FLASH_ARGS)
|
||||||
|
|
||||||
|
|
||||||
|
# If we have `version.txt` then prefer that for extracting IDF version
|
||||||
|
ifeq ("$(wildcard ${IDF_PATH}/version.txt)","")
|
||||||
IDF_VER := $(shell cd ${IDF_PATH} && git describe --always --tags --dirty)
|
IDF_VER := $(shell cd ${IDF_PATH} && git describe --always --tags --dirty)
|
||||||
|
else
|
||||||
|
IDF_VER := `cat ${IDF_PATH}/version.txt`
|
||||||
|
endif
|
||||||
|
|
||||||
# Set default LDFLAGS
|
# Set default LDFLAGS
|
||||||
EXTRA_LDFLAGS ?=
|
EXTRA_LDFLAGS ?=
|
||||||
|
@ -485,6 +490,8 @@ clean: app-clean bootloader-clean config-clean
|
||||||
#
|
#
|
||||||
# This only works for components inside IDF_PATH
|
# This only works for components inside IDF_PATH
|
||||||
check-submodules:
|
check-submodules:
|
||||||
|
# Check if .gitmodules exists, otherwise skip submodule check, assuming flattened structure
|
||||||
|
ifneq ("$(wildcard ${IDF_PATH}/.gitmodules)","")
|
||||||
|
|
||||||
# Dump the git status for the whole working copy once, then grep it for each submodule. This saves a lot of time on Windows.
|
# Dump the git status for the whole working copy once, then grep it for each submodule. This saves a lot of time on Windows.
|
||||||
GIT_STATUS := $(shell cd ${IDF_PATH} && git status --porcelain --ignore-submodules=dirty)
|
GIT_STATUS := $(shell cd ${IDF_PATH} && git status --porcelain --ignore-submodules=dirty)
|
||||||
|
@ -509,6 +516,7 @@ endef
|
||||||
# filter/subst in expression ensures all submodule paths begin with $(IDF_PATH), and then strips that prefix
|
# filter/subst in expression ensures all submodule paths begin with $(IDF_PATH), and then strips that prefix
|
||||||
# so the argument is suitable for use with 'git submodule' commands
|
# 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))))
|
$(foreach submodule,$(subst $(IDF_PATH)/,,$(filter $(IDF_PATH)/%,$(COMPONENT_SUBMODULES))),$(eval $(call GenerateSubmoduleCheckTarget,$(submodule))))
|
||||||
|
endif # End check for .gitmodules existence
|
||||||
|
|
||||||
|
|
||||||
# PHONY target to list components in the build and their paths
|
# PHONY target to list components in the build and their paths
|
||||||
|
|
|
@ -209,6 +209,23 @@ function run_tests()
|
||||||
git checkout main/component.mk
|
git checkout main/component.mk
|
||||||
rm -rf extra_source_dir
|
rm -rf extra_source_dir
|
||||||
|
|
||||||
|
print_status "Can build without git installed on system"
|
||||||
|
clean_build_dir
|
||||||
|
# Make provision for getting IDF version
|
||||||
|
echo "custom-version-x.y" > ${IDF_PATH}/version.txt
|
||||||
|
# Hide .gitmodules so that submodule check is avoided
|
||||||
|
[ -f ${IDF_PATH}/.gitmodules ] && mv ${IDF_PATH}/.gitmodules ${IDF_PATH}/.gitmodules_backup
|
||||||
|
# Overload `git` command
|
||||||
|
echo -e '#!/bin/bash\ntouch ${IDF_PATH}/git_invoked' > git
|
||||||
|
chmod +x git
|
||||||
|
OLD_PATH=$PATH
|
||||||
|
export PATH="$PWD:$PATH"
|
||||||
|
make
|
||||||
|
[ -f ${IDF_PATH}/git_invoked ] && rm ${IDF_PATH}/git_invoked && failure "git should not have been invoked in this case"
|
||||||
|
rm -f ${IDF_PATH}/version.txt git
|
||||||
|
[ -f ${IDF_PATH}/.gitmodules_backup ] && mv ${IDF_PATH}/.gitmodules_backup ${IDF_PATH}/.gitmodules
|
||||||
|
export PATH=$OLD_PATH
|
||||||
|
|
||||||
print_status "All tests completed"
|
print_status "All tests completed"
|
||||||
if [ -n "${FAILURES}" ]; then
|
if [ -n "${FAILURES}" ]; then
|
||||||
echo "Some failures were detected:"
|
echo "Some failures were detected:"
|
||||||
|
|
Ładowanie…
Reference in New Issue