Skip to content

Install on Windows with Scoop and winget #152

Open

Description

@abashev

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-format

The 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.OpenJavaFormat

The 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.OpenJavaFormat above, and the moniker open-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-format and winget install OpenJavaFormat.OpenJavaFormat install the latest release on Windows x64, and open-java-format --version works 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions