Prepare Linux builds and validate native desktop runtime
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
const supported = { platform: ['win32', 'linux'], arch: ['x64', 'arm64'] };
|
||||
|
||||
export function packageTarget(args, defaults = process) {
|
||||
const target = { platform: defaults.platform, arch: defaults.arch };
|
||||
const seen = new Set();
|
||||
for (const argument of args) {
|
||||
const match = /^--(platform|arch)=(.+)$/.exec(argument);
|
||||
if (!match || !supported[match[1]].includes(match[2]) || seen.has(match[1])) {
|
||||
throw new Error('Use --platform=win32|linux and --arch=x64|arm64, at most once each.');
|
||||
}
|
||||
seen.add(match[1]);
|
||||
target[match[1]] = match[2];
|
||||
}
|
||||
for (const key of Object.keys(supported)) {
|
||||
// Preserve Electron's native macOS packaging default; explicit cross-build
|
||||
// options remain the Windows/Linux targets supported by this project.
|
||||
if (key === 'platform' && target.platform === 'darwin' && !seen.has('platform')) continue;
|
||||
if (!supported[key].includes(target[key])) throw new Error(`Unsupported Browser ${key}: ${target[key]}`);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
export function executableName(platform) {
|
||||
return platform === 'win32' ? 'RuneStone-Browser.exe' : 'RuneStone-Browser';
|
||||
}
|
||||
Reference in New Issue
Block a user