Skip to content

Commit 7a57439

Browse files
authoredAug 27, 2019
Rework the sketch builder to match the IDE (#3146)
* Rework the sketch builder to match the IDE * Link the board to the home folder * Rename files for clarity * move ci files to own subfolder * Update Github CI to use the new script locations
1 parent fd089d8 commit 7a57439

12 files changed

+108
-118
lines changed
 

‎.github/workflows/main.yml

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ jobs:
1818
- name: Pull submodules
1919
run: git submodule update --init --recursive
2020
- name: Run CMake Check
21-
run: ./tools/check_cmakelists.sh
21+
run: ./tools/ci/check-cmakelists.sh
2222

2323
- name: Install Arduino IDE
2424
env:
2525
#ESP32_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2626
TRAVIS_BUILD_DIR: ${{ github.workspace }}
27-
run: ./tools/prep-arduino-ide.sh
27+
run: ./tools/ci/prep-arduino-ide.sh
2828
- name: Test Arduino IDE
2929
env:
3030
TRAVIS_BUILD_DIR: ${{ github.workspace }}
31-
run: ./tools/test-arduino-ide.sh 0 18
31+
run: ./tools/ci/test-arduino-ide.sh 0 18
3232
- name: Sketch Sizes
3333
run: cat size.log
3434

@@ -43,11 +43,11 @@ jobs:
4343
- name: Install Arduino IDE
4444
env:
4545
TRAVIS_BUILD_DIR: ${{ github.workspace }}
46-
run: ./tools/prep-arduino-ide.sh
46+
run: ./tools/ci/prep-arduino-ide.sh
4747
- name: Test Arduino IDE
4848
env:
4949
TRAVIS_BUILD_DIR: ${{ github.workspace }}
50-
run: ./tools/test-arduino-ide.sh 1 18
50+
run: ./tools/ci/test-arduino-ide.sh 1 18
5151
- name: Sketch Sizes
5252
run: cat size.log
5353

@@ -62,11 +62,11 @@ jobs:
6262
- name: Install Arduino IDE
6363
env:
6464
TRAVIS_BUILD_DIR: ${{ github.workspace }}
65-
run: ./tools/prep-arduino-ide.sh
65+
run: ./tools/ci/prep-arduino-ide.sh
6666
- name: Test Arduino IDE
6767
env:
6868
TRAVIS_BUILD_DIR: ${{ github.workspace }}
69-
run: ./tools/test-arduino-ide.sh 2 18
69+
run: ./tools/ci/test-arduino-ide.sh 2 18
7070
- name: Sketch Sizes
7171
run: cat size.log
7272

@@ -81,11 +81,11 @@ jobs:
8181
- name: Install Arduino IDE
8282
env:
8383
TRAVIS_BUILD_DIR: ${{ github.workspace }}
84-
run: ./tools/prep-arduino-ide.sh
84+
run: ./tools/ci/prep-arduino-ide.sh
8585
- name: Test Arduino IDE
8686
env:
8787
TRAVIS_BUILD_DIR: ${{ github.workspace }}
88-
run: ./tools/test-arduino-ide.sh 3 18
88+
run: ./tools/ci/test-arduino-ide.sh 3 18
8989
- name: Sketch Sizes
9090
run: cat size.log
9191

@@ -100,11 +100,11 @@ jobs:
100100
- name: Install Arduino IDE
101101
env:
102102
TRAVIS_BUILD_DIR: ${{ github.workspace }}
103-
run: ./tools/prep-arduino-ide.sh
103+
run: ./tools/ci/prep-arduino-ide.sh
104104
- name: Test Arduino IDE
105105
env:
106106
TRAVIS_BUILD_DIR: ${{ github.workspace }}
107-
run: ./tools/test-arduino-ide.sh 4 18
107+
run: ./tools/ci/test-arduino-ide.sh 4 18
108108
- name: Sketch Sizes
109109
run: cat size.log
110110

@@ -119,11 +119,11 @@ jobs:
119119
- name: Install Arduino IDE
120120
env:
121121
TRAVIS_BUILD_DIR: ${{ github.workspace }}
122-
run: ./tools/prep-arduino-ide.sh
122+
run: ./tools/ci/prep-arduino-ide.sh
123123
- name: Test Arduino IDE
124124
env:
125125
TRAVIS_BUILD_DIR: ${{ github.workspace }}
126-
run: ./tools/test-arduino-ide.sh 5 18
126+
run: ./tools/ci/test-arduino-ide.sh 5 18
127127
- name: Sketch Sizes
128128
run: cat size.log
129129

@@ -138,11 +138,11 @@ jobs:
138138
- name: Install Arduino IDE
139139
env:
140140
TRAVIS_BUILD_DIR: ${{ github.workspace }}
141-
run: ./tools/prep-arduino-ide.sh
141+
run: ./tools/ci/prep-arduino-ide.sh
142142
- name: Test Arduino IDE
143143
env:
144144
TRAVIS_BUILD_DIR: ${{ github.workspace }}
145-
run: ./tools/test-arduino-ide.sh 6 18
145+
run: ./tools/ci/test-arduino-ide.sh 6 18
146146
- name: Sketch Sizes
147147
run: cat size.log
148148

@@ -157,11 +157,11 @@ jobs:
157157
- name: Install Arduino IDE
158158
env:
159159
TRAVIS_BUILD_DIR: ${{ github.workspace }}
160-
run: ./tools/prep-arduino-ide.sh
160+
run: ./tools/ci/prep-arduino-ide.sh
161161
- name: Test Arduino IDE
162162
env:
163163
TRAVIS_BUILD_DIR: ${{ github.workspace }}
164-
run: ./tools/test-arduino-ide.sh 7 18
164+
run: ./tools/ci/test-arduino-ide.sh 7 18
165165
- name: Sketch Sizes
166166
run: cat size.log
167167

@@ -176,11 +176,11 @@ jobs:
176176
- name: Install Arduino IDE
177177
env:
178178
TRAVIS_BUILD_DIR: ${{ github.workspace }}
179-
run: ./tools/prep-arduino-ide.sh
179+
run: ./tools/ci/prep-arduino-ide.sh
180180
- name: Test Arduino IDE
181181
env:
182182
TRAVIS_BUILD_DIR: ${{ github.workspace }}
183-
run: ./tools/test-arduino-ide.sh 8 18
183+
run: ./tools/ci/test-arduino-ide.sh 8 18
184184
- name: Sketch Sizes
185185
run: cat size.log
186186

@@ -195,11 +195,11 @@ jobs:
195195
- name: Install Arduino IDE
196196
env:
197197
TRAVIS_BUILD_DIR: ${{ github.workspace }}
198-
run: ./tools/prep-arduino-ide.sh
198+
run: ./tools/ci/prep-arduino-ide.sh
199199
- name: Test Arduino IDE
200200
env:
201201
TRAVIS_BUILD_DIR: ${{ github.workspace }}
202-
run: ./tools/test-arduino-ide.sh 9 18
202+
run: ./tools/ci/test-arduino-ide.sh 9 18
203203
- name: Sketch Sizes
204204
run: cat size.log
205205

@@ -214,11 +214,11 @@ jobs:
214214
- name: Install Arduino IDE
215215
env:
216216
TRAVIS_BUILD_DIR: ${{ github.workspace }}
217-
run: ./tools/prep-arduino-ide.sh
217+
run: ./tools/ci/prep-arduino-ide.sh
218218
- name: Test Arduino IDE
219219
env:
220220
TRAVIS_BUILD_DIR: ${{ github.workspace }}
221-
run: ./tools/test-arduino-ide.sh 10 18
221+
run: ./tools/ci/test-arduino-ide.sh 10 18
222222
- name: Sketch Sizes
223223
run: cat size.log
224224

@@ -233,11 +233,11 @@ jobs:
233233
- name: Install Arduino IDE
234234
env:
235235
TRAVIS_BUILD_DIR: ${{ github.workspace }}
236-
run: ./tools/prep-arduino-ide.sh
236+
run: ./tools/ci/prep-arduino-ide.sh
237237
- name: Test Arduino IDE
238238
env:
239239
TRAVIS_BUILD_DIR: ${{ github.workspace }}
240-
run: ./tools/test-arduino-ide.sh 11 18
240+
run: ./tools/ci/test-arduino-ide.sh 11 18
241241
- name: Sketch Sizes
242242
run: cat size.log
243243

@@ -252,11 +252,11 @@ jobs:
252252
- name: Install Arduino IDE
253253
env:
254254
TRAVIS_BUILD_DIR: ${{ github.workspace }}
255-
run: ./tools/prep-arduino-ide.sh
255+
run: ./tools/ci/prep-arduino-ide.sh
256256
- name: Test Arduino IDE
257257
env:
258258
TRAVIS_BUILD_DIR: ${{ github.workspace }}
259-
run: ./tools/test-arduino-ide.sh 12 18
259+
run: ./tools/ci/test-arduino-ide.sh 12 18
260260
- name: Sketch Sizes
261261
run: cat size.log
262262

@@ -271,11 +271,11 @@ jobs:
271271
- name: Install Arduino IDE
272272
env:
273273
TRAVIS_BUILD_DIR: ${{ github.workspace }}
274-
run: ./tools/prep-arduino-ide.sh
274+
run: ./tools/ci/prep-arduino-ide.sh
275275
- name: Test Arduino IDE
276276
env:
277277
TRAVIS_BUILD_DIR: ${{ github.workspace }}
278-
run: ./tools/test-arduino-ide.sh 13 18
278+
run: ./tools/ci/test-arduino-ide.sh 13 18
279279
- name: Sketch Sizes
280280
run: cat size.log
281281

@@ -290,11 +290,11 @@ jobs:
290290
- name: Install Arduino IDE
291291
env:
292292
TRAVIS_BUILD_DIR: ${{ github.workspace }}
293-
run: ./tools/prep-arduino-ide.sh
293+
run: ./tools/ci/prep-arduino-ide.sh
294294
- name: Test Arduino IDE
295295
env:
296296
TRAVIS_BUILD_DIR: ${{ github.workspace }}
297-
run: ./tools/test-arduino-ide.sh 14 18
297+
run: ./tools/ci/test-arduino-ide.sh 14 18
298298
- name: Sketch Sizes
299299
run: cat size.log
300300

@@ -309,11 +309,11 @@ jobs:
309309
- name: Install Arduino IDE
310310
env:
311311
TRAVIS_BUILD_DIR: ${{ github.workspace }}
312-
run: ./tools/prep-arduino-ide.sh
312+
run: ./tools/ci/prep-arduino-ide.sh
313313
- name: Test Arduino IDE
314314
env:
315315
TRAVIS_BUILD_DIR: ${{ github.workspace }}
316-
run: ./tools/test-arduino-ide.sh 15 18
316+
run: ./tools/ci/test-arduino-ide.sh 15 18
317317
- name: Sketch Sizes
318318
run: cat size.log
319319

@@ -328,11 +328,11 @@ jobs:
328328
- name: Install Arduino IDE
329329
env:
330330
TRAVIS_BUILD_DIR: ${{ github.workspace }}
331-
run: ./tools/prep-arduino-ide.sh
331+
run: ./tools/ci/prep-arduino-ide.sh
332332
- name: Test Arduino IDE
333333
env:
334334
TRAVIS_BUILD_DIR: ${{ github.workspace }}
335-
run: ./tools/test-arduino-ide.sh 16 18
335+
run: ./tools/ci/test-arduino-ide.sh 16 18
336336
- name: Sketch Sizes
337337
run: cat size.log
338338

@@ -347,11 +347,11 @@ jobs:
347347
- name: Install Arduino IDE
348348
env:
349349
TRAVIS_BUILD_DIR: ${{ github.workspace }}
350-
run: ./tools/prep-arduino-ide.sh
350+
run: ./tools/ci/prep-arduino-ide.sh
351351
- name: Test Arduino IDE
352352
env:
353353
TRAVIS_BUILD_DIR: ${{ github.workspace }}
354-
run: ./tools/test-arduino-ide.sh 17 18
354+
run: ./tools/ci/test-arduino-ide.sh 17 18
355355
- name: Sketch Sizes
356356
run: cat size.log
357357

@@ -371,6 +371,6 @@ jobs:
371371
- name: Install PlatformIO
372372
env:
373373
TRAVIS_BUILD_DIR: ${{ github.workspace }}
374-
run: ./tools/prep-platformio.sh
374+
run: ./tools/ci/prep-platformio.sh
375375
- name: Test PlatformIO
376-
run: ./tools/test-platformio.sh
376+
run: ./tools/ci/test-platformio.sh

‎.travis.yml

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ os:
1010
git:
1111
depth: false
1212

13-
# new script start
1413
before_install:
1514
- git submodule update --init --recursive
1615

@@ -24,60 +23,43 @@ jobs:
2423
- name: "Build Arduino 0"
2524
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
2625
stage: build
27-
script: $TRAVIS_BUILD_DIR/tools/build-tests.sh 0 4
26+
script: $TRAVIS_BUILD_DIR/tools/ci/build-tests.sh 0 4
2827

2928
- name: "Build Arduino 1"
3029
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
3130
stage: build
32-
script: $TRAVIS_BUILD_DIR/tools/build-tests.sh 1 4
31+
script: $TRAVIS_BUILD_DIR/tools/ci/build-tests.sh 1 4
3332

3433
- name: "Build Arduino 2"
3534
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
3635
stage: build
37-
script: $TRAVIS_BUILD_DIR/tools/build-tests.sh 2 4
36+
script: $TRAVIS_BUILD_DIR/tools/ci/build-tests.sh 2 4
3837

3938
- name: "Build Arduino 3"
4039
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
4140
stage: build
42-
script: $TRAVIS_BUILD_DIR/tools/build-tests.sh 3 4
41+
script: $TRAVIS_BUILD_DIR/tools/ci/build-tests.sh 3 4
4342

4443
- name: "Build PlatformIO"
4544
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
4645
stage: build
47-
script: $TRAVIS_BUILD_DIR/tools/build-tests.sh 4 4
46+
script: $TRAVIS_BUILD_DIR/tools/ci/build-tests.sh 4 4
4847

4948
- name: "Package & Deploy"
5049
if: tag IS present
5150
stage: deploy
5251
env:
5352
- secure: "l/4Dt+KQ/mACtGAHDUsPr66fUte840PZoQ4xpPikqWZI0uARu4l+Ym7+sHinnT6fBqrj8AJeBYGz4nFa8NK4LutZn9mSD40w+sxl0wSV4oHV8rzKe3Cd8+sMG3+o33yWoikMNjSvqa73Q0rm+SgrlInNdZbuAyixL+a2alaWSnGPm4F2xwUGj+S33TOy5P/Xp77CYtCV5S8vzyk/eEdNhoF0GYePJVdfuzCOUjXMyT5OWxORkzzQ7Hnn/Ka/RDfV8Si4HgujLQBrK5q6iPnNBFqBSqilYBepSMn4opnOBpIm0SCgePz7XQEFC83buA7GUcnCnfg38bf+dCwHaODf1d1PmqVRYt2QmfinexXtM4afAtL0iBUDtvrfnXHzwW9w82VeZhpbJSVh9DUQvB0IlsZeCz9J9PUBAi3N+SMX+9l+BomYwRUlPuKY+Ef2JKk9q6mxtUkky5R0daAlVxEhpVdQks1rT+T+NMoDMemxQ3SKEiqAHh6EgHecruszffmZ71uLX9MpERpew0qN+UFiafws+jkTjx+3yF9yut0Hf9sMbeAYzzkGzRqJTUEBJ6B29Cql8M0yRXCNN/8wuuTHhG8esstozga4ZQoIVrq7mEAgup376PTcNfr1+imbbWVQ7lJdYIuDe6OS5V3OX6np11vgK/DbhfyzvQv9Z1zAGnM="
5453
- REMOTE_URL=https://github.com/$TRAVIS_REPO_SLUG/releases/download/$TRAVIS_TAG
55-
script: bash $TRAVIS_BUILD_DIR/tools/build-release.sh -a$ESP32_GITHUB_TOKEN
54+
script: bash $TRAVIS_BUILD_DIR/tools/ci/build-release.sh -a$ESP32_GITHUB_TOKEN
5655
before_deploy: git submodule update --init
5756
deploy:
5857
- provider: script
5958
skip_cleanup: true
60-
script: bash $TRAVIS_BUILD_DIR/tools/deploy.sh -t$TRAVIS_TAG -a$ESP32_GITHUB_TOKEN -s$TRAVIS_REPO_SLUG -drelease
59+
script: bash $TRAVIS_BUILD_DIR/tools/ci/deploy-release.sh -t$TRAVIS_TAG -a$ESP32_GITHUB_TOKEN -s$TRAVIS_REPO_SLUG -drelease
6160
on:
6261
tags: true
6362

64-
# old script start
65-
# env:
66-
# global:
67-
# - secure: "l/4Dt+KQ/mACtGAHDUsPr66fUte840PZoQ4xpPikqWZI0uARu4l+Ym7+sHinnT6fBqrj8AJeBYGz4nFa8NK4LutZn9mSD40w+sxl0wSV4oHV8rzKe3Cd8+sMG3+o33yWoikMNjSvqa73Q0rm+SgrlInNdZbuAyixL+a2alaWSnGPm4F2xwUGj+S33TOy5P/Xp77CYtCV5S8vzyk/eEdNhoF0GYePJVdfuzCOUjXMyT5OWxORkzzQ7Hnn/Ka/RDfV8Si4HgujLQBrK5q6iPnNBFqBSqilYBepSMn4opnOBpIm0SCgePz7XQEFC83buA7GUcnCnfg38bf+dCwHaODf1d1PmqVRYt2QmfinexXtM4afAtL0iBUDtvrfnXHzwW9w82VeZhpbJSVh9DUQvB0IlsZeCz9J9PUBAi3N+SMX+9l+BomYwRUlPuKY+Ef2JKk9q6mxtUkky5R0daAlVxEhpVdQks1rT+T+NMoDMemxQ3SKEiqAHh6EgHecruszffmZ71uLX9MpERpew0qN+UFiafws+jkTjx+3yF9yut0Hf9sMbeAYzzkGzRqJTUEBJ6B29Cql8M0yRXCNN/8wuuTHhG8esstozga4ZQoIVrq7mEAgup376PTcNfr1+imbbWVQ7lJdYIuDe6OS5V3OX6np11vgK/DbhfyzvQv9Z1zAGnM="
68-
# - REMOTE_URL=https://github.com/$TRAVIS_REPO_SLUG/releases/download/$TRAVIS_TAG
69-
70-
# script:
71-
# - bash $TRAVIS_BUILD_DIR/tools/build.sh
72-
73-
# deploy:
74-
# provider: script
75-
# skip_cleanup: true
76-
# script: bash $TRAVIS_BUILD_DIR/tools/deploy.sh -t$TRAVIS_TAG -a$ESP32_GITHUB_TOKEN -s$TRAVIS_REPO_SLUG -drelease
77-
78-
# on:
79-
# tags: true
80-
8163
notifications:
8264
email:
8365
on_success: change

‎tools/build.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.
File renamed without changes.

‎tools/build.py renamed to ‎tools/ci/build-sketch.py

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,30 @@
2929
import tempfile
3030
import shutil
3131

32-
def compile(tmp_dir, sketch, tools_dir, hardware_dir, ide_path, f, args):
32+
def compile(tmp_dir, cache_dir, sketch, ide_path, f, args):
3333
cmd = ide_path + '/arduino-builder '
3434
cmd += '-compile -logger=human '
35-
cmd += '-build-path "' + tmp_dir + '" '
35+
cmd += '-hardware "' + ide_path + '/hardware" '
36+
if args.usr_path:
37+
cmd += '-hardware "' + args.usr_path + '/hardware" '
38+
if args.hardware_path:
39+
for hw_dir in args.hardware_path:
40+
cmd += '-hardware "' + hw_dir + '" '
3641
cmd += '-tools "' + ide_path + '/tools-builder" '
42+
if args.tools_path:
43+
for tools_dir in args.tools_path:
44+
cmd += '-tools "' + tools_dir + '" '
45+
cmd += '-built-in-libraries "' + ide_path + '/libraries" '
46+
if args.usr_path:
47+
cmd += '-libraries "' + args.usr_path + '/libraries" '
3748
if args.library_path:
3849
for lib_dir in args.library_path:
3950
cmd += '-libraries "' + lib_dir + '" '
40-
cmd += '-hardware "' + ide_path + '/hardware" '
41-
if args.hardware_dir:
42-
for hw_dir in args.hardware_dir:
43-
cmd += '-hardware "' + hw_dir + '" '
44-
else:
45-
cmd += '-hardware "' + hardware_dir + '" '
46-
# Debug=Serial,DebugLevel=Core____
47-
cmd += '-fqbn=espressif:esp32:{board_name}:' \
48-
'FlashFreq={flash_freq},' \
49-
'PartitionScheme=huge_app,' \
50-
'UploadSpeed=921600'.format(**vars(args))
51-
cmd += ' '
52-
cmd += '-ide-version=10607 '
51+
cmd += '-fqbn={fqbn} '.format(**vars(args))
52+
cmd += '-ide-version=10810 '
53+
cmd += '-build-path "' + tmp_dir + '" '
5354
cmd += '-warnings={warnings} '.format(**vars(args))
55+
cmd += '-build-cache "' + cache_dir + '" '
5456
if args.verbose:
5557
cmd += '-verbose '
5658
cmd += sketch
@@ -65,22 +67,18 @@ def compile(tmp_dir, sketch, tools_dir, hardware_dir, ide_path, f, args):
6567

6668
def parse_args():
6769
parser = argparse.ArgumentParser(description='Sketch build helper')
68-
parser.add_argument('-v', '--verbose', help='Enable verbose output',
69-
action='store_true')
70+
parser.add_argument('-v', '--verbose', help='Enable verbose output', action='store_true')
7071
parser.add_argument('-i', '--ide_path', help='Arduino IDE path')
71-
parser.add_argument('-p', '--build_path', help='Build directory')
72-
parser.add_argument('-l', '--library_path', help='Additional library path',
73-
action='append')
74-
parser.add_argument('-d', '--hardware_dir', help='Additional hardware path',
75-
action='append')
76-
parser.add_argument('-b', '--board_name', help='Board name', default='esp32')
77-
parser.add_argument('-w', '--warnings', help='Compilation warnings level',
78-
default='none', choices=['none', 'all', 'more'])
72+
parser.add_argument('-b', '--build_path', help='Build directory')
73+
parser.add_argument('-c', '--build_cache', help='Core Cache directory')
74+
parser.add_argument('-u', '--usr_path', help='Arduino Home directory (holds your sketches, libraries and hardware)')
75+
parser.add_argument('-f', '--fqbn', help='Arduino Board FQBN')
76+
parser.add_argument('-l', '--library_path', help='Additional library path', action='append')
77+
parser.add_argument('-d', '--hardware_path', help='Additional hardware path', action='append')
78+
parser.add_argument('-t', '--tools_path', help='Additional tools path', action='append')
79+
parser.add_argument('-w', '--warnings', help='Compilation warnings level', default='none', choices=['none', 'all', 'more', 'default'])
7980
parser.add_argument('-o', '--output_binary', help='File name for output binary')
80-
parser.add_argument('-k', '--keep', action='store_true',
81-
help='Don\'t delete temporary build directory')
82-
parser.add_argument('--flash_freq', help='Flash frequency', default=40,
83-
type=int, choices=[40, 80])
81+
parser.add_argument('-k', '--keep', action='store_true', help='Don\'t delete temporary build directory')
8482
parser.add_argument('sketch_path', help='Sketch file path')
8583
return parser.parse_args()
8684

@@ -95,29 +93,38 @@ def main():
9593
"or ARDUINO_IDE_PATH environment variable.", file=sys.stderr)
9694
return 2
9795

