✨ Support keep-binary usage
This commit is contained in:
20
bin/builders/MacBuilder.ts
vendored
20
bin/builders/MacBuilder.ts
vendored
@@ -10,35 +10,27 @@ export default class MacBuilder extends BaseBuilder {
|
||||
constructor(options: PakeAppOptions) {
|
||||
super(options);
|
||||
|
||||
// Store the original targets value for architecture selection
|
||||
// For macOS, targets can be architecture names or format names
|
||||
// Filter out non-architecture values
|
||||
const validArchs = ['intel', 'apple', 'universal', 'auto', 'x64', 'arm64'];
|
||||
this.buildArch = validArchs.includes(options.targets || '')
|
||||
? options.targets
|
||||
: 'auto';
|
||||
|
||||
// Use DMG by default for distribution
|
||||
// Only create app bundles for testing to avoid user interaction
|
||||
if (process.env.PAKE_CREATE_APP === '1') {
|
||||
this.buildFormat = 'app';
|
||||
} else {
|
||||
this.buildFormat = 'dmg';
|
||||
}
|
||||
|
||||
// Set targets to format for Tauri
|
||||
this.options.targets = this.buildFormat;
|
||||
}
|
||||
|
||||
getFileName(): string {
|
||||
const { name } = this.options;
|
||||
|
||||
// For app bundles, use simple name without version/arch
|
||||
if (this.buildFormat === 'app') {
|
||||
return name;
|
||||
}
|
||||
|
||||
// For DMG files, use versioned filename
|
||||
let arch: string;
|
||||
if (this.buildArch === 'universal' || this.options.multiArch) {
|
||||
arch = 'universal';
|
||||
@@ -47,7 +39,6 @@ export default class MacBuilder extends BaseBuilder {
|
||||
} else if (this.buildArch === 'intel') {
|
||||
arch = 'x64';
|
||||
} else {
|
||||
// Auto-detect based on current architecture
|
||||
arch = this.getArchDisplayName(this.resolveTargetArch(this.buildArch));
|
||||
}
|
||||
return `${name}_${tauriConfig.version}_${arch}`;
|
||||
@@ -79,7 +70,6 @@ export default class MacBuilder extends BaseBuilder {
|
||||
buildTarget,
|
||||
);
|
||||
|
||||
// Add features
|
||||
const features = this.getBuildFeatures();
|
||||
if (features.length > 0) {
|
||||
fullCommand += ` --features ${features.join(',')}`;
|
||||
@@ -95,4 +85,14 @@ export default class MacBuilder extends BaseBuilder {
|
||||
|
||||
return `src-tauri/target/${target}/${basePath}/bundle`;
|
||||
}
|
||||
|
||||
protected hasArchSpecificTarget(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected getArchSpecificPath(): string {
|
||||
const actualArch = this.getActualArch();
|
||||
const target = this.getTauriTarget(actualArch, 'darwin');
|
||||
return `src-tauri/target/${target}`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user