build: Fix problems with building kconfig and generating sdkconfig

We had some problems:
    simultaneous compiling of kconfig in the same tree;
    attempt to use menuconfig in some examples and ut in batch mode (w/o interactive console)

Also increase debug abilities in CI:
    force non-interactive building;
    add variable DEBUG_SHELL to toggle verbosity of scripts
This commit is contained in:
Anton Maklakov 2018-03-27 13:13:35 +08:00
parent 2935e958fc
commit f3d61015f7
9 changed files with 22 additions and 7 deletions

View File

@ -26,6 +26,8 @@ variables:
# IDF environment
IDF_PATH: "$CI_PROJECT_DIR"
BATCH_BUILD: "1"
V: "0"
APPLY_BOT_FILTER_SCRIPT: "$CI_PROJECT_DIR/tools/ci/apply_bot_filter.py"
CHECKOUT_REF_SCRIPT: "$CI_PROJECT_DIR/tools/ci/checkout_project_ref.py"

View File

@ -45,6 +45,9 @@ help:
@echo "See also 'make bootloader', 'make bootloader-flash', 'make bootloader-clean', "
@echo "'make partition_table', etc, etc."
# Non-interactive targets. Mostly, those for which you do not need to build a binary
NON_INTERACTIVE_TARGET += defconfig clean% %clean help list-components print_flash_cmd
# dependency checks
ifndef MAKE_RESTARTS
ifeq ("$(filter 4.% 3.81 3.82,$(MAKE_VERSION))","")

View File

@ -15,15 +15,19 @@ SDKCONFIG ?= $(PROJECT_PATH)/sdkconfig
# overrides (usually used for esp-idf examples)
SDKCONFIG_DEFAULTS ?= $(PROJECT_PATH)/sdkconfig.defaults
# Workaround to run make parallel (-j). mconf and conf cannot be made simultaneously
$(KCONFIG_TOOL_DIR)/mconf: $(KCONFIG_TOOL_DIR)/conf
# reset MAKEFLAGS as the menuconfig makefile uses implicit compile rules
$(KCONFIG_TOOL_DIR)/mconf $(KCONFIG_TOOL_DIR)/conf: $(wildcard $(KCONFIG_TOOL_DIR)/*.c)
MAKEFLAGS="" CC=$(HOSTCC) LD=$(HOSTLD) \
$(MAKE) -C $(KCONFIG_TOOL_DIR)
ifeq ("$(wildcard $(SDKCONFIG))","")
ifeq ("$(filter defconfig clean% %clean, $(MAKECMDGOALS))","")
# if no configuration file is present and defconfig or clean
# is not a named target, run defconfig then menuconfig to get the initial config
# if no configuration file is present we need a rule for it
ifeq ("$(filter $(NON_INTERACTIVE_TARGET), $(MAKECMDGOALS))","")
# if special non-interactive item is not a named target (eg. 'defconfig', 'clean')
# run defconfig then menuconfig to get the initial config
$(SDKCONFIG): menuconfig
menuconfig: defconfig
else

View File

@ -23,7 +23,7 @@
# -----------------------------------------------------------------------------
# Safety settings (see https://gist.github.com/ilg-ul/383869cbb01f61a51c4d).
if [[ ! -z ${DEBUG} ]]
if [[ ! -z ${DEBUG_SHELL} ]]
then
set -x # Activate the expand mode if DEBUG is anything but empty.
fi

View File

@ -5,6 +5,10 @@
# Sets the error behaviour options for shell throughout the CI environment
#
set -o errexit # Exit if command failed.
set -o pipefail # Exit if pipe failed.
# we can use the appropriate secret variable for debugging
[ ! -z $DEBUG_SHELL ] && set -x
[ -z $CI_COMMIT_REF_NAME ] && echo "This internal script should only be run by a Gitlab CI runner." && exit 1

View File

@ -12,7 +12,7 @@
# -----------------------------------------------------------------------------
# Common bash
if [[ ! -z ${DEBUG} ]]; then
if [[ ! -z ${DEBUG_SHELL} ]]; then
set -x # Activate the expand mode if DEBUG is anything but empty.
fi

View File

@ -8,7 +8,7 @@
# -----------------------------------------------------------------------------
# Common bash
if [[ ! -z ${DEBUG} ]]
if [[ ! -z ${DEBUG_SHELL} ]]
then
set -x # Activate the expand mode if DEBUG is anything but empty.
fi

View File

@ -7,7 +7,7 @@
# -----------------------------------------------------------------------------
# Common bash
if [[ ! -z ${DEBUG} ]]
if [[ ! -z ${DEBUG_SHELL} ]]
then
set -x # Activate the expand mode if DEBUG is anything but empty.
fi

View File

@ -5,6 +5,8 @@
PROJECT_NAME := unit-test-app
NON_INTERACTIVE_TARGET += ut-apply-config-% ut-clean-%
include $(IDF_PATH)/make/project.mk
# List of unit-test-app configurations.