Skip to content

Commit a0cb206

Browse files
Cleanup comments explaining the build logic
1 parent 5bfa5be commit a0cb206

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tests/common.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,26 @@ function build_sketches()
5454
continue # Not ours to do
5555
fi
5656

57-
# Uber hack warning - setting the cached core.a file to the future to
58-
# ensure it is accepted as unmodified during build process. Problem is
59-
# the git version header is rewritten after each compile, so the
60-
# builder sees it is new and says "rebuild the whole thing!"
61-
6257
if [ -e $cache_dir/core/*.a ]; then
58+
# We need to preserve the build.options.json file and replace the last .ino
59+
# with this sketch's ino file, or builder will throw everything away. This
60+
# head/tail easier than a complicated SED script to replace the 1 line we need.
6361
head -8 $build_dir/build.options.json > $build_dir/../build.options.json
6462
echo ' "sketchLocation" : "'$sketch'",' >> $build_dir/../build.options.json
6563
tail -2 $build_dir/build.options.json >> $build_dir/../build.options.json
6664
fi
6765

66+
# Clear out the last built sketch, map, elf, bin files, but leave the compiled
67+
# objects in the core and libraries available for use so we don't need to rebuild
68+
# them each sketch.
6869
rm -rf $build_dir/sketch $build_dir/*.bin $build_dir/*.map $build_dir/*.elf
6970

7071
if [ -e $cache_dir/core/*.a ]; then
72+
# Restore the new build.options.json file
7173
mv $build_dir/../build.options.json $build_dir/build.options.json
74+
# Set the time of the cached core.a file to year 2037 so the GIT header
75+
# we regen won't cause the builder to throw it out and rebuild from
76+
# scratch.
7277
touch -t 203712310000 $cache_dir/core/*.a
7378
fi
7479

0 commit comments

Comments
 (0)