Skip to content

Latest commit

 

History

History
253 lines (200 loc) · 32.5 KB

development.md

File metadata and controls

253 lines (200 loc) · 32.5 KB

Development

中文 | English

Layout

metadata.lua              plugin name, version, oldest vfox, and the note that `vfox add` prints
hooks/available.lua       vfox search: the list of every name
hooks/pre_install.lua     vfox install: resolve a name to a package; and PostInstall
hooks/pre_use.lua         vfox use: the drift check for vfox older than 1.1.0
hooks/fingerprint.lua     vfox use / doctor on vfox 1.1.0+: the git HEAD fact
hooks/detect.lua          vfox link --detect on vfox 1.1.0+: find SDKs already on the machine
hooks/env_keys.lua        PATH
lib/util.lua              the mirror, the platform, version names, their order, and the vfox version gate
lib/git.lua               git commands and the GitHub mirror
lib/gitinstall.lua        a source install or OpenHarmony build: planned in PreInstall, made in PostInstall
lib/source.lua            source installs on Linux ARM64 and Windows ARM64
lib/ohos.lua              OpenHarmony releases
lib/manifest.lua          the Fingerprint HEAD reader, the legacy `.vfox-manifest`, and the pubspec.lock fix
lib/detect_sdk.lua        the well-known install locations and SDK identification for Detect
lib/shell.lua             a path as one word of a command line, and directory listings
tests/hooks_test.lua      offline hook tests
tests/e2e/                container tests, see e2e.md
Injection.lua             type hints for what vfox injects, never loaded
.luarc.json, stylua.toml  Lua language server and formatter settings (Lua 5.1, 120 columns, 4 spaces)
.devcontainer/            the Linux development container, see e2e.md
.github/workflows/        lint, license headers, hook tests, e2e, and the release workflow

vfox loads metadata.lua, calls a hook when a command needs it, and puts PLUGIN and RUNTIME (osType, archType, version) in scope. osType and archType are Go's GOOS and GOARCH of the vfox binary. The hooks run in gopher-lua, a Lua 5.1 interpreter written in Go, with vfox's http and json modules. Files in lib are loaded with require, and lib/util.lua defines globals.

What runs for a command

You run Hooks
vfox search flutter Available
vfox install flutter@3.47.4 PreInstall returns the package, which it finds in PLUGIN:releases, the list that Available returns. vfox downloads, verifies and unpacks, then calls PostInstall, which makes the checkout of a source install or an OpenHarmony build. vfox 1.1.0+ records the Fingerprint fact in the receipt then
vfox use flutter@3.47.4 PreUse returns nothing, so that vfox 0.4.2 and later find the installed name themselves, also from the start of one. With vfox older than 1.1.0 it checks the SDK first. vfox 1.1.0+ compares the Fingerprint fact instead and reports sdk.drift. EnvKeys provides PATH
vfox uninstall flutter@3.47.4 none, the name has to be exact