96+
if not args.fqbn:
97+
print("Please specify Arduino Board FQBN using the --fqbn option", file=sys.stderr)
98+
return 3
99+
98100
sketch_path = args.sketch_path
101+
99102
tmp_dir = args.build_path
100103
created_tmp_dir = False
101104
if not tmp_dir:
102105
tmp_dir = tempfile.mkdtemp()
103106
created_tmp_dir = True
104107

105-
tools_dir = os.path.dirname(os.path.realpath(__file__)) + '/../tools'
106-
# this is not the correct hardware folder to add.
107-
hardware_dir = os.path.dirname(os.path.realpath(__file__)) + '/../cores'
108-
108+
cache_dir = args.build_cache
109+
created_cache_dir = False
110+
if not cache_dir:
111+
cache_dir = tempfile.mkdtemp()
112+
created_cache_dir = True
113+
109114
output_name = tmp_dir + '/' + os.path.basename(sketch_path) + '.bin'
115+
110116
if args.verbose:
111117
print("Sketch: ", sketch_path)
112118
print("Build dir: ", tmp_dir)
119+
print("Cache dir: ", cache_dir)
113120
print("Output: ", output_name)
114121

115122
if args.verbose:
116123
f = sys.stdout
117124
else:
118125
f = open(tmp_dir + '/build.log', 'w')
119126

