Skip to content

Commit

Permalink
convert platform.txt when building board manager packages.
Browse files Browse the repository at this point in the history
The Arduino IDE handles the tool path differently for manual installs and for
packages that have been added by using the board manager.

For the compile step it is possible to overcome that problem by redefining
two automatic variables. These redefinitions only work for manual installs.
For board manager installs they are ignored and the variable keep their
automatic values. This is an ugly trick, but it works:

runtime.tools.sdcc.path={runtime.hardware.path}/tools/sdcc
runtime.tools.STM8Tools.path={runtime.hardware.path}/tools

Apparently, this trick only works for compiler settings, not for the
upload process. The upload process is not handled by arduino-build, but
the IDE itself and behaves slightly differently.
Problem is in Arduino/arduino-core/src/processing/app/BaseNoGui.java
function createToolPreferences():
	PreferencesData.removeAllKeysWithPrefix(prefix);

This manual/automatic install shisma is now overcome by patching the
platform.txt in the process of generating the board manager packages.

Before packaging, the string "{runtime.hardware.path}/tools" is replaced by
"runtime.tools.STM8Tools.path" in all tools.stm8.* lines.

This is another ugly workaround, but again, it works.
(hopefully)
  • Loading branch information
tenbaht committed Feb 5, 2019
1 parent eb7868d commit e32c670
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions board-manager/Makefile.core
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ $(PLATFORM_ENTRY): $(COREFILE)

$(COREFILE): | $(COREDIR)
echo "Generating the core archive file."
(cd ..; git archive -v --prefix=./ --format=tar HEAD:$(SUBTREE))|\
bzip2 > $(COREFILE)
$(eval TMPDIR := $(shell mktemp -d))
cd ..; git archive -v HEAD:sduino/stm8|tar -x -C $(TMPDIR)
sed -i '/^tools\.stm8/ s#{runtime.hardware.path}/tools#{runtime.tools.STM8Tools.path}#' \
$(TMPDIR)/platform.txt
tar cvjf $(COREFILE) -C $(TMPDIR) .
rm -rf $(TMPDIR)

# make a new release directory if not present
#
Expand Down

0 comments on commit e32c670

Please sign in to comment.