Skip to content

Commit 0109348

Browse files
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
1 parent da215ae commit 0109348

File tree

7 files changed

+68
-2
lines changed

7 files changed

+68
-2
lines changed

cores/rp2040/Arduino.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <stdlib.h>
2626
#include <string.h>
2727
#include "stdlib_noniso.h" // Wacky deprecated AVR compatibility functions
28+
#include "RP2040Version.h"
2829
#include "api/ArduinoAPI.h"
2930
#include "api/itoa.h" // ARM toolchain doesn't provide itoa etc, provide them
3031
#include <pins_arduino.h>

cores/rp2040/RP2040Version.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#pragma once
2+
#define ARDUINO_PICO_MAJOR 1
3+
#define ARDUINO_PICO_MINOR 13
4+
#define ARDUINO_PICO_REVISION 0
5+
#define ARDUINO_PICO_VERSION_STR "1.13.0"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "framework-arduinopico",
3-
"version": "1.11200.0",
3+
"version": "1.11300.0",
44
"description": "Arduino Wiring-based Framework (RPi Pico RP2040)",
55
"keywords": [
66
"framework",

package/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Publishing New Releases
22
=======================
33

4+
First, update the version number throughout the repo and push the change:
5+
6+
./tools/makever.py --version X.Y.Z
7+
git commit -a -m "Update version"
8+
git push
9+
410
GitHub CI Actions are used to automatically build a draft package whenever a tag is pushed to repo:
511

612
git tag X.Y.Z

platform.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
2121

2222
name=Raspberry Pi RP2040 Boards
23-
version=1.12.0
23+
version=1.13.0
2424

2525
runtime.tools.pqt-gcc.path={runtime.platform.path}/system/arm-none-eabi
2626
runtime.tools.pqt-python3.path={runtime.platform.path}/system/python3

tools/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ as necessary to add any add'l fields or menus required. Used because the
3030
`boards.txt` file is very repetitive and it's safer to generate with code
3131
than by hand.
3232

33+
## makever.py
34+
Updates the version info prior to a release in platform.txt, package.json,
35+
and the version header. Run from root of the repo.
36+
3337
## libpico/make-libpico.sh
3438
Builds the libpico.a file as well as the bootloader stage2 binaries.
3539
Run whenever the pico-sdk is updated.

tools/makever.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env python3
2+
import sys
3+
import struct
4+
import subprocess
5+
import re
6+
import os
7+
import os.path
8+
import argparse
9+
import time
10+
import shutil
11+
12+
def main():
13+
parser = argparse.ArgumentParser(description='Version updater')
14+
parser.add_argument('-v', '--version', action='store', required=True, help='Version in X.Y.Z form')
15+
args = parser.parse_args()
16+
17+
major, minor, sub = args.version.split(".")
18+
# Silly way to check for integer x.y.z
19+
major = int(major)
20+
minor = int(minor)
21+
sub = int(sub)
22+
23+
# platform.txt
24+
with open("platform.txt", "r") as fin:
25+
with open("platform.txt.new", "w") as fout:
26+
for l in fin:
27+
if l.startswith("version="):
28+
l = "version=" + str(args.version) + "\n"
29+
fout.write(l);
30+
shutil.move("platform.txt.new", "platform.txt")
31+
32+
# package.json
33+
with open("package.json", "r") as fin:
34+
with open("package.json.new", "w") as fout:
35+
for l in fin:
36+
if l.startswith(' "version": '):
37+
l = l.split(":")[0]
38+
l = l + ': "1.' + str(major) + "{:02d}".format(minor) + "{:02d}".format(sub) + '.0",' + "\n"
39+
fout.write(l);
40+
shutil.move("package.json.new", "package.json")
41+
42+
# cores/rp2040/RP2040Version.h
43+
with open("cores/rp2040/RP2040Version.h", "w") as fout:
44+
fout.write("#pragma once\n")
45+
fout.write("#define ARDUINO_PICO_MAJOR " + str(major) + "\n")
46+
fout.write("#define ARDUINO_PICO_MINOR " + str(minor) + "\n")
47+
fout.write("#define ARDUINO_PICO_REVISION " + str(sub) + "\n")
48+
fout.write('#define ARDUINO_PICO_VERSION_STR "' + str(args.version) + '"' + "\n")
49+
50+
main()

0 commit comments

Comments
 (0)