mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-18 19:25:56 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6723a7eda1 | ||
|
|
b65b632c63 |
No files matched your search
@@ -69,6 +69,8 @@ jobs:
|
||||
with:
|
||||
node-version: 22
|
||||
- run: npm ci
|
||||
# tauri::generate_context! needs ../dist; without a warm target cache the tests do not compile without it.
|
||||
- run: npm run build
|
||||
- name: Tests
|
||||
run: cargo test --workspace --locked -- --test-threads=1
|
||||
- run: node --experimental-strip-types --test tools/*.test.mjs
|
||||
|
||||
@@ -1332,7 +1332,11 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_detect_toolchain() {
|
||||
let tc = detect_toolchain_for(Some(Path::new("C:/games/coa-work/plugin-spike/server-v03")));
|
||||
let realm = Path::new("C:/games/coa-work/plugin-spike/server-v03");
|
||||
if !realm.join("worldserver.exe").is_file() {
|
||||
return; // needs the local spike realm and its SDK (not on CI runners)
|
||||
}
|
||||
let tc = detect_toolchain_for(Some(realm));
|
||||
assert!(tc.msvc_available, "MSVC vcvars64.bat should be detected");
|
||||
assert!(tc.cmake_available, "CMake should be detected");
|
||||
assert!(tc.ninja_available, "Ninja should be detected");
|
||||
|
||||
+4
-36
@@ -2981,27 +2981,6 @@ async fn preview_install_msvc(
|
||||
blocking(move || coa_core::msvc_setup::install_build_tools(realm_root.as_deref())).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn preview_register_test_realm(
|
||||
state: State<'_, AppState>,
|
||||
path: Option<String>,
|
||||
) -> std::result::Result<ServerSummary, UiError> {
|
||||
let target = path
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| PathBuf::from(r"C:\games\coa-work\plugin-spike\server-v03"));
|
||||
|
||||
if !target.join("worldserver.exe").is_file() && !target.join("Core/worldserver.exe").is_file() {
|
||||
return Err(UiError::from(coa_core::Error::Invalid(format!(
|
||||
"Target path '{}' does not contain a valid worldserver.exe",
|
||||
target.display()
|
||||
))));
|
||||
}
|
||||
|
||||
let id = "test-realm-v03".to_string();
|
||||
state.registry.register(&id, &target)?;
|
||||
Ok(summary(id, target))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn preview_build_module(
|
||||
app: AppHandle,
|
||||
@@ -3401,7 +3380,6 @@ pub fn run() {
|
||||
release_history,
|
||||
preview_toolchain_status,
|
||||
preview_install_msvc,
|
||||
preview_register_test_realm,
|
||||
preview_build_module,
|
||||
preview_install_module,
|
||||
preview_toggle_module,
|
||||
@@ -3579,22 +3557,12 @@ pub fn run() {
|
||||
let portable = start_portable(&dir);
|
||||
let (control, host_control) = control_cmds::start(&dir, portable.clone());
|
||||
let registry = Registry::at(dir.join("installs.json"));
|
||||
// Development only: an explicitly named test realm is registered into an empty list.
|
||||
if registry.list().map(|l| l.is_empty()).unwrap_or(true) {
|
||||
let test_realm_path = std::env::var("COA_TEST_REALM_DIR")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|_| PathBuf::from(r"C:\games\CoA Server Preview"));
|
||||
let target_realm = if test_realm_path.join("worldserver.exe").is_file() {
|
||||
Some(("preview-realm", test_realm_path))
|
||||
} else {
|
||||
let spike_path = PathBuf::from(r"C:\games\coa-work\plugin-spike\server-v03");
|
||||
if spike_path.join("worldserver.exe").is_file() {
|
||||
Some(("test-realm-v03", spike_path))
|
||||
} else {
|
||||
None
|
||||
if let Ok(path) = std::env::var("COA_TEST_REALM_DIR").map(PathBuf::from) {
|
||||
if path.join("worldserver.exe").is_file() {
|
||||
let _ = registry.register("preview-realm", &path);
|
||||
}
|
||||
};
|
||||
if let Some((name, path)) = target_realm {
|
||||
let _ = registry.register(name, &path);
|
||||
}
|
||||
}
|
||||
app.manage(AppState {
|
||||
|
||||
@@ -859,7 +859,6 @@ export const api = {
|
||||
invoke<{ ready: boolean; restart_required: boolean; message: string; toolchain: ToolchainStatus }>("preview_install_msvc", { realmId: realmId ?? null }),
|
||||
previewToolchainStatus: (realmId?: string) =>
|
||||
invoke<ToolchainStatus>("preview_toolchain_status", { realmId: realmId ?? null }),
|
||||
previewRegisterTestRealm: (path?: string) => invoke<ServerSummary>("preview_register_test_realm", { path: path ?? null }),
|
||||
previewBuildModule: (realmId: string, sourceUrlOrPath: string) =>
|
||||
invoke<BuildResult>("preview_build_module", { realmId, sourceUrlOrPath }),
|
||||
previewInstallModule: (realmId: string, moduleId: string, version: string, applySql: boolean) =>
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
Download,
|
||||
ExternalLink,
|
||||
Flame,
|
||||
FolderPlus,
|
||||
Gavel,
|
||||
GitFork,
|
||||
Hammer,
|
||||
@@ -791,25 +790,6 @@ export function ModulesPage({
|
||||
}
|
||||
}
|
||||
|
||||
async function registerTestRealm() {
|
||||
setActionInProgress("register-realm");
|
||||
setError(null);
|
||||
try {
|
||||
await api.previewRegisterTestRealm();
|
||||
setNotification(
|
||||
locale === "ru"
|
||||
? "Экспериментальный тестовый реалм server-v03 успешно зарегистрирован!"
|
||||
: "Experimental server-v03 test realm registered successfully!"
|
||||
);
|
||||
onChanged?.();
|
||||
await load();
|
||||
} catch (e) {
|
||||
setError(asUiError(e));
|
||||
} finally {
|
||||
setActionInProgress(null);
|
||||
}
|
||||
}
|
||||
|
||||
async function exportDiagnostics() {
|
||||
setActionInProgress("export-diag");
|
||||
try {
|
||||
@@ -1201,17 +1181,6 @@ export function ModulesPage({
|
||||
<Download className="mr-1.5 h-3.5 w-3.5" />
|
||||
{locale === "ru" ? "Экспорт отчёта" : "Export Diagnostics"}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={registerTestRealm}
|
||||
disabled={actionInProgress === "register-realm"}
|
||||
className="text-xs text-gold hover:text-gold"
|
||||
>
|
||||
<FolderPlus className="mr-1.5 h-3.5 w-3.5" />
|
||||
{locale === "ru" ? "Подключить test-realm-v03" : "Register test-realm-v03"}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user