120-
res = compile(tmp_dir, sketch_path, tools_dir, hardware_dir, ide_path, f, args)
127+
res = compile(tmp_dir, cache_dir, sketch_path, ide_path, f, args)
121128
if res != 0:
122129
return res
123130

@@ -127,5 +134,8 @@ def main():
127134
if created_tmp_dir and not args.keep:
128135
shutil.rmtree(tmp_dir, ignore_errors=True)
129136

137+
if created_cache_dir and not args.keep:
138+
shutil.rmtree(cache_dir, ignore_errors=True)
139+
130140
if __name__ == '__main__':
131141
sys.exit(main())

‎tools/build-tests.sh renamed to ‎tools/ci/build-tests.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@ fi
2929
# CMake Test
3030
if [ "$CHUNK_INDEX" -eq 0 ]; then
3131
echo -e "travis_fold:start:check_cmakelists"
32-
tools/check_cmakelists.sh
32+
tools/ci/check-cmakelists.sh
3333
if [ $? -ne 0 ]; then exit 1; fi
3434
echo -e "travis_fold:end:check_cmakelists"
3535
fi
3636

3737
if [ "$BUILD_PIO" -eq 0 ]; then
3838
# ArduinoIDE Test
3939
echo -e "travis_fold:start:prep_arduino_ide"
40-
tools/prep-arduino-ide.sh
40+
tools/ci/prep-arduino-ide.sh
4141
if [ $? -ne 0 ]; then exit 1; fi
4242
echo -e "travis_fold:end:prep_arduino_ide"
4343

