Browse Source

Merge branch 'dev' of github.com:xoseperez/espurna into dev

ech1560
Xose Pérez 6 years ago
parent
commit
be7f535d14
3 changed files with 22 additions and 11 deletions
  1. +20
    -9
      code/build.sh
  2. +1
    -1
      code/espurna/led.ino
  3. +1
    -1
      code/platformio.ini

+ 20
- 9
code/build.sh View File

@ -1,19 +1,26 @@
#!/bin/bash #!/bin/bash
set -e set -e
# Utility
is_git() {
command -v git >/dev/null 2>&1 || return 1
command git rev-parse >/dev/null 2>&1 || return 1
return 0
}
# Script settings # Script settings
version=$(grep APP_VERSION espurna/config/version.h | awk '{print $3}' | sed 's/"//g') version=$(grep APP_VERSION espurna/config/version.h | awk '{print $3}' | sed 's/"//g')
(command -v git && git rev-parse --is-inside-work-tree) 2>&1>/dev/null
if [ $? -eq 0 ]; then
if is_git; then
git_revision=$(git rev-parse --short HEAD) git_revision=$(git rev-parse --short HEAD)
git_version=$(git describe --tags)
git_version=${version}-${git_revision}
else else
git_revision= git_revision=
git_version=$version git_version=$version
fi fi
par_build=0
par_build=false
par_thread=${BUILDER_THREAD:-0} par_thread=${BUILDER_THREAD:-0}
par_total_threads=${BUILDER_TOTAL_THREADS:-4} par_total_threads=${BUILDER_TOTAL_THREADS:-4}
if [ ${par_thread} -ne ${par_thread} -o \ if [ ${par_thread} -ne ${par_thread} -o \
@ -27,8 +34,12 @@ if [ ${par_thread} -ge ${par_total_threads} ]; then
fi fi
# Available environments # Available environments
travis=$(grep env: platformio.ini | grep travis | sed 's/\[env://' | sed 's/\]/ /' | sort)
available=$(grep env: platformio.ini | grep -v ota | grep -v ssl | grep -v travis | sed 's/\[env://' | sed 's/\]/ /' | sort)
list_envs() {
grep env: platformio.ini | sed 's/\[env:\(.*\)\]/\1/g'
}
travis=$(list_envs | grep travis | sort)
available=$(list_envs | grep -Ev -- '-ota$|-ssl$|^travis' | sort)
# Build tools settings # Build tools settings
export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DAPP_REVISION='\"$git_revision\"'" export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DAPP_REVISION='\"$git_revision\"'"
@ -52,7 +63,7 @@ print_environments() {
set_default_environments() { set_default_environments() {
# Hook to build in parallel when using travis # Hook to build in parallel when using travis
if [[ "${TRAVIS_BUILD_STAGE_NAME}" = "Release" ]] && [ ${par_build} ]; then
if [[ "${TRAVIS_BUILD_STAGE_NAME}" = "Release" ]] && ${par_build}; then
environments=$(echo ${available} | \ environments=$(echo ${available} | \
awk -v par_thread=${par_thread} -v par_total_threads=${par_total_threads} \ awk -v par_thread=${par_thread} -v par_total_threads=${par_total_threads} \
'{ for (i = 1; i <= NF; i++) if (++j % par_total_threads == par_thread ) print $i; }') '{ for (i = 1; i <= NF; i++) if (++j % par_total_threads == par_thread ) print $i; }')
@ -106,7 +117,7 @@ while getopts "lp" opt; do
exit exit
;; ;;
p) p)
par_build=1
par_build=true
;; ;;
esac esac
done done
@ -125,7 +136,7 @@ if [ $# -eq 0 ]; then
set_default_environments set_default_environments
fi fi
if [[ "${CI}" = true ]]; then
if ${CI:-false}; then
print_environments print_environments
fi fi


+ 1
- 1
code/espurna/led.ino View File

@ -293,4 +293,4 @@ void ledLoop() {
} }
#endif LED_SUPPORT
#endif // LED_SUPPORT

+ 1
- 1
code/platformio.ini View File

@ -545,7 +545,7 @@ lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m0m} -DITEAD_SONOFF_DUAL_R2 build_flags = ${common.build_flags_1m0m} -DITEAD_SONOFF_DUAL_R2
extra_scripts = ${common.extra_scripts} extra_scripts = ${common.extra_scripts}
[env:itead-sonoff-dual-ota-r2]
[env:itead-sonoff-dual-r2-ota]
platform = ${common.platform} platform = ${common.platform}
framework = ${common.framework} framework = ${common.framework}
board = ${common.board_1m} board = ${common.board_1m}


Loading…
Cancel
Save