Repository navigation
Install on Windows with Scoop and winget #152
Description
Why
On Windows the formatter is a file from the release page that has to be renamed to open-java-format.exe and moved into a directory on the PATH by hand, and replaced by hand for every release. Windows has three package managers that could do this:
- winget is Microsoft's and comes with Windows 11 and current Windows 10. It has one central repository, microsoft/winget-pkgs, where every version is a pull request that goes through Microsoft's validation before it is merged.
- Scoop is popular with developers for command-line tools. It installs per user, without administrator rights, and anyone can run a bucket: a Git repository of JSON manifests.
- Chocolatey is the oldest and common in companies. Its community repository has a moderation queue, and it installs as administrator by default.
winget reaches every Windows machine with no setup, and a Scoop bucket is entirely in our hands, so this proposes both. Chocolatey can wait until someone asks: it would be a third account, API key and moderation queue for users the other two already reach.
Scoop: a bucket of our own
openjavaformat/scoop-bucket, made from ScoopInstaller/BucketTemplate, with bucket/open-java-format.json: the release's open-java-format-windows_x86-64.exe, renamed to open-java-format.exe with Scoop's #/ suffix, its hash, and bin pointing at it.
scoop bucket add openjavaformat https://github.com/openjavaformat/scoop-bucket
scoop install openjavaformat/open-java-formatThe manifest's checkver and autoupdate blocks let the bucket follow releases, with the hash read from checksums_sha256.txt. The template's Excavator workflow runs them every four hours and commits the new version: the idea of the Homebrew tap in #151, done with Scoop's own tooling.
The official buckets have to wait. Extras asks for at least 100 stars or 50 forks, Main for 500 stars and 150 forks, and the repository has 34 stars today. google-java-format is in Extras, as a jar that needs a JDK (manifest).
winget: a package in microsoft/winget-pkgs
A portable package, InstallerType: portable with Commands: [open-java-format]: winget keeps the exe in a directory of its own and puts an open-java-format link on the PATH. jq ships its single exe this way (manifest).
winget install OpenJavaFormat.OpenJavaFormatThe first version goes in by hand, with wingetcreate new or komac new. After that, a workflow in this repository on the release: released event, which fires when the draft release is published, runs wingetcreate update --submit or komac update --submit to open the pull request from a fork. It needs a token that can fork microsoft/winget-pkgs and open pull requests, kept as a repository secret. Every update waits for Microsoft's validation, so winget trails a release by hours to days.
Both manifests are x64 only, since the release has no ARM64 binary.
To decide
- The winget identifier,
OpenJavaFormat.OpenJavaFormatabove, and the monikeropen-java-format. Neither should change once published. - Whose token opens the winget pull requests: a maintainer's or a bot account's.
- Windows 11 on ARM: winget and Scoop would hand it the x64 binary, to run under emulation, while the Command line page sends those users to the jar. Try the binary there before the page promises anything.
Done when
scoop install openjavaformat/open-java-formatandwinget install OpenJavaFormat.OpenJavaFormatinstall the latest release on Windows x64, andopen-java-format --versionworks in a new terminal;- a new release reaches the bucket within four hours, and its winget pull request opens without a hand edit;
- the Command line page gets a Windows section with both commands, and About lists both.
Related
- Install with Homebrew from a tap of our own #151 does the same for Homebrew.
- Install on Ubuntu with apt from a repository of our own #153 does the same for Ubuntu.
Activity