4444
echo -e "travis_fold:start:test_arduino_ide"
45-
tools/test-arduino-ide.sh $CHUNK_INDEX $CHUNKS_CNT
45+
tools/ci/test-arduino-ide.sh $CHUNK_INDEX $CHUNKS_CNT
4646
if [ $? -ne 0 ]; then exit 1; fi
4747
echo -e "travis_fold:end:test_arduino_ide"
4848

@@ -53,12 +53,12 @@ else
5353
# PlatformIO Test
5454
echo -e "travis_fold:start:prep_platformio"
5555
cd tools && python get.py && cd ..
56-
tools/prep-platformio.sh
56+
tools/ci/prep-platformio.sh
5757
if [ $? -ne 0 ]; then exit 1; fi
5858
echo -e "travis_fold:end:prep_platformio"
5959

6060
echo -e "travis_fold:start:test_platformio"
61-
tools/test-platformio.sh
61+
tools/ci/test-platformio.sh
6262
if [ $? -ne 0 ]; then exit 1; fi
6363
echo -e "travis_fold:end:test_platformio"
6464
fi
File renamed without changes.
File renamed without changes.

‎tools/prep-arduino-ide.sh renamed to ‎tools/ci/prep-arduino-ide.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-li
55
tar xf arduino.tar.xz
66
mv arduino-nightly $HOME/arduino_ide
77
mkdir -p $HOME/Arduino/libraries
8+
mkdir -p $HOME/Arduino/hardware/espressif
9+
cd $HOME/Arduino/hardware/espressif
810

