refactor(macos): isolate guest-specific code and guard host imports
This commit is contained in:
1 parent
fe139def0c
commit
5e39b11566
99 files changed
+293
-109
No files matched your search
+11
-4
@@ -60,16 +60,18 @@ flowchart TB
|
||||
| `internal/runtime` | 便携运行时拉取(GitHub Releases)、原子解压、多版本切换与子进程环境变量构造 |
|
||||
| `internal/fetch` | 发布附件下载:HTTP `Range` 续传与按发布页 `SHA256SUMS.txt` 强制校验,运行时安装与应用内更新共用 |
|
||||
| `internal/selfupdate` | 应用内更新:把已校验的新版 `reims-go.exe` 换入运行中程序的位置、重新拉起与残留清理 |
|
||||
| `internal/installer` | 包装 `reims-util --json` 实现 macOS 离线安装包查询、宿主机直连下载、断点续传、互斥锁保护与缓存清理 |
|
||||
| `internal/driver/reims` | `reims-ctl` 与 `qemu-img` 受控子进程包装、输出解析、快照/派生/导入操作、日志与配置脱敏 |
|
||||
| `internal/macos/installer` | 包装 `reims-util --json` 实现 macOS 离线安装包查询、宿主机直连下载、断点续传、互斥锁保护与缓存清理 |
|
||||
| `internal/macos/reims` | `reims-ctl` 与 `qemu-img` 受控子进程包装、输出解析、快照/派生/导入操作、日志与配置脱敏 |
|
||||
| `internal/macos/macosdriver` | 把 `internal/macos/reims` 适配为通用 `driver.Driver`(内置驱动 `builtin.driver.reims-macos`) |
|
||||
| `internal/macos/installguide` | 虚拟机窗口旁的 macOS 安装与恢复分步引导(Win32 浮层) |
|
||||
| `internal/qmp` | QMP 客户端:键盘键入、截屏与 Win10 冷重启监视 |
|
||||
| `internal/guesttools` | 本地回环鉴权 HTTP/WebDAV 服务:图文双向剪贴板、共享目录、Windows 盘符只读共享、防休眠开关与 `REIMSTOOLS` 辅助盘生成 |
|
||||
| `internal/opencore` | 改写 OpenCore 镜像中的 `prev-lang:kbd`,实现系统外预设 macOS 语言 |
|
||||
| `internal/macos/opencore` | 改写 OpenCore 镜像中的 `prev-lang:kbd`,实现系统外预设 macOS 语言 |
|
||||
| `internal/netproxy` | 统一 HTTP Transport:优先环境变量代理,回退读取 Windows 系统代理配置 |
|
||||
| `locales/`、`cmd/i18ngen` | 单一事实源分域 JSON 词表(含译者上下文 `$comment` 与 Apple macOS 官方多语种词汇表)及编译期前后端字典代码生成器 |
|
||||
| `internal/config`、`internal/i18n` | 应用配置持久化(`reims-go.json`)、轻量 ICU 格式化引擎、多跳语言回退链与带稳定排障码的结构化错误(`CodedError`) |
|
||||
| `internal/thumb`、`internal/tray`、`internal/version` | 4K 截屏行级缩放预览、Windows 系统托盘常驻、版本信息与新版本检查 |
|
||||
| `frontend/src` | 桌面界面:`components/`(页面与对话框)、`ui/`(Radix 基件封装)、`lib/`(格式化、日志与任务)、`styles/`(设计令牌) |
|
||||
| `frontend/src` | 桌面界面:`components/`(页面与对话框)、`macos/`(macOS 专属页面与组件)、`ui/`(Radix 基件封装)、`lib/`(格式化、日志与任务)、`styles/`(设计令牌) |
|
||||
| `patches/` | 上游临时补丁队列与 PR 跟踪,见 [`patches/README.md`](../patches/README.md) |
|
||||
| `scripts/` | 便携运行时打包、二进制裁剪与符号分离、MSYS2 源码归档、`alpha` 准入与冒烟脚本,以及 `scripts/debug/` 本地调试目录管理与卫生校验脚本 |
|
||||
|
||||
@@ -115,6 +117,11 @@ flowchart TB
|
||||
- 只有删除很老的迁移步骤之后,才需要「最低迁移版本」:新版本根据 `data_version` 判断,并提示先安装某个中间版本。这个判断看的是数据本身,所以直接下载新版本运行也会生效。
|
||||
- 现有步骤:v1 为 reims-ctl 管理的每台 VM(目录含 `vm.toml`)补写驱动归属标记,见 [plugin-architecture.md](plugin-architecture.md) 的「VM 归属」。
|
||||
|
||||
### 4.8 macOS 代码边界
|
||||
- macOS 专属代码集中在 `internal/macos/` 与 `frontend/src/macos/`,最终作为独立插件移出本仓库;宿主只应经驱动层(`driver.Router`)与宿主服务使用它。
|
||||
- 两处棘轮测试守住边界:`internal/archtest` 检查 Go 包,`frontend/scripts/test-macos-boundary.mjs` 检查前端文件。宿主代码只有列入例外清单的包或文件可以引用 macOS 代码;新增引用、或清单中的条目已不再引用时,测试都会失败,所以清单只能缩短。
|
||||
- 清单中每一项都注明原因,现阶段包括 GUI 与 CLI 的组装入口、注册内置 macOS 插件的 `internal/plugin/builtin`,以及仍混有宿主与 macOS 逻辑、待拆分的 `internal/vmstart` 与 `internal/guesttools`。
|
||||
|
||||
---
|
||||
|
||||
## 5. 与上游 `reims-vgpu` 的边界
|
||||
|
||||
@@ -228,7 +228,7 @@ UI 槽位采用「声明即占有」:宿主预定义 `vm.toolbar`、`vm.card`
|
||||
|
||||
### 5.3 非 macOS 虚拟机(客体驱动,L3)
|
||||
|
||||
**驱动抽象**:当前 `internal/app`、`internal/vmstart`、`internal/cli` 直接依赖 `internal/driver/reims` 的具体类型。抽象后:
|
||||
**驱动抽象**:当前 `internal/app`、`internal/vmstart`、`internal/cli` 直接依赖 `internal/macos/reims` 的具体类型。抽象后:
|
||||
|
||||
| 层 | 内容 |
|
||||
| :--- | :--- |
|
||||
@@ -269,8 +269,8 @@ UI 槽位采用「声明即占有」:宿主预定义 `vm.toolbar`、`vm.card`
|
||||
| :--- | :--- | :--- |
|
||||
| `builtin.bridge.guest-tools` | `internal/guesttools`、`guesttools_flow.go` | 提供传输服务 + `vm.beforeStart`(注入桥接参数与环境变量)+ `vm.afterStart` + `vm.card`;共享文件夹、盘符共享、防休眠逐步拆为功能扩展 |
|
||||
| `builtin.input` | `host/ime_hook_windows.go` | 提供输入服务与 `inputFilters`;IME 桥成为其上的功能,停用时卸载钩子线程 |
|
||||
| `builtin.install-guide` | `internal/installguide`、`internal/app/install_guide.go` | 提供 `ui.install-guide` 服务 + `vm.afterStop` / `vm.deleted` 观察钩子;在虚拟机窗口悬浮展示安装与恢复引导,停用时立即关闭全部浮层并回退主界面恢复卡片 |
|
||||
| `builtin.core`(系统插件) | `driver/reims_adapter.go`、`vmstart.Prepare` 各步骤、`app.go` 冷重启监视 | `guestDrivers` + `themes` + `host.preflight` + 一个按序执行全部启动准备的 `vm.beforeStart`(离线辅助盘 → 恢复模式引导 → 引导语言 → WHPX 降级 → Win10 冷重启)+ `vm.afterStart` / `vm.afterStop`(冷重启监视);设置 `whpx_fallback`、`win10_cold_reboot` |
|
||||
| `builtin.install-guide` | `internal/macos/installguide`、`internal/app/install_guide.go` | 提供 `ui.install-guide` 服务 + `vm.afterStop` / `vm.deleted` 观察钩子;在虚拟机窗口悬浮展示安装与恢复引导,停用时立即关闭全部浮层并回退主界面恢复卡片 |
|
||||
| `builtin.core`(系统插件) | `macos/macosdriver`、`vmstart.Prepare` 各步骤、`app.go` 冷重启监视 | `guestDrivers` + `themes` + `host.preflight` + 一个按序执行全部启动准备的 `vm.beforeStart`(离线辅助盘 → 恢复模式引导 → 引导语言 → WHPX 降级 → Win10 冷重启)+ `vm.afterStart` / `vm.afterStop`(冷重启监视);设置 `whpx_fallback`、`win10_cold_reboot` |
|
||||
|
||||
### 5.5 与上游补丁队列的边界
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"test": "node --test scripts/test-i18n.mjs",
|
||||
"test": "node --test scripts/test-i18n.mjs scripts/test-macos-boundary.mjs",
|
||||
"build": "tsc --noEmit && vite build && node scripts/check-ui-contract.mjs",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
// macOS UI lives under src/macos so it can leave the app as a plugin. Host
|
||||
// files may import from it only while listed below; the test fails when a new
|
||||
// file starts importing it and when a listed file stops, so the list only
|
||||
// shrinks (same ratchet as internal/archtest on the Go side).
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import ts from 'typescript'
|
||||
|
||||
const srcDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'src')
|
||||
const macosDir = path.join(srcDir, 'macos')
|
||||
|
||||
const MACOS_IMPORTERS = {
|
||||
'App.tsx': 'mounts the installers page and online-recovery dialog; macOS release names in the VM list',
|
||||
'components/Sidebar.tsx': 'macOS version art next to each VM',
|
||||
'components/VMPage.tsx': 'macOS version art in the VM header',
|
||||
}
|
||||
|
||||
function walk(dir) {
|
||||
const out = []
|
||||
for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
|
||||
const p = path.join(dir, e.name)
|
||||
if (e.isDirectory()) {
|
||||
if (p !== macosDir) out.push(...walk(p))
|
||||
} else if (/\.(?:[cm]?[jt]s|[jt]sx)$/.test(e.name)) {
|
||||
out.push(p)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
test('host frontend reaches src/macos only from listed files', () => {
|
||||
const importers = new Set()
|
||||
for (const file of walk(srcDir)) {
|
||||
const text = fs.readFileSync(file, 'utf8')
|
||||
for (const { fileName } of ts.preProcessFile(text, true, true).importedFiles) {
|
||||
let target
|
||||
if (fileName.startsWith('.')) target = path.resolve(path.dirname(file), fileName)
|
||||
else if (fileName.startsWith('/src/')) target = path.resolve(srcDir, fileName.slice(5))
|
||||
else continue
|
||||
if (target === macosDir || target.startsWith(macosDir + path.sep)) {
|
||||
importers.add(path.relative(srcDir, file).split(path.sep).join('/'))
|
||||
}
|
||||
}
|
||||
}
|
||||
const unexpected = [...importers].filter((f) => !(f in MACOS_IMPORTERS)).sort()
|
||||
const stale = Object.keys(MACOS_IMPORTERS).filter((f) => !importers.has(f)).sort()
|
||||
assert.deepEqual(unexpected, [], `host files import src/macos without being listed in MACOS_IMPORTERS: ${unexpected.join(', ')}`)
|
||||
assert.deepEqual(stale, [], `listed files no longer import src/macos; remove them from MACOS_IMPORTERS: ${stale.join(', ')}`)
|
||||
})
|
||||
@@ -3,7 +3,7 @@ import React, { Suspense, lazy, useCallback, useEffect, useRef, useState } from
|
||||
import type { WizardDraft } from './components/CreateWizard'
|
||||
import { DeleteDialog } from './components/DeleteDialog'
|
||||
import { CloneDialog } from './components/CloneDialog'
|
||||
import { OnlineRecoveryDialog } from './components/OnlineRecoveryDialog'
|
||||
import { OnlineRecoveryDialog } from './macos/OnlineRecoveryDialog'
|
||||
import { SendTextDialog } from './components/SendTextDialog'
|
||||
import type { ThemeMode } from './components/AppSettingsPage'
|
||||
import { LogPanel, LogTab } from './components/LogPanel'
|
||||
@@ -14,7 +14,7 @@ import { VMAction, VMPage } from './components/VMPage'
|
||||
import { buildFallbackChain, I18nKey, localeDir, parseAppError, resolveActiveLocale, setPluginLocales, t } from './i18n'
|
||||
import { defaultGuestLang, recommendedMemoryGB, recommendedResolution } from './lib/format'
|
||||
import { LogLine, appendLog } from './lib/logs'
|
||||
import { macOSMajor } from './lib/macosRelease'
|
||||
import { macOSMajor } from './macos/macosRelease'
|
||||
import { currentTask, finishedTaskTTL, isActiveInstallerTask, pruneFinishedTasks, upsertTask } from './lib/tasks'
|
||||
import { applyActiveLocaleFonts, applyActiveTheme, disposeActiveThemeAndLocaleFonts, notifyInteractiveThemeState, type UIStateSnapshot } from './lib/themeEngine'
|
||||
import { latestVMStats, refreshSubscribedVMStats, refreshVMStats } from './lib/vmStats'
|
||||
@@ -32,7 +32,7 @@ const SettingsModal = lazy(() => import('./components/SettingsModal').then((m) =
|
||||
const AffinityDialog = lazy(() => import('./components/AffinityDialog').then((m) => ({ default: m.AffinityDialog })))
|
||||
const Setup = lazy(() => import('./components/Setup').then((m) => ({ default: m.Setup })))
|
||||
const HostView = lazy(() => import('./components/HostView').then((m) => ({ default: m.HostView })))
|
||||
const InstallersPage = lazy(() => import('./components/InstallersPage').then((m) => ({ default: m.InstallersPage })))
|
||||
const InstallersPage = lazy(() => import('./macos/InstallersPage').then((m) => ({ default: m.InstallersPage })))
|
||||
const PluginsPage = lazy(() => import('./components/PluginsPage').then((m) => ({ default: m.PluginsPage })))
|
||||
const AppSettingsPage = lazy(() => import('./components/AppSettingsPage').then((m) => ({ default: m.AppSettingsPage })))
|
||||
const AboutPage = lazy(() => import('./components/AboutPage').then((m) => ({ default: m.AboutPage })))
|
||||
|
||||
@@ -58,7 +58,7 @@ interface Props {
|
||||
|
||||
const REVIEW_STEP = 5
|
||||
|
||||
// Which wizard step owns each ValidationIssue.field (internal/driver/reims/reims.go ValidateCreate).
|
||||
// Which wizard step owns each ValidationIssue.field (internal/macos/reims/reims.go ValidateCreate).
|
||||
const STEP_OF_FIELD: Record<string, number> = {
|
||||
installer: 1, disk: 1, macos: 1, guest_lang: 1,
|
||||
cpus: 2, memory: 2,
|
||||
|
||||
@@ -4,7 +4,7 @@ import React, { useRef } from 'react'
|
||||
import { I18nKey, t } from '../i18n'
|
||||
import { Locale, VMListItem } from '../types'
|
||||
import { IconButton, StatusShape, Tip, statusKind } from '../ui/controls'
|
||||
import { VersionArt } from './VersionArt'
|
||||
import { VersionArt } from '../macos/VersionArt'
|
||||
import { VMAction } from './VMPage'
|
||||
|
||||
export const HOST_ID = '__host__'
|
||||
|
||||
@@ -51,7 +51,7 @@ import { DiskSnapshot, HostReport, Locale, PendingChange, PluginUIContributions,
|
||||
import { api } from '../wails'
|
||||
import { Button, IconButton, StatusShape, Tip, statusKind } from '../ui/controls'
|
||||
import { Switch } from '../ui/settings'
|
||||
import { VersionArt } from './VersionArt'
|
||||
import { VersionArt } from '../macos/VersionArt'
|
||||
|
||||
export type VMAction =
|
||||
| 'start'
|
||||
|
||||
@@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react'
|
||||
import '../i18n/domains/settings.gen'
|
||||
import '../i18n/domains/wizard.gen'
|
||||
import { I18nKey, t } from '../i18n'
|
||||
import { macOSMajor } from '../lib/macosRelease'
|
||||
import { macOSMajor } from './macosRelease'
|
||||
import {
|
||||
ActiveInstallerMatch,
|
||||
findActiveCachedTask,
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/vmstart"
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/vmstart"
|
||||
)
|
||||
|
||||
|
||||
+4
-3
@@ -15,11 +15,12 @@ import (
|
||||
"github.com/Nwflower/reims-go/internal/cli"
|
||||
"github.com/Nwflower/reims-go/internal/config"
|
||||
"github.com/Nwflower/reims-go/internal/driver"
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/guesttools"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/installguide"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installguide"
|
||||
"github.com/Nwflower/reims-go/internal/macos/macosdriver"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/plugin"
|
||||
"github.com/Nwflower/reims-go/internal/plugin/builtin"
|
||||
"github.com/Nwflower/reims-go/internal/qmp"
|
||||
@@ -1357,7 +1358,7 @@ func (a *App) StartVM(name string) error {
|
||||
RuntimeKind: prep.Runtime.Manifest.EffectiveKind(),
|
||||
RuntimeCaps: rtCaps,
|
||||
HostFacts: buildHostFacts(rep, rtCaps),
|
||||
VMCaps: driver.ReimsMacOSCapabilities,
|
||||
VMCaps: macosdriver.ReimsMacOSCapabilities,
|
||||
State: curDetail.State,
|
||||
})
|
||||
if blockErr != nil {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
)
|
||||
|
||||
func TestPolledVMsReusesFreshPoll(t *testing.T) {
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
"github.com/Nwflower/reims-go/internal/cli"
|
||||
"github.com/Nwflower/reims-go/internal/fetch"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installer"
|
||||
"github.com/Nwflower/reims-go/internal/netproxy"
|
||||
"github.com/Nwflower/reims-go/internal/selfupdate"
|
||||
"github.com/Nwflower/reims-go/internal/version"
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
rt "github.com/Nwflower/reims-go/internal/runtime"
|
||||
"github.com/Nwflower/reims-go/internal/vmstart"
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
"github.com/Nwflower/reims-go/internal/opencore"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/opencore"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
rt "github.com/Nwflower/reims-go/internal/runtime"
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/plugin"
|
||||
rt "github.com/Nwflower/reims-go/internal/runtime"
|
||||
)
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
)
|
||||
|
||||
func TestWriteDiagnosticsZipRedactsSensitiveData(t *testing.T) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
rt "github.com/Nwflower/reims-go/internal/runtime"
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installer"
|
||||
)
|
||||
|
||||
const vmNoteFileName = ".reims-go-note"
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
)
|
||||
|
||||
func TestParseDiskSnapshotsJSON(t *testing.T) {
|
||||
|
||||
@@ -10,10 +10,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/guesttools"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/plugin/builtin"
|
||||
"github.com/Nwflower/reims-go/internal/vmstart"
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/vmstart"
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
|
||||
@@ -3,9 +3,9 @@ package app
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/installguide"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installguide"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/plugin/builtin"
|
||||
"github.com/Nwflower/reims-go/internal/vmstart"
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/config"
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/installguide"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installguide"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/plugin"
|
||||
"github.com/Nwflower/reims-go/internal/plugin/builtin"
|
||||
"github.com/Nwflower/reims-go/internal/vmstart"
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installer"
|
||||
rt "github.com/Nwflower/reims-go/internal/runtime"
|
||||
)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installer"
|
||||
)
|
||||
|
||||
type installerDownloadFunc func(ctx context.Context, onUpdate func(installer.Update)) (*installer.Result, error)
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
)
|
||||
|
||||
func newTestCoordinator(t *testing.T) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/plugin"
|
||||
"github.com/Nwflower/reims-go/internal/plugin/builtin"
|
||||
"github.com/Nwflower/reims-go/internal/qmp"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/opencore"
|
||||
"github.com/Nwflower/reims-go/internal/macos/opencore"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/vmstart"
|
||||
)
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@ import (
|
||||
"github.com/Nwflower/reims-go/internal/config"
|
||||
"github.com/Nwflower/reims-go/internal/datamigrate"
|
||||
"github.com/Nwflower/reims-go/internal/driver"
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/guesttools"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/plugin"
|
||||
"github.com/Nwflower/reims-go/internal/plugin/builtin"
|
||||
rt "github.com/Nwflower/reims-go/internal/runtime"
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/config"
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installer"
|
||||
rt "github.com/Nwflower/reims-go/internal/runtime"
|
||||
"github.com/Nwflower/reims-go/internal/version"
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
rt "github.com/Nwflower/reims-go/internal/runtime"
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
)
|
||||
|
||||
// VMStats provides lightweight real-time resource telemetry for the VM detail header.
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installer"
|
||||
"github.com/Nwflower/reims-go/internal/vmstart"
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installer"
|
||||
)
|
||||
|
||||
func newTestTasks(t *testing.T) *[]Task {
|
||||
|
||||
@@ -17,10 +17,10 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/guesttools"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/qmp"
|
||||
"github.com/Nwflower/reims-go/internal/thumb"
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"slices"
|
||||
"testing"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
)
|
||||
|
||||
func TestReleaseVMThumbnailRemovesLock(t *testing.T) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/vmstart"
|
||||
)
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
)
|
||||
|
||||
func TestLogTailDiscardsOversizeLinesAndResumes(t *testing.T) {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
// Package archtest holds repository-wide architecture checks. It has no
|
||||
// runtime code; see the tests.
|
||||
package archtest
|
||||
@@ -0,0 +1,119 @@
|
||||
package archtest
|
||||
|
||||
import (
|
||||
"go/parser"
|
||||
"go/token"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
const macosImportPrefix = "github.com/Nwflower/reims-go/internal/macos"
|
||||
|
||||
// macosImporter is a package outside internal/macos that may still import
|
||||
// macOS code: debt to pay down before macOS leaves this repository.
|
||||
type macosImporter struct {
|
||||
src, test bool // which of its files may import internal/macos
|
||||
why string
|
||||
}
|
||||
|
||||
// macosImporters is the ratchet. The test fails when a package not listed
|
||||
// here starts importing internal/macos, and when a listed package (or its
|
||||
// source or test files) stops, so the list can only shrink.
|
||||
var macosImporters = map[string]macosImporter{
|
||||
"internal/app": {src: true, test: true, why: "GUI composition root; VM flows still call the reims client directly instead of driver.Router"},
|
||||
"internal/cli": {src: true, why: "CLI composition root; vm subcommands call the reims client directly"},
|
||||
"internal/plugin/builtin": {src: true, test: true, why: "registers the macOS driver, install guide and start hooks as builtin plugins"},
|
||||
"internal/vmstart": {src: true, why: "mixed: host CPU pinning and memory checks next to reims start preparation"},
|
||||
"internal/guesttools": {src: true, test: true, why: "mixed: host transport and clipboard next to the macOS guest agent image"},
|
||||
"internal/plugin": {test: true, why: "sidecar manager test builds a reims-ctl stand-in"},
|
||||
}
|
||||
|
||||
func TestMacOSBoundary(t *testing.T) {
|
||||
root, err := filepath.Abs(filepath.Join("..", ".."))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
type use struct{ src, test []string }
|
||||
found := map[string]*use{}
|
||||
|
||||
skipDirs := map[string]bool{".git": true, ".debug": true, "build": true, "frontend": true, "node_modules": true}
|
||||
err = filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rel, _ := filepath.Rel(root, path)
|
||||
rel = filepath.ToSlash(rel)
|
||||
if d.IsDir() {
|
||||
if skipDirs[d.Name()] || rel == "internal/macos" {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if !strings.HasSuffix(path, ".go") {
|
||||
return nil
|
||||
}
|
||||
f, err := parser.ParseFile(token.NewFileSet(), path, nil, parser.ImportsOnly)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, imp := range f.Imports {
|
||||
p, _ := strconv.Unquote(imp.Path.Value)
|
||||
if p != macosImportPrefix && !strings.HasPrefix(p, macosImportPrefix+"/") {
|
||||
continue
|
||||
}
|
||||
dir := filepath.ToSlash(filepath.Dir(rel))
|
||||
u := found[dir]
|
||||
if u == nil {
|
||||
u = &use{}
|
||||
found[dir] = u
|
||||
}
|
||||
if strings.HasSuffix(path, "_test.go") {
|
||||
u.test = append(u.test, rel)
|
||||
} else {
|
||||
u.src = append(u.src, rel)
|
||||
}
|
||||
break
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
var problems []string
|
||||
for dir, u := range found {
|
||||
allowed := macosImporters[dir]
|
||||
if len(u.src) > 0 && !allowed.src {
|
||||
problems = append(problems, "host code imports internal/macos (go through the driver layer or a host service instead): "+strings.Join(u.src, ", "))
|
||||
}
|
||||
if len(u.test) > 0 && !allowed.test {
|
||||
problems = append(problems, "host tests import internal/macos: "+strings.Join(u.test, ", "))
|
||||
}
|
||||
}
|
||||
for dir, allowed := range macosImporters {
|
||||
u := found[dir]
|
||||
if allowed.src && (u == nil || len(u.src) == 0) {
|
||||
problems = append(problems, dir+" no longer imports internal/macos from source files: set src to false (or drop the entry) in macosImporters")
|
||||
}
|
||||
if allowed.test && (u == nil || len(u.test) == 0) {
|
||||
problems = append(problems, dir+" no longer imports internal/macos from tests: set test to false (or drop the entry) in macosImporters")
|
||||
}
|
||||
}
|
||||
sort.Strings(problems)
|
||||
for _, p := range problems {
|
||||
t.Error(p)
|
||||
}
|
||||
}
|
||||
|
||||
// The ratchet only means something if internal/macos exists where the test
|
||||
// looks; guard against the walk silently finding nothing after a move.
|
||||
func TestMacOSBoundaryRootExists(t *testing.T) {
|
||||
if st, err := os.Stat(filepath.Join("..", "macos")); err != nil || !st.IsDir() {
|
||||
t.Fatalf("internal/macos not found next to internal/archtest: %v", err)
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -14,11 +14,11 @@ import (
|
||||
"github.com/Nwflower/reims-go/internal/config"
|
||||
"github.com/Nwflower/reims-go/internal/datamigrate"
|
||||
"github.com/Nwflower/reims-go/internal/driver"
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
"github.com/Nwflower/reims-go/internal/opencore"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/opencore"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/plugin"
|
||||
"github.com/Nwflower/reims-go/internal/qmp"
|
||||
rt "github.com/Nwflower/reims-go/internal/runtime"
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/config"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installer"
|
||||
rt "github.com/Nwflower/reims-go/internal/runtime"
|
||||
)
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/config"
|
||||
"github.com/Nwflower/reims-go/internal/driver"
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/plugin"
|
||||
"github.com/Nwflower/reims-go/internal/plugin/builtin"
|
||||
"github.com/Nwflower/reims-go/internal/version"
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/config"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installer"
|
||||
rt "github.com/Nwflower/reims-go/internal/runtime"
|
||||
)
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installer"
|
||||
)
|
||||
|
||||
type memClipboard struct {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installer"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
-2
@@ -245,8 +245,8 @@ func TestOverlayOfficialZhTWAndJaJPLanguagePacksFit(t *testing.T) {
|
||||
return m
|
||||
}
|
||||
|
||||
twDir := filepath.Join("..", "plugin", "testdata", "official.lang.zh-tw", "locales")
|
||||
jaDir := filepath.Join("..", "plugin", "testdata", "official.lang.ja-jp", "locales")
|
||||
twDir := filepath.Join("..", "..", "plugin", "testdata", "official.lang.zh-tw", "locales")
|
||||
jaDir := filepath.Join("..", "..", "plugin", "testdata", "official.lang.ja-jp", "locales")
|
||||
i18n.SetPluginCatalogs(map[i18n.Locale]i18n.PluginCatalog{
|
||||
"zh-TW": {
|
||||
Fallback: i18n.ZhCN,
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,4 +1,4 @@
|
||||
package driver
|
||||
package macosdriver
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -7,26 +7,27 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/config"
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/driver"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/plugin"
|
||||
rt "github.com/Nwflower/reims-go/internal/runtime"
|
||||
)
|
||||
|
||||
// ReimsMacOSCapabilities lists all capabilities supported by builtin.driver.reims-macos.
|
||||
var ReimsMacOSCapabilities = []string{
|
||||
CapSnapshot,
|
||||
CapCowClone,
|
||||
CapResize,
|
||||
CapQMP,
|
||||
CapSSH,
|
||||
CapGuestTools,
|
||||
CapAffinity,
|
||||
CapOpenCore,
|
||||
CapRecovery,
|
||||
driver.CapSnapshot,
|
||||
driver.CapCowClone,
|
||||
driver.CapResize,
|
||||
driver.CapQMP,
|
||||
driver.CapSSH,
|
||||
driver.CapGuestTools,
|
||||
driver.CapAffinity,
|
||||
driver.CapOpenCore,
|
||||
driver.CapRecovery,
|
||||
}
|
||||
|
||||
// ReimsMacOSDriver adapts internal/driver/reims into the generic Driver interface
|
||||
// ReimsMacOSDriver adapts internal/macos/reims into the generic driver.Driver interface
|
||||
// as the compiled-in `builtin.driver.reims-macos` extension (§3.2, §5.3).
|
||||
type ReimsMacOSDriver struct {
|
||||
getConfig func() config.Config
|
||||
@@ -37,7 +38,7 @@ func NewReimsMacOSDriver(getConfig func() config.Config) *ReimsMacOSDriver {
|
||||
return &ReimsMacOSDriver{getConfig: getConfig}
|
||||
}
|
||||
|
||||
func (d *ReimsMacOSDriver) ID() string { return BuiltinReimsMacOSDriverID }
|
||||
func (d *ReimsMacOSDriver) ID() string { return driver.BuiltinReimsMacOSDriverID }
|
||||
|
||||
func (d *ReimsMacOSDriver) DisplayName() plugin.LocalizedText {
|
||||
return plugin.LocalizedText{ZhCN: "macOS (Reims vGPU)", EnUS: "macOS (Reims vGPU)"}
|
||||
@@ -67,7 +68,7 @@ func (d *ReimsMacOSDriver) client() (*reims.Client, error) {
|
||||
return reims.NewClient(&cfg, *active), nil
|
||||
}
|
||||
|
||||
func (d *ReimsMacOSDriver) List(ctx context.Context) ([]VMInfo, error) {
|
||||
func (d *ReimsMacOSDriver) List(ctx context.Context) ([]driver.VMInfo, error) {
|
||||
c, err := d.client()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -76,9 +77,9 @@ func (d *ReimsMacOSDriver) List(ctx context.Context) ([]VMInfo, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out := make([]VMInfo, 0, len(items))
|
||||
out := make([]driver.VMInfo, 0, len(items))
|
||||
for _, it := range items {
|
||||
out = append(out, VMInfo{
|
||||
out = append(out, driver.VMInfo{
|
||||
Name: it.Name,
|
||||
DriverID: d.ID(),
|
||||
DriverName: "macOS (Reims vGPU)",
|
||||
@@ -90,19 +91,19 @@ func (d *ReimsMacOSDriver) List(ctx context.Context) ([]VMInfo, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (d *ReimsMacOSDriver) Show(ctx context.Context, name string) (VMInfo, error) {
|
||||
func (d *ReimsMacOSDriver) Show(ctx context.Context, name string) (driver.VMInfo, error) {
|
||||
c, err := d.client()
|
||||
if err != nil {
|
||||
return VMInfo{}, err
|
||||
return driver.VMInfo{}, err
|
||||
}
|
||||
det, err := c.Show(ctx, name)
|
||||
if err != nil {
|
||||
return VMInfo{}, err
|
||||
return driver.VMInfo{}, err
|
||||
}
|
||||
rawBytes, _ := json.Marshal(det)
|
||||
var data map[string]any
|
||||
_ = json.Unmarshal(rawBytes, &data)
|
||||
return VMInfo{
|
||||
return driver.VMInfo{
|
||||
Name: det.Name,
|
||||
DriverID: d.ID(),
|
||||
DriverName: "macOS (Reims vGPU)",
|
||||
@@ -116,10 +117,10 @@ func (d *ReimsMacOSDriver) Show(ctx context.Context, name string) (VMInfo, error
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (d *ReimsMacOSDriver) ValidateCreate(_ context.Context, req CreateRequest) []ValidationIssue {
|
||||
func (d *ReimsMacOSDriver) ValidateCreate(_ context.Context, req driver.CreateRequest) []driver.ValidationIssue {
|
||||
var opts reims.CreateOpts
|
||||
if err := decodeMap(req.Options, &opts); err != nil {
|
||||
return []ValidationIssue{{Field: "options", Message: err.Error()}}
|
||||
return []driver.ValidationIssue{{Field: "options", Message: err.Error()}}
|
||||
}
|
||||
if opts.Name == "" {
|
||||
opts.Name = req.Name
|
||||
@@ -130,14 +131,14 @@ func (d *ReimsMacOSDriver) ValidateCreate(_ context.Context, req CreateRequest)
|
||||
cfg := d.getConfig()
|
||||
rep := host.Inspect(cfg.DataRoot)
|
||||
issues := reims.ValidateCreateLocalized(opts, rep, cfg.Locale)
|
||||
out := make([]ValidationIssue, 0, len(issues))
|
||||
out := make([]driver.ValidationIssue, 0, len(issues))
|
||||
for _, is := range issues {
|
||||
out = append(out, ValidationIssue{Field: is.Field, Message: is.Message})
|
||||
out = append(out, driver.ValidationIssue{Field: is.Field, Message: is.Message})
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func (d *ReimsMacOSDriver) Create(ctx context.Context, req CreateRequest, stdout, stderr io.Writer) error {
|
||||
func (d *ReimsMacOSDriver) Create(ctx context.Context, req driver.CreateRequest, stdout, stderr io.Writer) error {
|
||||
c, err := d.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -155,10 +156,10 @@ func (d *ReimsMacOSDriver) Create(ctx context.Context, req CreateRequest, stdout
|
||||
return c.Create(ctx, opts, stdout, stderr)
|
||||
}
|
||||
|
||||
func (d *ReimsMacOSDriver) ValidateSet(ctx context.Context, req SetRequest) []ValidationIssue {
|
||||
func (d *ReimsMacOSDriver) ValidateSet(ctx context.Context, req driver.SetRequest) []driver.ValidationIssue {
|
||||
var opts reims.SetOpts
|
||||
if err := decodeMap(req.Changes, &opts); err != nil {
|
||||
return []ValidationIssue{{Field: "changes", Message: err.Error()}}
|
||||
return []driver.ValidationIssue{{Field: "changes", Message: err.Error()}}
|
||||
}
|
||||
opts.Name = req.Name
|
||||
var cur reims.VMDetail
|
||||
@@ -170,14 +171,14 @@ func (d *ReimsMacOSDriver) ValidateSet(ctx context.Context, req SetRequest) []Va
|
||||
cfg := d.getConfig()
|
||||
rep := host.Inspect(cfg.DataRoot)
|
||||
issues := reims.ValidateSetLocalized(opts, cur, rep, cfg.Locale)
|
||||
out := make([]ValidationIssue, 0, len(issues))
|
||||
out := make([]driver.ValidationIssue, 0, len(issues))
|
||||
for _, is := range issues {
|
||||
out = append(out, ValidationIssue{Field: is.Field, Message: is.Message})
|
||||
out = append(out, driver.ValidationIssue{Field: is.Field, Message: is.Message})
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func (d *ReimsMacOSDriver) Set(ctx context.Context, req SetRequest, stdout, stderr io.Writer) error {
|
||||
func (d *ReimsMacOSDriver) Set(ctx context.Context, req driver.SetRequest, stdout, stderr io.Writer) error {
|
||||
c, err := d.client()
|
||||
if err != nil {
|
||||
return err
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -15,7 +15,7 @@ import (
|
||||
"github.com/Nwflower/reims-go/internal/config"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/opencore"
|
||||
"github.com/Nwflower/reims-go/internal/macos/opencore"
|
||||
rt "github.com/Nwflower/reims-go/internal/runtime"
|
||||
)
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -12,9 +12,9 @@ import (
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/config"
|
||||
"github.com/Nwflower/reims-go/internal/driver"
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/guesttools"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/plugin"
|
||||
"github.com/Nwflower/reims-go/internal/version"
|
||||
)
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/Nwflower/reims-go/internal/config"
|
||||
"github.com/Nwflower/reims-go/internal/guesttools"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
"github.com/Nwflower/reims-go/internal/installguide"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installguide"
|
||||
"github.com/Nwflower/reims-go/internal/plugin"
|
||||
)
|
||||
|
||||
|
||||
@@ -7,10 +7,11 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver"
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
"github.com/Nwflower/reims-go/internal/opencore"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/macosdriver"
|
||||
"github.com/Nwflower/reims-go/internal/macos/opencore"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/plugin"
|
||||
"github.com/Nwflower/reims-go/internal/qmp"
|
||||
rt "github.com/Nwflower/reims-go/internal/runtime"
|
||||
@@ -177,7 +178,7 @@ func defCore(ver string, cb HostCallbacks) plugin.PluginDef {
|
||||
Trust: plugin.TrustOfficial,
|
||||
System: true,
|
||||
Activate: func(_ context.Context, sc *plugin.Scope) error {
|
||||
drv := driver.NewReimsMacOSDriver(cb.GetConfig)
|
||||
drv := macosdriver.NewReimsMacOSDriver(cb.GetConfig)
|
||||
sc.Registry().RegisterGuestDriver(sc, IDDriverReimsMacOS, drv)
|
||||
|
||||
hooks := sc.Registry().Hooks()
|
||||
|
||||
@@ -3,7 +3,7 @@ package builtin
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/installguide"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installguide"
|
||||
"github.com/Nwflower/reims-go/internal/plugin"
|
||||
)
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/driver"
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
"github.com/Nwflower/reims-go/internal/plugin"
|
||||
"github.com/Nwflower/reims-go/pkg/pluginsdk"
|
||||
)
|
||||
|
||||
@@ -19,11 +19,11 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/Nwflower/reims-go/internal/config"
|
||||
"github.com/Nwflower/reims-go/internal/driver/reims"
|
||||
"github.com/Nwflower/reims-go/internal/host"
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
"github.com/Nwflower/reims-go/internal/opencore"
|
||||
"github.com/Nwflower/reims-go/internal/macos/installer"
|
||||
"github.com/Nwflower/reims-go/internal/macos/opencore"
|
||||
"github.com/Nwflower/reims-go/internal/macos/reims"
|
||||
rt "github.com/Nwflower/reims-go/internal/runtime"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@
|
||||
| `#123` 窗口体验 | `Ctrl+Alt+Enter` 运行中热切全屏 | 同步界面快捷键提示 |
|
||||
| `#172` 窗口体验 | Windows 拖动窗口动态贴合,消除缩放黑边 | 验证多显示器与高 DPI 缩放 |
|
||||
| `Win → Command` | 自由指针模式下 Windows 键映射 macOS Command | 合入后移除前端相关提示 |
|
||||
| `reims-util` 语言参数 | 支持 `opencore --lang` 并在重建 OpenCore 时保留 `prev-lang:kbd` | 合入后可逐步简化本仓 `internal/opencore` 补丁重写 |
|
||||
| `reims-util` 语言参数 | 支持 `opencore --lang` 并在重建 OpenCore 时保留 `prev-lang:kbd` | 合入后可逐步简化本仓 `internal/macos/opencore` 补丁重写 |
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in new issue
Block a user