补齐桌面壳产物验收
原生壳总验收检查 Tauri release 二进制产物 宿主壳方案和项目记忆同步桌面产物验收口径
This commit is contained in:
@@ -1983,6 +1983,62 @@ function assertHostBridgeLayerLayout() {
|
||||
);
|
||||
}
|
||||
|
||||
function assertDesktopReleaseBinaryArtifact() {
|
||||
const releaseDir = path.join(
|
||||
'apps',
|
||||
'desktop-shell',
|
||||
'src-tauri',
|
||||
'target',
|
||||
'release',
|
||||
);
|
||||
const executableName =
|
||||
process.platform === 'win32'
|
||||
? 'genarrative-desktop-shell.exe'
|
||||
: 'genarrative-desktop-shell';
|
||||
const executablePath = path.join(releaseDir, executableName);
|
||||
|
||||
if (!fs.existsSync(executablePath)) {
|
||||
throw new Error(`desktop release binary is missing: ${executablePath}`);
|
||||
}
|
||||
|
||||
const stat = fs.statSync(executablePath);
|
||||
if (!stat.isFile() || stat.size < 1024 * 1024) {
|
||||
throw new Error('desktop release binary must be a real non-empty executable file');
|
||||
}
|
||||
|
||||
const header = fs.readFileSync(executablePath, { start: 0, end: 7 });
|
||||
if (process.platform === 'linux') {
|
||||
const isElf =
|
||||
header[0] === 0x7f &&
|
||||
header[1] === 0x45 &&
|
||||
header[2] === 0x4c &&
|
||||
header[3] === 0x46;
|
||||
if (!isElf || (stat.mode & 0o111) === 0) {
|
||||
throw new Error('desktop Linux release binary must be an executable ELF file');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
const machMagic = header.readUInt32BE(0);
|
||||
const isMachO =
|
||||
machMagic === 0xcafebabe ||
|
||||
machMagic === 0xcafed00d ||
|
||||
machMagic === 0xfeedface ||
|
||||
machMagic === 0xfeedfacf;
|
||||
if (!isMachO || (stat.mode & 0o111) === 0) {
|
||||
throw new Error('desktop macOS release binary must be an executable Mach-O file');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
if (header[0] !== 0x4d || header[1] !== 0x5a) {
|
||||
throw new Error('desktop Windows release binary must be a PE executable');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const step of steps) {
|
||||
console.log(`[check:native-shells] ${step.label}`);
|
||||
const result = spawnSync(step.command, step.args, {
|
||||
@@ -2009,6 +2065,9 @@ for (const step of steps) {
|
||||
}
|
||||
}
|
||||
|
||||
console.log('[check:native-shells] desktop-release-binary-artifact');
|
||||
assertDesktopReleaseBinaryArtifact();
|
||||
|
||||
console.log('[check:native-shells] host-bridge-layer-layout');
|
||||
assertHostBridgeLayerLayout();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user