|
1 |
| -#/bin/bash |
| 1 | +#!/bin/bash |
| 2 | +# |
| 3 | +# MIT License |
| 4 | +# |
| 5 | +# Copyright (c) 2020-2022 Erriez |
| 6 | +# |
| 7 | +# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | +# of this software and associated documentation files (the "Software"), to deal |
| 9 | +# in the Software without restriction, including without limitation the rights |
| 10 | +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | +# copies of the Software, and to permit persons to whom the Software is |
| 12 | +# furnished to do so, subject to the following conditions: |
| 13 | +# |
| 14 | +# The above copyright notice and this permission notice shall be included in all |
| 15 | +# copies or substantial portions of the Software. |
| 16 | +# |
| 17 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 23 | +# SOFTWARE. |
| 24 | +# |
| 25 | + |
| 26 | +# Automatic build script |
| 27 | +# |
| 28 | +# To run locally, execute: |
| 29 | +# sudo apt install doxygen graphviz texlive-latex-base texlive-latex-recommended texlive-pictures texlive-latex-extra |
2 | 30 |
|
3 | 31 | # Exit immediately if a command exits with a non-zero status.
|
4 | 32 | set -e
|
5 | 33 |
|
| 34 | +DOXYGEN_PDF="ErriezMHZ19B.pdf" |
| 35 | + |
| 36 | + |
6 | 37 | echo "Starting auto-build script..."
|
7 | 38 |
|
| 39 | +function setup_virtualenv() |
| 40 | +{ |
| 41 | + if [ ! -d ".venv" ]; then |
| 42 | + virtualenv .venv |
| 43 | + source .venv/bin/activate |
| 44 | + pip3 install platformio==6.1.4 |
| 45 | + deactivate |
| 46 | + fi |
| 47 | + |
| 48 | + source .venv/bin/activate |
| 49 | +} |
8 | 50 |
|
9 | 51 | function autobuild()
|
10 | 52 | {
|
11 | 53 | # Set environment variables
|
12 | 54 | BOARDS_AVR="--board uno --board micro --board pro16MHzatmega328 --board pro8MHzatmega328 --board megaatmega2560 --board leonardo"
|
13 | 55 | BOARDS_ARM="--board due"
|
14 |
| - BOARDS_ESP8266="--board d1_mini --board nodemcuv2" |
| 56 | + BOARDS_ESP8266="--board nodemcuv2" |
15 | 57 | BOARDS_ESP32="--board lolin_d32"
|
16 | 58 |
|
17 | 59 | echo "Installing library dependencies"
|
18 |
| - platformio lib --global install https://github.com/Erriez/ErriezTM1637 |
19 |
| - platformio lib --global install https://github.com/Erriez/ErriezRobotDyn4DigitDisplay |
20 |
| - platformio lib --global install https://github.com/knolleary/pubsubclient |
| 60 | + pio pkg install --global --library https://github.com/Erriez/ErriezTM1637 |
| 61 | + pio pkg install --global --library https://github.com/Erriez/ErriezRobotDyn4DigitDisplay |
| 62 | + pio pkg install --global --library https://github.com/knolleary/pubsubclient |
21 | 63 |
|
22 | 64 | echo "Install ESPSoftwareSerial into framework-arduinoespressif32 to prevent conflicts with generic name SoftwareSerial"
|
23 | 65 | mkdir -p ~/.platformio/packages/framework-arduinoespressif32/libraries
|
24 |
| - platformio lib --storage-dir ~/.platformio/packages/framework-arduinoespressif32/libraries install "ESPSoftwareSerial" |
| 66 | + platformio lib --storage-dir ~/.platformio/packages/framework-arduinoespressif32/libraries install "EspSoftwareSerial@6.16.1" |
| 67 | + # Cannot upgrade to pio pkg install command: https://github.com/platformio/platformio-core/issues/4410 |
| 68 | + #pio pkg install --storage-dir ~/.platformio/packages/framework-arduinoespressif32/libraries --library "EspSoftwareSerial@6.16.1" |
| 69 | + |
| 70 | + echo "Building examples..." |
25 | 71 |
|
26 |
| - echo "Build examples" |
27 |
| - platformio ci --lib="." ${BOARDS_AVR} ${BOARDS_ARM} ${BOARDS_ESP8266} ${BOARDS_ESP32} examples/ErriezMHZ19B7SegmentDisplay/ErriezMHZ19B7SegmentDisplay.ino |
28 |
| - platformio ci --lib="." ${BOARDS_AVR} ${BOARDS_ARM} ${BOARDS_ESP8266} ${BOARDS_ESP32} examples/ErriezMHZ19BGettingStarted/ErriezMHZ19BGettingStarted.ino |
29 |
| - platformio ci --lib="." ${BOARDS_AVR} ${BOARDS_ARM} ${BOARDS_ESP8266} ${BOARDS_ESP32} examples/ErriezMHZ19BSerialPlottter/ErriezMHZ19BSerialPlottter.ino |
30 |
| - platformio ci --lib="." ${BOARDS_ESP8266} examples/ErriezMHZ19BESP8266MQTT/ErriezMHZ19BESP8266MQTT.ino |
| 72 | + # Use option -O "lib_ldf_mode=chain+" to parse defines |
| 73 | + pio ci -O "lib_ldf_mode=chain+" --lib="." ${BOARDS_AVR} ${BOARDS_ARM} ${BOARDS_ESP8266} ${BOARDS_ESP32} examples/ErriezMHZ19B7SegmentDisplay/ErriezMHZ19B7SegmentDisplay.ino |
| 74 | + pio ci -O "lib_ldf_mode=chain+" --lib="." ${BOARDS_AVR} ${BOARDS_ARM} ${BOARDS_ESP8266} ${BOARDS_ESP32} examples/ErriezMHZ19BGettingStarted/ErriezMHZ19BGettingStarted.ino |
| 75 | + pio ci -O "lib_ldf_mode=chain+" --lib="." ${BOARDS_AVR} ${BOARDS_ARM} ${BOARDS_ESP8266} ${BOARDS_ESP32} examples/ErriezMHZ19BSerialPlottter/ErriezMHZ19BSerialPlottter.ino |
| 76 | + pio ci -O "lib_ldf_mode=chain+" --lib="." ${BOARDS_ESP8266} examples/ErriezMHZ19BESP8266MQTT/ErriezMHZ19BESP8266MQTT.ino |
31 | 77 | }
|
32 | 78 |
|
33 | 79 | function generate_doxygen()
|
34 | 80 | {
|
35 |
| - echo "Generate Doxygen HTML..." |
36 |
| - |
37 |
| - DOXYGEN_PDF="ErriezMHZ19B.pdf" |
| 81 | + if [ ! -f Doxyfile ]; then |
| 82 | + return |
| 83 | + fi |
38 | 84 |
|
39 |
| - # Cleanup |
40 |
| - rm -rf html latex |
| 85 | + echo "Generate Doxygen HTML..." |
41 | 86 |
|
42 | 87 | # Generate Doxygen HTML and Latex
|
43 | 88 | doxygen Doxyfile
|
44 | 89 |
|
45 |
| - # Allow filenames starting with an underscore |
46 |
| - echo "" > html/.nojekyll |
| 90 | + # Allow filenames starting with an underscore |
| 91 | + echo "" > docs/html/.nojekyll |
47 | 92 |
|
48 |
| - # Generate PDF when script is not running on Travis-CI |
49 |
| - if [[ -z ${TRAVIS_BUILD_DIR} ]]; then |
50 |
| - # Generate Doxygen PDF |
51 |
| - make -C latex |
| 93 | + # Generate Doxygen PDF |
| 94 | + make -C docs/latex |
52 | 95 |
|
53 |
| - # Copy PDF to root directory |
54 |
| - cp latex/refman.pdf ./${DOXYGEN_PDF} |
55 |
| - fi |
| 96 | + # Copy PDF to root directory |
| 97 | + cp docs/latex/refman.pdf ./${DOXYGEN_PDF} |
| 98 | + |
| 99 | + # Cleanup |
| 100 | + #rm -rf docs |
56 | 101 | }
|
57 | 102 |
|
| 103 | +setup_virtualenv |
58 | 104 | autobuild
|
59 | 105 | generate_doxygen
|
0 commit comments