9-
cd $HOME/arduino_ide/hardware
10-
mkdir espressif
11-
cd espressif
1211
ln -s $TRAVIS_BUILD_DIR esp32
1312
cd esp32/tools
1413
python get.py
File renamed without changes.

‎tools/test-arduino-ide.sh renamed to ‎tools/ci/test-arduino-ide.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ if [ "$CHUNK_INDEX" -ge "$CHUNKS_CNT" ]; then
1616
exit 1
1717
fi
1818

19+
export ARDUINO_BOARD_FQBN="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none"
20+
1921
export ARDUINO_IDE_PATH=$HOME/arduino_ide
20-
export ARDUINO_LIB_PATH=$HOME/Arduino/libraries
22+
export ARDUINO_USR_PATH=$HOME/Arduino
23+
2124
export EXAMPLES_PATH=$TRAVIS_BUILD_DIR/libraries
22-
export EXAMPLES_BUILD_DIR=$TRAVIS_BUILD_DIR/build.tmp
23-
export EXAMPLES_BUILD_CMD="python tools/build.py -b esp32 -v -k -p $EXAMPLES_BUILD_DIR -l $ARDUINO_LIB_PATH "
25+
export EXAMPLES_BUILD_DIR=$HOME/build.tmp
26+
export EXAMPLES_CACHE_DIR=$HOME/cache.tmp
27+
export EXAMPLES_BUILD_CMD="python $TRAVIS_BUILD_DIR/tools/ci/build-sketch.py -v -k -b $EXAMPLES_BUILD_DIR -c $EXAMPLES_CACHE_DIR -u $ARDUINO_USR_PATH -f $ARDUINO_BOARD_FQBN "
2428
export EXAMPLES_SIZE_BIN=$TRAVIS_BUILD_DIR/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-size
2529

2630
function print_size_info()
@@ -93,6 +97,10 @@ function count_sketches()
9397
function build_sketches()
9498
{
9599
mkdir -p $EXAMPLES_BUILD_DIR
100+
mkdir -p $EXAMPLES_CACHE_DIR
101+
mkdir -p $ARDUINO_USR_PATH/libraries
102+
mkdir -p $ARDUINO_USR_PATH/hardware
103+
96104
local chunk_idex=$1
97105
local chunks_num=$2
98106
count_sketches
File renamed without changes.

0 commit comments

Comments
 (0)
Please sign in to comment.