From e32c670f279eac69c74b68488e6287fc2decce1a Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Tue, 5 Feb 2019 17:36:10 +0100 Subject: [PATCH] convert platform.txt when building board manager packages. 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) --- board-manager/Makefile.core | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/board-manager/Makefile.core b/board-manager/Makefile.core index 062d525b..5daa1502 100644 --- a/board-manager/Makefile.core +++ b/board-manager/Makefile.core @@ -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 #