Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions crates/vx-cli/tests/openscreen_provider_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,27 @@ fn call(name: &str, os: &str, arch: &str, function: &str, args: &[Value]) -> Val
}

#[rstest::rstest]
#[case("windows", "x64", "Openscreen.Setup.2.0.0.exe")]
#[case("macos", "x64", "Openscreen-Mac-x64-2.0.0.zip")]
#[case("macos", "arm64", "Openscreen-Mac-arm64-2.0.0.zip")]
#[case("linux", "x64", "Openscreen-Linux-2.0.0.AppImage")]
// 2.0.x shipped a single arch-less x64 installer.
#[case("windows", "x64", "2.0.0", "Openscreen.Setup.2.0.0.exe")]
// From 2.1.0 the Windows installer carries an architecture suffix (x64 + arm64).
#[case("windows", "x64", "2.1.0", "Openscreen.Setup.2.1.0-x64.exe")]
#[case("windows", "arm64", "2.1.0", "Openscreen.Setup.2.1.0-arm64.exe")]
#[case("windows", "x64", "2.1.1", "Openscreen.Setup.2.1.1-x64.exe")]
#[case("windows", "arm64", "2.1.1", "Openscreen.Setup.2.1.1-arm64.exe")]
#[case("macos", "x64", "2.0.0", "Openscreen-Mac-x64-2.0.0.zip")]
#[case("macos", "arm64", "2.0.0", "Openscreen-Mac-arm64-2.0.0.zip")]
#[case("linux", "x64", "2.0.0", "Openscreen-Linux-2.0.0.AppImage")]
fn test_openscreen_selects_official_distributions(
#[case] os: &str,
#[case] arch: &str,
#[case] version: &str,
#[case] asset: &str,
) {
let url = call("openscreen", os, arch, "download_url", &[json!("2.0.0")]);
let url = call("openscreen", os, arch, "download_url", &[json!(version)]);
assert_eq!(
url,
json!(format!(
"https://github.com/getopenscreen/openscreen/releases/download/v2.0.0/{asset}"
"https://github.com/getopenscreen/openscreen/releases/download/v{version}/{asset}"
))
);
}
Expand Down Expand Up @@ -72,6 +79,8 @@ fn test_openscreen_windows_install_is_silent_and_store_scoped() {

#[rstest::rstest]
#[case("openscreen", "linux", "arm64")]
// Windows arm64 only gained an installer in 2.1.0; on 2.0.0 there is no such
// asset, so the provider must not fabricate a URL.
#[case("openscreen", "windows", "arm64")]
fn test_unsupported_distributions_are_not_fabricated(
#[case] name: &str,
Expand Down
23 changes: 21 additions & 2 deletions crates/vx-providers/openscreen/provider.star
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,33 @@ runtimes = [runtime_def("openscreen", system_paths = [
permissions = github_permissions()
fetch_versions = make_fetch_versions("getopenscreen", "openscreen", include_prereleases = False)

def _uses_arch_suffixed_installer(version):
"""Windows NSIS assets carry an architecture suffix from 2.1.0 onward.

The 2.0.x line shipped a single arch-less x64 installer
(``Openscreen.Setup.<version>.exe``); starting with 2.1.0 upstream publishes
per-architecture installers (``Openscreen.Setup.<version>-<arch>.exe``) for
both x64 and arm64. Requesting the arch-less name on 2.1.0+ returns HTTP 404.
"""
parts = version.split(".")
major = int(parts[0])
minor = int(parts[1]) if len(parts) > 1 and parts[1].isdigit() else 0
return major > 2 or (major == 2 and minor >= 1)

def download_url(ctx, version):
# The headless CLI and these package names are available from 2.0.0.
if int(version.split(".")[0]) < 2:
return None
os = ctx.platform.os
arch = ctx.platform.arch
if os == "windows" and arch == "x64":
asset = "Openscreen.Setup.{}.exe".format(version)
if os == "windows" and arch in ["x64", "arm64"]:
if _uses_arch_suffixed_installer(version):
asset = "Openscreen.Setup.{}-{}.exe".format(version, arch)
elif arch == "x64":
# 2.0.x only ever published the single arch-less x64 installer.
asset = "Openscreen.Setup.{}.exe".format(version)
else:
return None
elif os == "macos" and arch in ["x64", "arm64"]:
asset = "Openscreen-Mac-{}-{}.zip".format(arch, version)
elif os == "linux" and arch == "x64":
Expand Down
4 changes: 2 additions & 2 deletions docs/tools/openscreen.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

| Runtime | Windows | Linux | macOS |
| --- | --- | --- | --- |
| `openscreen` | Silent user installer into vx store, x64 | AppImage, x64 | App ZIP, x64 / ARM64 |
| `openscreen` | Silent user installer into vx store, x64 / ARM64 | AppImage, x64 | App ZIP, x64 / ARM64 |

```bash
vx openscreen --help
```

Official distributions and the headless help command are supported from version 2.0. Windows uses a silent per-user installer scoped to the vx store.
Official distributions and the headless help command are supported from version 2.0. Windows uses a silent per-user installer scoped to the vx store. Windows ARM64 installers are published from 2.1.0; the 2.0.x line ships a single x64 installer, so pinning `2.0.0` on ARM64 hosts is not supported.

Linux extracts the AppImage into the managed store and launches its `AppRun`, so launching does not require a FUSE mount. Extraction failures stop installation.

Expand Down
4 changes: 2 additions & 2 deletions docs/zh/tools/openscreen.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

| Runtime | Windows | Linux | macOS |
| --- | --- | --- | --- |
| `openscreen` | 静默用户安装到 vx store,x64 | AppImage, x64 | 应用 ZIP,x64 / ARM64 |
| `openscreen` | 静默用户安装到 vx store,x64 / ARM64 | AppImage, x64 | 应用 ZIP,x64 / ARM64 |

```bash
vx openscreen --help
```

从 2.0 开始支持官方发行包与无界面的帮助命令。Windows 使用静默用户安装器,安装目录限制在 vx store 内。
从 2.0 开始支持官方发行包与无界面的帮助命令。Windows 使用静默用户安装器,安装目录限制在 vx store 内。Windows ARM64 安装器自 2.1.0 起提供;2.0.x 系列仅提供 x64 安装器,因此在 ARM64 主机上固定 `2.0.0` 版本不受支持。

Linux 将 AppImage 提取到托管目录,再通过 `AppRun` 启动,无需挂载 FUSE;提取失败时安装会报错停止。

Expand Down
Loading