mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/git_describe_always_for_cmake' into 'master'
tools: Add --always option to git describe for Cmake See merge request idf/esp-idf!4107
This commit is contained in:
commit
58b5394266
@ -35,22 +35,22 @@ PROJECT_VER:= $(PROJECT_VER)
|
||||
endif
|
||||
|
||||
# cut PROJECT_VER and PROJECT_NAME to required 32 characters.
|
||||
PROJECT_VER_CUT := $(shell echo $(PROJECT_VER) | cut -c 1-31)
|
||||
PROJECT_NAME_CUT := $(shell echo $(PROJECT_NAME) | cut -c 1-31)
|
||||
PROJECT_VER_CUT := $(shell echo "$(PROJECT_VER)" | cut -c 1-31)
|
||||
PROJECT_NAME_CUT := $(shell echo "$(PROJECT_NAME)" | cut -c 1-31)
|
||||
|
||||
$(info App "$(PROJECT_NAME_CUT)" version: $(PROJECT_VER_CUT))
|
||||
|
||||
NEW_DEFINES:= $(PROJECT_VER_CUT) $(PROJECT_NAME_CUT) $(IDF_VER)
|
||||
NEW_DEFINES:= "$(PROJECT_VER_CUT) $(PROJECT_NAME_CUT) $(IDF_VER)"
|
||||
ifeq ("$(wildcard ${TMP_DEFINES})","")
|
||||
OLD_DEFINES:=
|
||||
OLD_DEFINES:= ""
|
||||
else
|
||||
OLD_DEFINES:= $(shell cat $(TMP_DEFINES))
|
||||
OLD_DEFINES:= "$(shell cat $(TMP_DEFINES))"
|
||||
endif
|
||||
|
||||
# If NEW_DEFINES (PROJECT_VER, PROJECT_NAME) were changed then rebuild only esp_app_desc.
|
||||
ifneq ("${NEW_DEFINES}", "${OLD_DEFINES}")
|
||||
ifneq (${NEW_DEFINES}, ${OLD_DEFINES})
|
||||
$(shell echo $(NEW_DEFINES) > $(TMP_DEFINES); rm -f esp_app_desc.o;)
|
||||
endif
|
||||
|
||||
esp_app_desc.o: CPPFLAGS += -D PROJECT_VER=\"$(PROJECT_VER_CUT)\" -D PROJECT_NAME=\"$(PROJECT_NAME_CUT)\"
|
||||
esp_app_desc.o: CPPFLAGS += -D PROJECT_VER=\""$(PROJECT_VER_CUT)"\" -D PROJECT_NAME=\""$(PROJECT_NAME_CUT)"\"
|
||||
endif
|
||||
|
@ -251,8 +251,19 @@ function run_tests()
|
||||
make
|
||||
assert_rebuilt ${APP_BINS}
|
||||
assert_not_rebuilt ${BOOTLOADER_BINS} esp32/libesp32.a
|
||||
|
||||
print_status "Re-building does not change app.bin"
|
||||
take_build_snapshot
|
||||
make
|
||||
assert_not_rebuilt ${APP_BINS} ${BOOTLOADER_BINS} esp32/libesp32.a
|
||||
rm -f ${TESTDIR}/template/version.txt
|
||||
|
||||
print_status "Get the version of app from git describe. Project is not inside IDF and do not have a tag only a hash commit."
|
||||
make >> log.log || failure "Failed to build"
|
||||
version="App \"app-template\" version: "
|
||||
version+=$(git describe --always --tags --dirty)
|
||||
grep "${version}" log.log || failure "Project version should have a hash commit"
|
||||
|
||||
print_status "Build fails if partitions don't fit in flash"
|
||||
sed -i.bak "s/CONFIG_ESPTOOLPY_FLASHSIZE.\+//" sdkconfig # remove all flashsize config
|
||||
echo "CONFIG_ESPTOOLPY_FLASHSIZE_1MB=y" >> sdkconfig # introduce undersize flash
|
||||
|
@ -107,8 +107,19 @@ function run_tests()
|
||||
idf.py build || failure "Failed to rebuild with changed app version"
|
||||
assert_rebuilt ${APP_BINS}
|
||||
assert_not_rebuilt ${BOOTLOADER_BINS} esp-idf/esp32/libesp32.a
|
||||
|
||||
print_status "Re-building does not change app.bin"
|
||||
take_build_snapshot
|
||||
idf.py build
|
||||
assert_not_rebuilt ${APP_BINS} ${BOOTLOADER_BINS} esp-idf/esp32/libesp32.a
|
||||
rm -f ${TESTDIR}/template/version.txt
|
||||
|
||||
print_status "Get the version of app from git describe. Project is not inside IDF and do not have a tag only a hash commit."
|
||||
idf.py build >> log.log || failure "Failed to build"
|
||||
version="Project version: "
|
||||
version+=$(git describe --always --tags --dirty)
|
||||
grep "${version}" log.log || failure "Project version should have a hash commit"
|
||||
|
||||
print_status "Moving BUILD_DIR_BASE out of tree"
|
||||
clean_build_dir
|
||||
OUTOFTREE_BUILD=${TESTDIR}/alt_build
|
||||
|
@ -112,6 +112,7 @@ function(git_describe _var _repo_dir)
|
||||
"-C"
|
||||
${_repo_dir}
|
||||
describe
|
||||
"--always"
|
||||
${hash}
|
||||
${ARGN}
|
||||
WORKING_DIRECTORY
|
||||
|
Loading…
Reference in New Issue
Block a user