apple build --platform macos: apple.macos.prebuild, not the iOS project's build.prebuild

This commit is contained in:
CRTkafa 2026-11-04 00:17:04 +07:00
parent 700fcc4d66
commit 64cb16e337
4 changed files with 22 additions and 6 deletions

View file

@ -175,6 +175,15 @@ describe('apple build --platform macos --dry', () => {
expect(viaFlag.plan.entitlements).toContain('com.apple.security.files.user-selected.read-write');
expect(viaFlag.plan.entitlements).not.toContain('com.apple.security.files.downloads.read-only');
});
test('only apple.macos.prebuild runs before the Mac build; the iOS project\'s build.prebuild is named, not run', async () => {
const mobile: ShipConfig = { ...CONFIG, build: { prebuild: 'npx cap sync' } };
expect((await dry(mobile, files(), [])).plan.prebuild).toBeNull();
const text = await capture(() => buildMas(project(mobile, files()).ctx(['--tauri', 'src-tauri', '--unsigned', '--build-number', '7', '--dry']), 'linux'));
expect(text.out).toContain('not run for the Mac build: npx cap sync');
const mac: ShipConfig = { ...mobile, apple: { ...CONFIG.apple!, macos: { prebuild: 'bun run desktop:env' } } };
expect((await dry(mac, files(), [])).plan.prebuild).toBe('bun run desktop:env');
expect((await dry(mac, files(), ['--no-prebuild'])).plan.prebuildSkip).toBe('--no-prebuild');
});
test('a named plist that does not exist stops the run', async () => {
const p = project(CONFIG, files());
await expect(buildMas(p.ctx(['--tauri', 'src-tauri', '--unsigned', '--build-number', '7', '--dry', '--entitlements', 'nope.plist']), 'linux')).rejects.toThrow('does not exist');