Skip to content

Commit

Permalink
moar
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach committed Nov 11, 2024
1 parent 1870555 commit 261d046
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions lib/app-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const MAX_ARCHIVE_SCAN_DEPTH = 1;
export const SUPPORTED_EXTENSIONS = [IPA_EXT, APP_EXT];
const MACOS_RESOURCE_FOLDER = '__MACOSX';
const SANITIZE_REPLACEMENT = '-';
const INTEL_ARCH = 'x86_64';

/**
* Verify whether the given application is compatible to the
Expand Down Expand Up @@ -65,16 +66,24 @@ export async function verifyApplicationPlatform() {
exec('uname', ['-m']),
]);
const bundleExecutableInfo = _.trim(resFile.stdout);
const arch = _.trim(resUname.stdout);
const processArch = _.trim(resUname.stdout);
const isAppleSiliconCpu = isAppleSilicon();
this.log.debug(bundleExecutableInfo);
this.log.debug(`Current process architecture: ${arch}`);
this.log.debug(`Current process architecture: ${processArch}`);
this.log.debug(`Is Apple Silicon CPU: ${isAppleSiliconCpu}`);
if (_.includes(bundleExecutableInfo, arch)) {
if (isAppleSiliconCpu && processArch === INTEL_ARCH) {
this.log.warn(
`It looks like the Appium server process is running under Rosetta emulation. ` +
`This might lead to various performance/compatibility issues while running tests on Simulator. ` +
`Consider using binaries compiled natively for the ARM64 architecture to run Appium server ` +
`with this driver.`
);
}
if (_.includes(bundleExecutableInfo, processArch)) {
return;
}
const hasRosetta = isAppleSiliconCpu && await isRosettaInstalled();
const isIntelApp = _.includes(bundleExecutableInfo, 'x86_64');
const isIntelApp = _.includes(bundleExecutableInfo, INTEL_ARCH);
// We cannot run Simulator builds compiled for arm64 on Intel machines
// Rosetta allows only to run Intel ones on arm64
if (
Expand All @@ -84,9 +93,9 @@ export async function verifyApplicationPlatform() {
}
const advice = isIntelApp && isAppleSiliconCpu && !hasRosetta
? `Please install Rosetta and try again.`
: `Please rebuild your application to support the ${arch} platform.`;
: `Please rebuild your application to support the ${processArch} platform.`;
throw new Error(
`The ${this.opts.bundleId} application does not support the ${arch} Simulator ` +
`The ${this.opts.bundleId} application does not support the ${processArch} Simulator ` +
`architecture:\n${bundleExecutableInfo}\n\n${advice}`
);
}
Expand Down

0 comments on commit 261d046

Please sign in to comment.