Prepare Linux builds and validate native desktop runtime
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import { cp, mkdir, access } from 'node:fs/promises';
|
||||
import { resolve, dirname } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { packageTarget } from './package-target.mjs';
|
||||
import { stageRuntime } from './stage-runtime.mjs';
|
||||
const project = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
||||
const host = resolve(process.env.RUNESTONE_ROOT || resolve(project, '..'));
|
||||
const source = resolve(project, `dist/RuneStone-Browser-${process.platform}-${process.arch}`);
|
||||
await access(resolve(source, process.platform === 'win32' ? 'RuneStone-Browser.exe' : 'RuneStone-Browser'));
|
||||
const destination = resolve(host, 'src-tauri/browser-engine');
|
||||
await mkdir(destination, { recursive: true });
|
||||
await cp(source, destination, { recursive: true });
|
||||
const target = packageTarget(process.argv.slice(2));
|
||||
if (target.platform !== process.platform || target.arch !== process.arch) {
|
||||
throw new Error('Stage the Browser runtime on the same platform and architecture as the native host build.');
|
||||
}
|
||||
const { destination, backup } = await stageRuntime({ project, host, ...target });
|
||||
console.log(`Browser runtime staged in ${destination}`);
|
||||
if (backup) console.log(`Previous runtime retained in ${backup}`);
|
||||
|
||||
Reference in New Issue
Block a user