Skip to content

Commit 038ede7

Browse files
Earle F. Philhower, IIIEarle F. Philhower, III
Earle F. Philhower, III
authored and
Earle F. Philhower, III
committed
Clean up build.options.json and core.a adjustment
Use suggested SED line instead of head/tail to replace the .ino being built. Use touch with a delta from now to ensure this script runs until the end of time_t.
1 parent a0cb206 commit 038ede7

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

tests/common.sh

+5-14
Original file line numberDiff line numberDiff line change
@@ -56,27 +56,18 @@ function build_sketches()
5656

5757
if [ -e $cache_dir/core/*.a ]; then
5858
# 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.
61-
head -8 $build_dir/build.options.json > $build_dir/../build.options.json
62-
echo ' "sketchLocation" : "'$sketch'",' >> $build_dir/../build.options.json
63-
tail -2 $build_dir/build.options.json >> $build_dir/../build.options.json
59+
# with this sketch's ino file, or builder will throw everything away.
60+
sed -i "s,^.*sketchLocation.*$, \"sketchLocation\": \"$sketch\"\,,g" $build_dir/build.options.json
61+
# Set the time of the cached core.a file to the future so the GIT header
62+
# we regen won't cause the builder to throw it out and rebuild from scratch.
63+
touch -d 'now + 1 day' $cache_dir/core/*.a
6464
fi
6565

6666
# Clear out the last built sketch, map, elf, bin files, but leave the compiled
6767
# objects in the core and libraries available for use so we don't need to rebuild
6868
# them each sketch.
6969
rm -rf $build_dir/sketch $build_dir/*.bin $build_dir/*.map $build_dir/*.elf
7070

71-
if [ -e $cache_dir/core/*.a ]; then
72-
# Restore the new build.options.json file
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.
77-
touch -t 203712310000 $cache_dir/core/*.a
78-
fi
79-
8071
local sketchdir=$(dirname $sketch)
8172
local sketchdirname=$(basename $sketchdir)
8273
local sketchname=$(basename $sketch)

0 commit comments

Comments
 (0)