From 01093482e7f37b5e908464f881ff00c326f14894 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Sun, 6 Mar 2022 11:04:19 -0800 Subject: [PATCH] Add script to update version number, new header (#506) Define ARDUINO_PICO_MAJOR/_MINOR/_REVISION for app use and update the Platform.IO and Arduino files for a new release version. Fixes #309 Fixes #487 --- cores/rp2040/Arduino.h | 1 + cores/rp2040/RP2040Version.h | 5 ++++ package.json | 2 +- package/README.md | 6 +++++ platform.txt | 2 +- tools/README.md | 4 +++ tools/makever.py | 50 ++++++++++++++++++++++++++++++++++++ 7 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 cores/rp2040/RP2040Version.h create mode 100755 tools/makever.py diff --git a/cores/rp2040/Arduino.h b/cores/rp2040/Arduino.h index da7c348..0d12c82 100644 --- a/cores/rp2040/Arduino.h +++ b/cores/rp2040/Arduino.h @@ -25,6 +25,7 @@ #include #include #include "stdlib_noniso.h" // Wacky deprecated AVR compatibility functions +#include "RP2040Version.h" #include "api/ArduinoAPI.h" #include "api/itoa.h" // ARM toolchain doesn't provide itoa etc, provide them #include diff --git a/cores/rp2040/RP2040Version.h b/cores/rp2040/RP2040Version.h new file mode 100644 index 0000000..f236f02 --- /dev/null +++ b/cores/rp2040/RP2040Version.h @@ -0,0 +1,5 @@ +#pragma once +#define ARDUINO_PICO_MAJOR 1 +#define ARDUINO_PICO_MINOR 13 +#define ARDUINO_PICO_REVISION 0 +#define ARDUINO_PICO_VERSION_STR "1.13.0" diff --git a/package.json b/package.json index a28fba5..4c58cc7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "framework-arduinopico", - "version": "1.11200.0", + "version": "1.11300.0", "description": "Arduino Wiring-based Framework (RPi Pico RP2040)", "keywords": [ "framework", diff --git a/package/README.md b/package/README.md index af3309f..501232f 100644 --- a/package/README.md +++ b/package/README.md @@ -1,6 +1,12 @@ Publishing New Releases ======================= +First, update the version number throughout the repo and push the change: + + ./tools/makever.py --version X.Y.Z + git commit -a -m "Update version" + git push + GitHub CI Actions are used to automatically build a draft package whenever a tag is pushed to repo: git tag X.Y.Z diff --git a/platform.txt b/platform.txt index 21ce3f3..cf93851 100644 --- a/platform.txt +++ b/platform.txt @@ -20,7 +20,7 @@ # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification name=Raspberry Pi RP2040 Boards -version=1.12.0 +version=1.13.0 runtime.tools.pqt-gcc.path={runtime.platform.path}/system/arm-none-eabi runtime.tools.pqt-python3.path={runtime.platform.path}/system/python3 diff --git a/tools/README.md b/tools/README.md index 4a355dc..8eb4126 100644 --- a/tools/README.md +++ b/tools/README.md @@ -30,6 +30,10 @@ as necessary to add any add'l fields or menus required. Used because the `boards.txt` file is very repetitive and it's safer to generate with code than by hand. +## makever.py +Updates the version info prior to a release in platform.txt, package.json, +and the version header. Run from root of the repo. + ## libpico/make-libpico.sh Builds the libpico.a file as well as the bootloader stage2 binaries. Run whenever the pico-sdk is updated. diff --git a/tools/makever.py b/tools/makever.py new file mode 100755 index 0000000..a4de260 --- /dev/null +++ b/tools/makever.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +import sys +import struct +import subprocess +import re +import os +import os.path +import argparse +import time +import shutil + +def main(): + parser = argparse.ArgumentParser(description='Version updater') + parser.add_argument('-v', '--version', action='store', required=True, help='Version in X.Y.Z form') + args = parser.parse_args() + + major, minor, sub = args.version.split(".") + # Silly way to check for integer x.y.z + major = int(major) + minor = int(minor) + sub = int(sub) + + # platform.txt + with open("platform.txt", "r") as fin: + with open("platform.txt.new", "w") as fout: + for l in fin: + if l.startswith("version="): + l = "version=" + str(args.version) + "\n" + fout.write(l); + shutil.move("platform.txt.new", "platform.txt") + + # package.json + with open("package.json", "r") as fin: + with open("package.json.new", "w") as fout: + for l in fin: + if l.startswith(' "version": '): + l = l.split(":")[0] + l = l + ': "1.' + str(major) + "{:02d}".format(minor) + "{:02d}".format(sub) + '.0",' + "\n" + fout.write(l); + shutil.move("package.json.new", "package.json") + + # cores/rp2040/RP2040Version.h + with open("cores/rp2040/RP2040Version.h", "w") as fout: + fout.write("#pragma once\n") + fout.write("#define ARDUINO_PICO_MAJOR " + str(major) + "\n") + fout.write("#define ARDUINO_PICO_MINOR " + str(minor) + "\n") + fout.write("#define ARDUINO_PICO_REVISION " + str(sub) + "\n") + fout.write('#define ARDUINO_PICO_VERSION_STR "' + str(args.version) + '"' + "\n") + +main()