]> granicus.if.org Git - esp-idf/commitdiff
build: Fix problems with building kconfig and generating sdkconfig
authorAnton Maklakov <anton@espressif.com>
Tue, 27 Mar 2018 05:13:35 +0000 (13:13 +0800)
committerAnton Maklakov <anton@espressif.com>
Wed, 28 Mar 2018 02:39:20 +0000 (10:39 +0800)
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

.gitlab-ci.yml
make/project.mk
make/project_config.mk
tools/ci/build_examples.sh
tools/ci/configure_ci_environment.sh
tools/ci/get-full-sources.sh
tools/ci/mirror-submodule-update.sh
tools/ci/mirror-synchronize.sh
tools/unit-test-app/Makefile

index f98f2b9707919af007d9811c31374363d18ea9d9..c3e188bdc5b792dd7dfa37fe8118587c94b7cd44 100644 (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"
 
index 31f72bc5fad3ddf6d5dea9b051cf231563dbd04a..a5bc916bf80f81aed68b198ec5718fd56b9ee628 100644 (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))","")
index 0a212cd287c966322bd5d952b52a6b99f49614dc..8f0006c7950a81098575bcfcd8b6979ade04e0f1 100644 (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
index df6c908111ff205cf1dbe0ab225439f049145d23..f36ff60dfddb274ccb3d0c69922ca152b97bb4e9 100755 (executable)
@@ -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
index 77d094076afa7e0556ac47b1960624a195d7a062..a92600e92a7a31ccf7006a2c257f09db00bb4704 100644 (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
 
index 058cab534babc0f4b53aadf8c8a8b8fe4be5e6bd..ee2604a31abad3010900e8b1362dacba4b1615e8 100755 (executable)
@@ -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
 
index 04471f143e3a7a90e85a3fcaabb62fac5c274796..068838a77d8e6647d82401e7cd8429cad853702a 100755 (executable)
@@ -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
index 163e7db7f32aa1436b9ef95dea49014b5b8a4571..5047744e5a9844ab7f5b514392e75000381827c0 100755 (executable)
@@ -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
index 13873900e7367382bc4788268c726985f5f2a028..05f1dc3532ae733b2189ab8ca36404912a136832 100644 (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.