Browse Source

Add library.properties, version file

The publish script inserts contents of file "version" into GD.h and library.properties
selftest now displays version in top-right

[#22]
James Bowman 6 years ago
parent
commit
e301fdc78b
5 changed files with 25 additions and 6 deletions
  1. 5 4
      GD2.h
  2. 17 1
      publish.py
  3. 0 0
      scripts/verify
  4. 2 1
      selftest.ino
  5. 1 0
      version

+ 5 - 4
GD2.h

@@ -1,13 +1,14 @@
 /*
- * Copyright (C) 2013-2017 by James Bowman <jamesb@excamera.com>
- * Gameduino 2/3 library for Arduino, Arduino Due, Raspberry Pi,
- * Teensy 3.2 and ESP8266.
- *
+ * Copyright (C) 2013-2018 by James Bowman <jamesb@excamera.com>
+ * Gameduino 2/3 library for Arduino, Arduino Due, Teensy 3.2 and
+ * ESP8266.
  */
 
 #ifndef _GD2_H_INCLUDED
 #define _GD2_H_INCLUDED
 
+#define GD2_VERSION "%VERSION"
+
 #if defined(RASPBERRY_PI) || defined(DUMPDEV)
 #include "wiring.h"
 #endif

+ 17 - 1
publish.py

@@ -5,6 +5,20 @@
 # converted-assets.
 #
 
+version = open("version").read().strip()
+
+properties = """\
+name=Gameduino2
+version=%s
+author=James Bowman <jamesb@excamera.com>
+maintainer=James Bowman <jamesb@excamera.com>
+sentence=Gameduino 2 and 3 driver
+paragraph=for the popular Gameduino series of graphics, audio video shields.
+category=Display
+url=http://gameduino.com
+architectures=*
+""" % version
+
 inventory = {
     '1.Basics'      : "helloworld fizz blobs simon jpeg",
     '2.Graphics'    : "logo walk tiled mono slotgag reflection",
@@ -40,7 +54,9 @@ for (is_due, suffix) in [(False, ""), (True, "_Due")]:
     z = zipfile.ZipFile("Gameduino2%s.zip" % suffix, "w", zipfile.ZIP_DEFLATED)
 
     for f in "keywords.txt GD2.cpp GD2.h transports/wiring.h".split():
-        z.write(f, "Gameduino2/%s" % f)
+        c = open(f).read().replace('%VERSION', version)
+        z.writestr("Gameduino2/%s" % f, c)
+    z.writestr("Gameduino2/library.properties", properties)
 
     for d,projs in inventory.items():
         dir = "Gameduino2" + "/" + d

+ 0 - 0
scripts/confirm → scripts/verify


+ 2 - 1
selftest.ino

@@ -52,7 +52,8 @@ void testcard(int pass, const char *message)
   GD.cmd_text(240, 12, 28, OPT_CENTER,
     GD3 ? "Gameduino3 Self test" :
           "Gameduino2 Self test");
-
+  GD.cmd_text(GD.w - 2, 12, 27, OPT_CENTERY | OPT_RIGHTX,
+    GD2_VERSION);
   int y;
 
   y = 50;

+ 1 - 0
version

@@ -0,0 +1 @@
+1.0.0