-
Notifications
You must be signed in to change notification settings - Fork 0
Automatic Updates
From BlockDesigner 0.4.16, a plugin can update itself from its GitHub releases. This page describes exactly what the
app does, from
PluginUpdater.java
and MainWindow.updatePlugins, so you can make releases it accepts.
-
An
updateslink in the manifest pointing at a GitHub repository:"updates": "https://github.com/you/BlockDesigner-YourPlugin"
It must match
https://github.com/<owner>/<repo>(owner and repo made ofA-Z a-z 0-9 _ . -); a trailing.gitor any/pathafter the repo is accepted and ignored.http://, other hosts, or no link at all mean "updated by hand", and the Plugins window and the plugin's tab say so ("Updates by hand: it doesn't link a release source" / "…its release source isn't a GitHub repository"). With a valid link they say "Updates automatically from github.com//". -
A published latest release in that repository. BlockDesigner asks GitHub for
GET https://api.github.com/repos/<owner>/<repo>/releases/latest, which only returns a published release that is not a draft and not a pre-release (GitHub's "Latest" badge). No such release: "github.com// has no releases". The request is anonymous (no token), so the repository must be public. -
A tag that is the version. The release's
tag_name, with one leadingvorVremoved, is the version. It is compared with the installed plugin's manifestversionnumber by number (1.10.0>1.9.0); anything after a-or+is ignored, so1.2.0-betacounts as1.2.0. Only a newer version is installed. An installed plugin with noversioncounts as0. The official plugins use plain tags:1.0.2. -
The jar attached to the release, as a release asset whose name ends in
.jar:- if the release has exactly one
.jar, that one is used, whatever its name; - if it has several, one must be named
<plugin id>-…(starting with the manifest id and a dash, case ignored), conventionally<id>-<version>.jar; otherwise the update fails with "its release has several jars and none is named -.jar". If several start with<id>-(say a-sources.jartoo), the last one GitHub lists wins, so attach only the plugin jar; - no
.jarat all: "its release has no .jar".
- if the release has exactly one
-
Inside the downloaded jar, the manifest must have the same
id(otherwise "the download is a different plugin") and anapithis BlockDesigner has (otherwise it is skipped with " needs a newer BlockDesigner", and tried again at the next check). -
The jar's manifest
versionmust equal the tag. BlockDesigner doesn't check this, but if the jar says an older version than the tag, the installed version stays older than the latest release, and the plugin is downloaded and reinstalled at every start. Fill the version from the build ("version": "@VERSION@", see Setting up a plugin project) and tag with the same number.
In short: manifest updates = your public GitHub repo; release tag = x.y.z = manifest version; exactly one asset,
<id>-x.y.z.jar; not a draft or pre-release. The release checklist produces exactly that.
For each installed plugin whose manifest has a valid updates link (on, off or failed alike), on a background
thread, one after another:
- Ask GitHub for the latest release and pick the jar as above.
- Download it into
%TEMP%\BlockDesigner-update\plugins\<id>\, checking its size against the release and its SHA-256 against thedigestGitHub publishes for the asset (when GitHub provides one). A mismatch installs nothing. - Read its manifest; check the id and the API level.
- On the JavaFX thread, install it like Install… does: unload the old plugin, delete its jar if the file name differs, copy the new jar into the plugins folder under the asset's file name, and enable it. If the plugin was off before, it is switched off again straight away. The plugin's log gets "Updated from to ()".
Your plugin's disable() runs on the old version, and enable() on the new one, in the same session: no restart.
Data in the data folder and saved settings are kept.
-
At every start, once, right after the plugins are loaded, if Update plugins automatically is on (it is on
by default; setting
autoUpdatePluginsinsettings.json). The startup check is quiet: it only speaks up when something was updated (a toast "Updated " and a status-bar summary). Failures at startup are not shown. - On demand: Plugins › Manage plugins… › Check for updates runs the same check and shows a one-line summary ("Every plugin is up to date.", "Updated …", "Not updated: …") next to the button and in the status bar.
- There is no periodic check while BlockDesigner is running.
Plugins (puzzle icon) › Manage plugins… and untick Update plugins automatically (tooltip: "At startup,
plugins that link their release source update to their newest release"). It is saved at once. Check for updates
still works by hand. There is no per-plugin switch: a user who wants to keep one plugin at an old version has to
turn automatic updates off altogether (or install a jar without an updates link).
- Every plugin is one anonymous GitHub API request per check; GitHub limits anonymous requests per IP address (at the time of writing, 60 an hour). That is plenty for startup checks, but many restarts in an hour with many plugins can hit it; the check then fails quietly until the limit resets.
- A release that raises the plugin's
apilevel reaches only users whose BlockDesigner has that level; the others keep the previous version until they update BlockDesigner (and are told so when they check by hand). - Pulling a bad release: publish a fixed, higher version. Deleting the release makes the previous one "latest" again, but installed copies never go back to a lower version by themselves.
- Pre-releases are never offered, which makes them a safe way to share test builds.
- Installing a plugin by hand (Install…) always works, with or without an
updateslink.
User guide
- Getting started
- Building like in Minecraft
- Controls and keybinds
- Brushes, selections and BlockEdit
- Layers
- Reference images
- Import and export
- Camera, look and feel
- Using plugins
- User FAQ
Plugin developer wiki
Start here
How it works
- How plugins are loaded
- Lifecycle and context
- Registering features
- BlockEdit commands
- Data and settings
- Project file format
Shipping
Elsewhere