@@ -54,21 +54,26 @@ function build_sketches()
54
54
continue # Not ours to do
55
55
fi
56
56
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
-
62
57
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.
63
61
head -8 $build_dir /build.options.json > $build_dir /../build.options.json
64
62
echo ' "sketchLocation" : "' $sketch ' ",' >> $build_dir /../build.options.json
65
63
tail -2 $build_dir /build.options.json >> $build_dir /../build.options.json
66
64
fi
67
65
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.
68
69
rm -rf $build_dir /sketch $build_dir /* .bin $build_dir /* .map $build_dir /* .elf
69
70
70
71
if [ -e $cache_dir /core/* .a ]; then
72
+ # Restore the new build.options.json file
71
73
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.
72
77
touch -t 203712310000 $cache_dir /core/* .a
73
78
fi
74
79
0 commit comments