Contracts that cost time

  • Available returns one table per name with version, url, sha256, key, note and addition. key is the git commit of the release, which is how a channel finds its release: current_release.stable in the index is a commit, and PreInstall takes the entries whose key is that commit. note is the channel, shown in parentheses. addition is the Dart version, shown in brackets. source = true is the plugin's own mark for a -arm64 source install.
  • PreInstall returns version, url and sha256. version becomes the name of the install. It is the name without the architecture suffix unless the request had one (3.47.4 stays 3.47.4, 3.47.4-x64 stays 3.47.4-x64), and for a channel the release it stands for.
  • A source install and an OpenHarmony build return no url: vfox makes an empty install directory, and PostInstall makes the checkout there (lib/gitinstall.lua). A checkout made elsewhere would have to be returned as a local url, which vfox moves by renaming, and that does not cross file systems (vfox#878). Every vfox the plugin loads on removes the directory of an install that fails or is interrupted. vfox 1.1.0 removes a version that it reinstalls before PostInstall, so PreInstall first asks the repository for its refs, and an install that cannot reach it stops there. vfox runs both hooks in one Lua state: PreInstall plans the checkout, PostInstall takes it once, and without a plan expects the files of an archive.
  • PreInstall calls self:releases({ officialOnly = true }), not Available, and so does not use vfox's 12-hour cache of the list: every install reads the index. vfox 0.5.0 to 0.6.6 replace PLUGIN.Available with a function that caches it, for the plugin's own calls too. 0.5.0 and 0.5.1 give back version, note and addition only, which left an install without an address, and the later ones kept what an install asked for as the list of vfox search. officialOnly leaves out the OpenHarmony releases: an official install has no use for them, and gitcode.com rate-limits the API they come from. vfox calls Available with its own context (vfox search, and the latest of vfox install), and those lists have them.
  • PreInstall returns nil for a name it cannot resolve, which vfox reports as no installable runtime provided. It raises an error for a failure, and for a name without a suffix that only has an x64 build on ARM64, to name the -x64 one: the message of error() shows up in the plugin [PreInstall] method error: line.
  • The index lists some releases more than once. newestPublications in hooks/available.lua keeps the newest entry (release_date) of each archive of a version, because a file that was uploaded again has the checksum of the newest entry only (see troubleshooting.md). Different versions never merge, and a release in two channels has an archive in each and keeps both. table.sort is not stable, so the comparator has to tell any two entries apart, or equal entries come out in an order that depends on the whole input, and PreInstall takes the first match. It ends with the version and the channel for that.
  • PostInstall reads ctx.sdkInfo[PLUGIN.name] and makes the planned checkout in its path. It runs the pubspec.lock fix under pcall, so a failure there never fails the install. The legacy .vfox-manifest is only written when the running vfox is older than 1.1.0 (supportsFingerprint in lib/util.lua): newer vfox records the Fingerprint fact in the version's receipt instead.
  • Fingerprint reports the commit the SDK checkout is at as facts.head, by reading .git/HEAD (and the ref or packed-refs it points to) from files only: no processes, no network, well under the 50 ms the hook must keep. It returns nil when there is nothing to check (no .git), and vfox stays silent then. Archive installs, source installs and OpenHarmony builds all report it, as do linked copies that still carry their .git (Homebrew, mise, asdf, FVM, manual installs). PreUse skips its own drift check on vfox 1.1.0+ (supportsFingerprint(ctx.runtimeVersion)) so the same drift is not reported twice; older vfox keeps the plugin's own warning from .vfox-manifest. PreUse runs before vfox completes a prefix such as 3.47, so the plugin picks the installed name the way vfox does, and checks that one. vfox 1.0.0 to 1.0.3 give PreUse a single installed version under the plugin's name, and the plugin lists the version directories next to it. vfox 0.4.2 and later complete a name when PreUse returns nothing; for older ones PreUse returns the name as it is, because 0.4.0 then fails even for a whole name, and 0.4.1 completes 3.4 to 3.47.4.
  • Detect scans the well-known install locations for vfox link --detect: Homebrew's Caskroom (macOS), the install directories of mise ($MISE_DATA_DIR, or $XDG_DATA_HOME/mise without it, and ~/.local/share/mise) and asdf ($ASDF_DATA_DIR and ~/.asdf), FVM's versions ($FVM_CACHE_PATH, $FVM_HOME and ~/fvm), and a few manual-install directories (plus C:\src\flutter on Windows). Of mise it takes real directories only: latest and prefixes such as 3.47 are links that mise moves to newer versions. A candidate is an SDK when its bin holds flutter (or flutter.bat) and the release it records is a name vfox could link under: frameworkVersion in bin/cache/flutter.version.json, which the Flutter tool writes, or else the root version file, which newer releases do not have (the archive of 3.47.4 has none). 0.0.0-unknown is not a release. The note says where it was found. lib modules must not share a hook's filename: vfox searches hooks/ before lib/, so require("detect") would load hooks/detect.lua and loop, which is why the module lives in lib/detect_sdk.lua.
  • vfox unpacks a .tar.xz with Go's archive/tar, which stamps files with the time of the extraction and not with the time stored in the archive. The official tar -xf flow keeps those times, and packages/flutter_tools/pubspec.lock is newer than pubspec.yaml after it. After a vfox install the two share the time of the extraction, and whichever is written last looks newer, so bin/internal/shared.sh can find pubspec.yaml newer than pubspec.lock and rebuild the tool on the first run (Building flutter tool...). manifest.touchPubspecLock rewrites pubspec.lock, on every platform, to restore the order (#37). Source installs build the tool on the first run by design.
  • A Windows command line reaches cmd.exe as vfox 1.0.13 and later write it, unchanged (vfox#712), and older versions quote it again, so that git gets the quotes of a quoted path as part of it. Every path on a command line goes through quote in lib/shell.lua. A path made of letters, digits, non-ASCII characters and \ : . _ ~ + ' - stays bare and works on both. Any other path goes in double quotes, so that a space does not split it and a & in a directory name does not end the command; on older versions it fails, as a path with a space always did. cmd expands %NAME% inside double quotes too, so for a path with %, a double quote or a control character quote returns nil and the command is left out: Detect and the legacy drift check skip the directory, and a source install stops with a message.
  • os.execute reports success as 0 or as true, depending on the Lua it runs in, and exec in lib/git.lua accepts both. io.popen is how the plugin reads the output of git outside Fingerprint (the legacy drift check and the .vfox-manifest it compares with) and how shell.list lists directories for Detect and PreUse; a command that prints nothing or fails reads as nil, which is why a missing git goes unnoticed in lib/manifest.lua. Fingerprint itself never uses io.popen or os.execute.
  • A git hook, among others, names a repository to the commands it runs with GIT_DIR and the like, which win over -C. git.command removes those variables from its command lines when they are set. git init also asks for refs in files (init.defaultRefFormat=files), because Fingerprint reads them without git, and git 3.0 defaults to reftable.
  • git runs with your configuration, except for two settings that git.init writes into the checkout: core.longpaths=true, and core.autocrlf=false, because a global true writes Flutter's shell scripts with CRLF (see arm64.md). On Windows false writes the same CRLF files true does, since core.eol is native there. That is how git works, and it was checked on Linux with core.eol=crlf and Flutter's .gitattributes, which starts with * text=auto: the same files came out CRLF for both settings, and bin/flutter stayed LF. The Windows ARM64 container tests install from a checkout like this one. git ls-remote and git fetch get http.lowSpeedLimit=1000 and http.lowSpeedTime=60, which GIT_HTTP_LOW_SPEED_LIMIT and GIT_HTTP_LOW_SPEED_TIME override.
  • The releases of the fork come from gitcode.com's API oldest first, 100 to a page, and lib/ohos.lua reads every page. An answer that is not a JSON array counts as a failed request, and so does an index without releases and current_release (getReleaseIndex in lib/util.lua).
  • The error of getReleaseIndex names the address it asked, through shell.redact, and says when it comes from FLUTTER_STORAGE_BASE_URL: a mirror can stop serving Flutter, and a status alone does not say who sent it. vfox's http.get returns no err for an answer with another status than 200.
  • lib/ohos.lua waits for gitcode.com in two ways. Installing a build needs the releases, and makes five attempts: 10 seconds apart, and 30, 60, 120 and 180 seconds after HTTP 429. Listing them is a courtesy to vfox search, so ohos.list() makes two attempts 2 seconds apart, stops at HTTP 429, and returns nil and the reason. Available then writes one warning line to stderr and lists the official releases.
  • VFOX_FLUTTER_OHOS_REPOSITORY replaces the repository lib/ohos.lua fetches from, not the releases API. The commit still comes from gitcode.com and has to be a hash: git checks what it fetches against it, so another repository cannot swap in other code, which a branch name would let it do. A release without a hash is fetched by its tag from gitcode.com only. A relative path is refused, because git runs in the checkout. A plain URL goes on the command line bare, so that it works on vfox 1.0.12 on Windows too; anything else goes through shell.quote. Output shows the address without its user name, password and query (shell.redact), as it does the GitHub mirror's.
  • Flutter reads its version from the git tags at HEAD and its channel from the branch. So both kinds of checkout tag the commit they fetched with the release's name, and a source install checks it out on a branch named after the channel. A source install fetches the commit that the release index names (key in Available), not the tag: it is the commit of the official archive, git checks what arrives against it, and for a few releases the tag is another commit, see arm64.md. Neither gets an origin remote: with one, Flutter's check for a newer version runs git fetch --tags, which pulls the whole history into the shallow clone (more than 400 MB, measured on 2026-12-01).
  • A tag is an OpenHarmony release when its name contains -ohos- or +ohos- (ohos.isOhosVersion).
  • source.list offers a -arm64 source install of a release only from OLDEST_NATIVE on, the first release whose Flutter tool runs with a native Dart SDK on that machine, and of one without dart_sdk_arch from OLDEST_NATIVE_UNNAMED on, see Refreshing the Dart SDK table. On ARM64, Available lists the releases without dart_sdk_arch as -x64.
  • EnvKeys sets PATH only. It sets no FLUTTER_ROOT.
  • Lua has no sleep, so sleep in lib/util.lua is os.execute("sleep N"), or ping -n N+1 127.0.0.1 on Windows, which sends one packet a second. timeout /t does not do there: it exits at once when its input is not a console, as in CI. The retries in lib/util.lua and lib/ohos.lua wait with sleep.

Names and order

splitVersionAndArch in lib/util.lua splits 3.47.4-x64 into 3.47.4 and x64, and only x64 and arm64 count as a suffix: 3.50.0-0.1.pre has none. compare_versions ignores the suffix and compares the numbers in the version one by one. A version with fewer numbers sorts above one that continues the same numbers, so 3.47.0 is above 3.47.0-0.4.pre.

Available sorts by these rules, one after the other:

  1. OpenHarmony names after all others (ohos.isOhosVersion).
  2. The architecture of the machine, and names without a suffix, before the other architecture.
  3. Entries of the stable channel (note == "stable") before the others, so that @latest, the first line, is the newest stable release and not a beta that has a higher number.
  4. compare_versions, newest first.
  5. The architecture of the machine before the other one, and then the plain string order.
  6. The channel (beta before dev), for the same name in two channels.

Rules 2 and 3 keep @latest on the machine's own architecture and on a stable release. The unit tests check both.

Resolving a name

PreInstall splits the request into a name and an architecture (requestedArch), and then:

  1. An OpenHarmony name goes to ohos.checkout, which refuses a suffix.
  2. beta and stable read current_release from the index, and its commit becomes channelKey. A channel that the index does not name ends the lookup with nil. dev is not a channel any more, so it is looked up as a version name and found nowhere.
  3. It walks the releases, the entries of a requested channel first, because a release can be in two channels, and takes the first entry whose commit is channelKey, or whose name equals the request, and whose architecture is the one requested (or the machine's). A name without a suffix, which only x64 machines list, is x64. When a request without a suffix only matches an x64 build, it raises an error that names the -x64 name.
  4. A source entry goes to source.checkout, which plans the checkout. The others return url and sha256.

Tests

The hook tests run offline under gopher-lua, the Lua interpreter vfox embeds:

go run github.com/yuin/gopher-lua/cmd/glua@v1.1.1 tests/hooks_test.lua

Run it from the repository root. The test stubs http, json and os.getenv, and keeps a small index in a table: two architectures that share a commit, a beta, a dev release and a release without architecture metadata. It checks that:

  • every variant is listed, the machine's architecture first;
  • an explicit suffix selects the matching archive, and a plain name keeps the machine's;
  • @latest stays on the machine's architecture even when the other one is newer;
  • channels pick the machine's architecture although both share a commit, and dev resolves to nothing;
  • pre-release names keep their text, and the suffix does not change the order;
  • the mirror serves the index and every archive;
  • a release without architecture metadata is an x64 build, which ARM64 machines list and install only as -x64;
  • a missing architecture never falls back to an incompatible archive;
  • a fetch gives up on a stalled transfer and retries;
  • installing an official release never asks gitcode.com, while a listing asks it once;
  • a rate-limited gitcode.com costs a listing no wait and one warning, and a failed request is tried once more;
  • installing an OpenHarmony build waits out a rate-limited gitcode.com (30, 60, 120 and 180 seconds);
  • on Windows, a wait is a ping, which needs no console;
  • OpenHarmony tags with +ohos- are listed, sorted and installable, and refuse an architecture suffix;
  • VFOX_FLUTTER_OHOS_REPOSITORY changes where an OpenHarmony build is fetched from, for a commit hash only;
  • with a real git (skipped without it), an OpenHarmony build is the pinned commit of a local repository, tagged with the release's name, and nothing from a repository that lacks it, and a source install is the index's commit, tagged, on its channel's branch, without a remote, and stops in PreInstall for a repository that does not answer;
  • PostInstall makes the checkout that PreInstall planned, once, and expects files otherwise;
  • PreInstall does not take the list from Available, which vfox 0.5 and 0.6 can answer from their cache;
  • Detect reads the release the Flutter tool records, and the version file of older SDKs;
  • stable releases come before pre-releases, so the first line is the newest stable release;
  • an archive that was published again keeps its newest entry, and different versions or channels never merge;
  • ARM64 source installs start at the first release that runs with a native Dart SDK, also for releases without architecture metadata;
  • a checkout does not take core.autocrlf from your git configuration (this one runs real git, and skips itself without it);
  • an unsupported CPU is named in the message;
  • on Windows, a path that is not ordinary is quoted on the command lines of Detect, source installs and the legacy drift check, and a path with %, a double quote or a control character gets no command;
  • Fingerprint reads the commit from files, also through the .git file of a worktree and one directory below, and PreUse leaves the name to vfox 0.4.2 and later, gives it back to older ones, and checks drift only before vfox 1.1.0, also of the version that a prefix selects;
  • Detect knows the managers' layouts and variables, leaves mise's links out, and lists directories the Windows way there;
  • an answer that is not the release index, or not a list of releases, is reported as such, and every page of the OpenHarmony releases is read;
  • a release index that the server refuses is reported with its address, and with FLUTTER_STORAGE_BASE_URL when a mirror is set, without the mirror's user name and password;
  • a channel takes its own entry of a release that another channel has too, and releases listed after the first v release stay listed;
  • git gets the remote and the ref as one word each, and works on its own checkout where the environment names a repository;
  • a mirror's password stays out of the output.

The container tests cover the drift end to end, see e2e.md. Lint, license headers and the container tests are in e2e.md.

To call a single hook, vfox 1.0.13 and later has vfox plugin run. It does not register the plugin, and --os and --arch answer for another platform:

vfox plugin run . Available --os windows --arch arm64 --json
vfox plugin run . PreInstall --input '{"version":"stable"}' --os darwin --arch arm64 --json

Both ask the real index and gitcode.com. A source install (--os linux --arch arm64) runs the real git ls-remote in PreInstall, whatever the operating system you are on, and its checkout is made by PostInstall. vfox --debug <command> shows what vfox does with a hook, which is how to find an error it swallows.

Trying a change without downloading gigabytes

An archive is 1.5 to 2.3 GB, so a change to the resolution is cheaper to try against a fake mirror: a copy of the real index whose archives are one tiny SDK. The SDK holds a flutter/bin/flutter script and a real git repository, so the receipt and the drift check run for real. Run it on Linux, from the root of the repository. It sets HOME and VFOX_HOME to a scratch directory, which vfox needs both of, so your real vfox is left alone.

work=$(mktemp -d)
python3 - "$work" <<'EOF'
import hashlib, io, json, os, subprocess, sys, tarfile, urllib.request

work = sys.argv[1]
base = "https://storage.googleapis.com/flutter_infra_release/releases/"
index = json.load(urllib.request.urlopen(base + "releases_linux.json"))

sdk = os.path.join(work, "sdk", "flutter")
os.makedirs(os.path.join(sdk, "bin"))
with open(os.path.join(sdk, "bin", "flutter"), "w") as f:
    f.write('#!/bin/sh\necho "fake flutter in $(cd "$(dirname "$0")/.." && pwd)"\n')
os.chmod(os.path.join(sdk, "bin", "flutter"), 0o755)
git = ["git", "-C", sdk, "-c", "user.name=x", "-c", "user.email=x@x", "-c", "core.autocrlf=false"]
subprocess.run(["git", "init", "-q", sdk], check=True)
subprocess.run(git + ["add", "."], check=True)
subprocess.run(git + ["commit", "-q", "-m", "fake"], check=True)

path = os.path.join(work, "flutter.tar.xz")
with tarfile.open(path, "w:xz") as tar:
    tar.add(sdk, arcname="flutter")
sha = hashlib.sha256(open(path, "rb").read()).hexdigest()

root = os.path.join(work, "mirror", "flutter_infra_release", "releases")
os.makedirs(os.path.join(root, "fake"))
os.rename(path, os.path.join(root, "fake", "flutter.tar.xz"))
for release in index["releases"]:
    release["archive"], release["sha256"] = "fake/flutter.tar.xz", sha
with open(os.path.join(root, "releases_linux.json"), "w") as f:
    json.dump(index, f)
EOF

The scratch directory now holds the mirror. Build the plugin the way install-from-source.md does:

zip -qr "$work/flutter.zip" metadata.lua hooks lib

Serve the mirror, in the background of a shell you keep, and run vfox against it:

python3 -m http.server 8000 --bind 127.0.0.1 --directory "$work/mirror" >/dev/null 2>&1 &
server=$!
export HOME="$work/home" VFOX_HOME="$work/vfox" FLUTTER_STORAGE_BASE_URL=http://127.0.0.1:8000
mkdir -p "$HOME" "$VFOX_HOME"
vfox add flutter --source "$work/flutter.zip"
vfox search flutter
vfox install flutter@stable
eval "$(vfox activate bash)"
vfox use --global flutter@3.50.1
flutter

Stop the server with kill "$server", not with pkill -f and its command line, which matches your own shell as well. To try the next change, edit the plugin in the repository, repeat the zip line above, and run vfox remove -y flutter before vfox add again. The plugin asks gitcode.com for the OpenHarmony releases when vfox search lists versions, and an unreachable gitcode.com only costs two attempts and a warning. The real index has 3.50.1 as stable on 2026-12-04; use whatever vfox install flutter@stable printed.

Refreshing the Dart SDK table

OLDEST_NATIVE in lib/source.lua holds, for each ARM64 platform, the oldest release whose Flutter tool runs with a native Dart SDK, and OLDEST_NATIVE_UNNAMED the same among the releases without dart_sdk_arch, whose versions are older in part. A source install of an older release clones fine, but its tool takes the x64 Dart SDK, so the plugin does not give it an -arm64 name. Two things make a release native: its bootstrap script asks for the ARM64 Dart SDK, and Flutter's storage has it. Old releases do not change, so the table needs a look when a platform joins, and not for every release. To check a release:

release=2.0.6
curl -fsSL "https://raw.githubusercontent.com/flutter/flutter/$release/bin/internal/update_dart_sdk.sh" | grep 'DART_ZIP_NAME="dart-sdk-linux'
curl -fsSL "https://raw.githubusercontent.com/flutter/flutter/$release/bin/internal/update_dart_sdk.ps1" | grep -c -i arm64
engine=$(curl -fsSL "https://raw.githubusercontent.com/flutter/flutter/$release/bin/internal/engine.version")
for platform in linux windows; do
  printf '%s ' "$platform"
  curl -s -o /dev/null -I -w '%{http_code}\n' "https://storage.googleapis.com/flutter_infra_release/flutter/$engine/dart-sdk-$platform-arm64.zip"
done

The first command prints the zip that the Linux script asks for: dart-sdk-linux-x64.zip up to 2.0.6, and dart-sdk-linux-${ARCH}.zip from 2.2.0 on, where uname -m decides ARCH. The second counts the lines about ARM64 in the Windows script: 0 up to 3.19.6, and 6 from 3.20.0-1.1.pre on. The loop asks the storage for the ARM64 Dart SDK of the engine, 200 for there and 404 for not there. On 2026-10-21 2.0.6 printed linux 200 and windows 404, 3.43.0-0.3.pre the same, and 3.44.0-0.1.pre printed 200 for both.

The Linux row of the table is where the script starts to ask (storage has the SDK from 2.0.0), and the Windows row is where storage starts to have it (the script asks from 3.20.0-1.1.pre and falls back to the x64 SDK without it). The table was made by running these checks for the 300 releases of releases_linux.json that have "dart_sdk_arch": "x64", which are the ones that get a -arm64 source install, and it holds for every one of them: the scripts of 283 releases choose the Linux zip by CPU and the 17 oldest do not, and the Windows scripts of 148 mention ARM64 and the 152 oldest do not. On Windows seven older betas (listed in lib/source.lua) have the SDK in storage and are left out. The Linux scripts of 1.20.0, 1.22.4, 2.0.0 and 2.0.6 were also run as an ARM64 machine, with a uname that says aarch64 and a curl that prints the URL it is asked for, and asked for dart-sdk-linux-x64.zip, while those of 2.2.0, 2.5.0, 3.0.0 and 3.24.0 asked for dart-sdk-linux-arm64.zip.

The releases without dart_sdk_arch (127 on 2026-12-01, 1.17.0 to 2.10.0-0.3.pre) were checked the same way at the commit the index names. On Linux the scripts of the 37 from 1.27.0-4.0.pre on choose by CPU and storage has the ARM64 SDK of each; 1.26.0-8.0.pre to 1.27.0-1.0.pre ask for the x64 SDK although storage has the ARM64 one, and the 82 older ones neither. As an ARM64 machine the script of 1.27.0-1.0.pre asked for dart-sdk-linux-x64.zip, those of 1.27.0-4.0.pre, 2.3.0-1.0.pre and 2.10.0-0.3.pre for dart-sdk-linux-arm64.zip. On Windows none of the 35 from 2.1.0-10.0.pre on mentions ARM64.

Adding to the plugin

  • A new way to name or choose. Change hooks/available.lua (the order) or hooks/pre_install.lua (the choice), add a case to tests/hooks_test.lua, and update versions.md, channels.md and arm64.md where they describe it.
  • A new platform. getOsTypeAndArch in lib/util.lua lists the CPUs. A platform that installs from git adds itself to SOURCE_INSTALL_PLATFORMS, OLDEST_NATIVE and, where releases without dart_sdk_arch run on it, OLDEST_NATIVE_UNNAMED in lib/source.lua. Update platforms.md and the tables in arm64.md, and add it to the container tests if a runner exists (e2e.md).
  • A new source of builds like OpenHarmony: a module in lib/ that lists names and plans their checkout with lib/gitinstall.lua, a branch in Available and PreInstall, a flavor in tests/e2e/common/common.go (DefaultFlavours, DefaultOhosVersion), and a page in docs/.
  • A message. The container tests assert the core's drift report (tests/e2e/linux/verify.go and tests/e2e/windows/verify.go). Change the Lua and both files together, and the text in flutter-upgrade.md. They also assert the message for a release index that answers 404 (checkMissingIndexReported in both setup.go), which troubleshooting.md quotes.

Known gaps

  • Source installs and OpenHarmony builds are checked against their commit only, and an OpenHarmony release for which gitcode.com names no commit is fetched by its tag.
  • Only releases from Flutter 1.17 on are listed.
  • OLDEST_NATIVE and OLDEST_NATIVE_UNNAMED are data taken on 2026-10-21 and 2026-12-01 and do not follow Flutter's storage or scripts. It is about the Dart SDK only: the plugin does not check the rest of an old release on ARM64.
  • vfox search marks only the names it prints as installed, see versions.md.
  • The OpenHarmony fork changes its tag names (-ohos-, since 2026-10-15 +ohos-). A name with another marker is not listed.

Releasing

A maintainer runs Actions → Plugin → Run workflow on the default branch with the version, without v. The README describes what the shared workflow does. Afterwards plugins/flutter.json in vfox-plugins shows the version that vfox add flutter serves. That lags the release by hours: 2 h 20 min for 0.2.5, 5 h for 0.2.6 and 11 h for 0.2.7. Then bring the docs up to date, in both languages: move the "Unreleased" entries of changes.md under the new version, dated with the day of the release, name that version as the newest one in its first paragraph, and take the "Unreleased" marks out of the other pages, see Writing the docs.

Writing the docs

English pages are in docs/, the Chinese ones in docs/zh-CN/ under the same names (the Chinese README is README_CN.md), and each page starts with a link to the other language. Change both when you change one: the Chinese pages are translations, and they keep the commands, the paths and the messages of the plugin and of vfox as they are. The README is the way in: a few sentences for each subject and a link. The details are in docs/, one page for a subject. Pages that quote data from outside (Flutter's index, gitcode.com, vfox) give the day the data was taken, or the vfox version. Nothing in CI checks the docs, so run the commands you add.

Commands for a platform go under a heading with the platform (## Ubuntu 26.04.1, ## Windows 11) and begin with Execute in Bash, or Execute in PowerShell 7, (在 Bash 中执行: in Chinese), as the pages already do. The examples install 3.47.4, the default of the container tests (DefaultOfficialVersion in tests/e2e/common/common.go); move them together when it moves.

Behavior that is only on main and not in the latest release is marked "Unreleased" ("未发布" in Chinese), with an entry under "Unreleased" in changes.md. After a release, move those entries under the new version and take the marks out, in both languages: grep -rn -i -e unreleased -e 未发布 docs README*.