From b808ea95701d26cff8a52445e693758f247c1e04 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Sun, 20 Feb 2022 21:06:28 +0100 Subject: [PATCH 1/7] feat: only install corresponding abi package when possible --- lib/common/definitions/mobile.d.ts | 6 +++ lib/common/mobile/android/android-device.ts | 4 ++ lib/controllers/build-controller.ts | 2 +- lib/controllers/deploy-controller.ts | 5 +-- lib/controllers/run-controller.ts | 21 +++------- lib/definitions/build.d.ts | 2 +- lib/definitions/run.d.ts | 6 +-- lib/services/build-artefacts-service.ts | 28 ++++++++----- .../device/device-install-app-service.ts | 42 +++++++++++++++---- 9 files changed, 72 insertions(+), 44 deletions(-) diff --git a/lib/common/definitions/mobile.d.ts b/lib/common/definitions/mobile.d.ts index 0c0458743b..9fd7d5e3cf 100644 --- a/lib/common/definitions/mobile.d.ts +++ b/lib/common/definitions/mobile.d.ts @@ -99,6 +99,12 @@ declare global { * For iOS simulators - same as the identifier. */ imageIdentifier?: string; + + /** + * Optional property describing the architecture of the device + * Available for Android only + */ + abis?: string[]; } interface IDeviceError extends Error, IDeviceIdentifier {} diff --git a/lib/common/mobile/android/android-device.ts b/lib/common/mobile/android/android-device.ts index b230e02827..74a56e672b 100644 --- a/lib/common/mobile/android/android-device.ts +++ b/lib/common/mobile/android/android-device.ts @@ -13,6 +13,9 @@ interface IAndroidDeviceDetails { name: string; release: string; brand: string; + 'cpu.abi': string; + 'cpu.abilist64': string; + 'cpu.abilist32': string; } interface IAdbDeviceStatusInfo { @@ -96,6 +99,7 @@ export class AndroidDevice implements Mobile.IAndroidDevice { identifier: this.identifier, displayName: details.name, model: details.model, + abis: details['cpu.abilist64'].split(',').concat(details['cpu.abilist32'].split(',')), version, vendor: details.brand, platform: this.$devicePlatformsConstants.Android, diff --git a/lib/controllers/build-controller.ts b/lib/controllers/build-controller.ts index d46223c049..9ea0377d9b 100644 --- a/lib/controllers/build-controller.ts +++ b/lib/controllers/build-controller.ts @@ -116,7 +116,7 @@ export class BuildController extends EventEmitter implements IBuildController { ); if (buildData.copyTo) { - this.$buildArtefactsService.copyLatestAppPackage( + this.$buildArtefactsService.copyAppPackages( buildData.copyTo, platformData, buildData diff --git a/lib/controllers/deploy-controller.ts b/lib/controllers/deploy-controller.ts index beea13ef08..02a983c8e8 100644 --- a/lib/controllers/deploy-controller.ts +++ b/lib/controllers/deploy-controller.ts @@ -23,11 +23,10 @@ export class DeployController { }, }; await this.$prepareController.prepare(prepareData); - const packageFilePath = await deviceDescriptor.buildAction(); + await deviceDescriptor.buildAction(); await this.$deviceInstallAppService.installOnDevice( device, - { ...deviceDescriptor.buildData, buildForDevice: !device.isEmulator }, - packageFilePath + { ...deviceDescriptor.buildData, buildForDevice: !device.isEmulator } ); }; diff --git a/lib/controllers/run-controller.ts b/lib/controllers/run-controller.ts index 4f0ec24042..184a419eb4 100644 --- a/lib/controllers/run-controller.ts +++ b/lib/controllers/run-controller.ts @@ -473,7 +473,6 @@ export class RunController extends EventEmitter implements IRunController { deviceDescriptors: ILiveSyncDeviceDescriptor[] ): Promise { const rebuiltInformation: IDictionary<{ - packageFilePath: string; platform: string; isEmulator: boolean; }> = {}; @@ -509,8 +508,6 @@ export class RunController extends EventEmitter implements IRunController { ); try { - let packageFilePath: string = null; - // Case where we have three devices attached, a change that requires build is found, // we'll rebuild the app only for the first device, but we should install new package on all three devices. if ( @@ -521,24 +518,19 @@ export class RunController extends EventEmitter implements IRunController { rebuiltInformation[platformData.platformNameLowerCase] .isEmulator === device.isEmulator) ) { - packageFilePath = - rebuiltInformation[platformData.platformNameLowerCase] - .packageFilePath; await this.$deviceInstallAppService.installOnDevice( device, - buildData, - packageFilePath + buildData ); } else { const shouldBuild = prepareResultData.hasNativeChanges || (await this.$buildController.shouldBuild(buildData)); if (shouldBuild) { - packageFilePath = await deviceDescriptor.buildAction(); + await deviceDescriptor.buildAction(); rebuiltInformation[platformData.platformNameLowerCase] = { isEmulator: device.isEmulator, - platform: platformData.platformNameLowerCase, - packageFilePath, + platform: platformData.platformNameLowerCase }; } else { await this.$analyticsService.trackEventActionInGoogleAnalytics({ @@ -550,8 +542,7 @@ export class RunController extends EventEmitter implements IRunController { await this.$deviceInstallAppService.installOnDeviceIfNeeded( device, - buildData, - packageFilePath + buildData ); } @@ -710,9 +701,7 @@ export class RunController extends EventEmitter implements IRunController { await this.$deviceInstallAppService.installOnDevice( device, - deviceDescriptor.buildData, - rebuiltInformation[platformData.platformNameLowerCase] - .packageFilePath + deviceDescriptor.buildData ); await platformLiveSyncService.syncAfterInstall(device, watchInfo); await this.refreshApplication( diff --git a/lib/definitions/build.d.ts b/lib/definitions/build.d.ts index 070ba5b1b9..81de2d653d 100644 --- a/lib/definitions/build.d.ts +++ b/lib/definitions/build.d.ts @@ -58,7 +58,7 @@ interface IBuildArtefactsService { platformData: IPlatformData, buildOutputOptions: IBuildOutputOptions ): Promise; - copyLatestAppPackage( + copyAppPackages( targetPath: string, platformData: IPlatformData, buildOutputOptions: IBuildOutputOptions diff --git a/lib/definitions/run.d.ts b/lib/definitions/run.d.ts index 0095c5cf6d..544a4115a9 100644 --- a/lib/definitions/run.d.ts +++ b/lib/definitions/run.d.ts @@ -28,13 +28,11 @@ declare global { interface IDeviceInstallAppService { installOnDevice( device: Mobile.IDevice, - buildData: IBuildData, - packageFile?: string + buildData: IBuildData ): Promise; installOnDeviceIfNeeded( device: Mobile.IDevice, - buildData: IBuildData, - packageFile?: string + buildData: IBuildData ): Promise; shouldInstall( device: Mobile.IDevice, diff --git a/lib/services/build-artefacts-service.ts b/lib/services/build-artefacts-service.ts index 58e57a96f4..2ef5aca627 100644 --- a/lib/services/build-artefacts-service.ts +++ b/lib/services/build-artefacts-service.ts @@ -75,7 +75,7 @@ export class BuildArtefactsService implements IBuildArtefactsService { return []; } - public copyLatestAppPackage( + public copyAppPackages( targetPath: string, platformData: IPlatformData, buildOutputOptions: IBuildOutputOptions @@ -85,31 +85,39 @@ export class BuildArtefactsService implements IBuildArtefactsService { const outputPath = buildOutputOptions.outputPath || platformData.getBuildOutputPath(buildOutputOptions); - const applicationPackage = this.getLatestApplicationPackage( + const applicationPackages = this.getAllAppPackages( outputPath, platformData.getValidBuildOutputData(buildOutputOptions) ); - const packageFile = applicationPackage.packageName; this.$fs.ensureDirectoryExists(path.dirname(targetPath)); + let filterFilename: string; if ( + applicationPackages.length > 1 && this.$fs.exists(targetPath) && - this.$fs.getFsStats(targetPath).isDirectory() + !this.$fs.getFsStats(targetPath).isDirectory() ) { - const sourceFileName = path.basename(packageFile); + filterFilename = path.basename(targetPath); + targetPath = path.dirname(targetPath); this.$logger.trace( - `Specified target path: '${targetPath}' is directory. Same filename will be used: '${sourceFileName}'.` + `Multiple packages were built but only ${filterFilename} will be copied if existing'.` ); - targetPath = path.join(targetPath, sourceFileName); } - this.$fs.copyFile(packageFile, targetPath); - this.$logger.info(`Copied file '${packageFile}' to '${targetPath}'.`); + applicationPackages.forEach(pack => { + const fileName = path.basename(pack.packageName); + if (!filterFilename || fileName === filterFilename) { + const targetFilePath = path.join(targetPath, path.basename(pack.packageName)); + this.$fs.copyFile(pack.packageName, path.join(targetPath, path.basename(pack.packageName))); + this.$logger.info(`Copied file '${pack.packageName}' to '${targetFilePath}'.`); + } + }); } private getLatestApplicationPackage( buildOutputPath: string, - validBuildOutputData: IValidBuildOutputData + validBuildOutputData: IValidBuildOutputData, + abis?: string[] ): IApplicationPackage { let packages = this.getAllAppPackages( buildOutputPath, diff --git a/lib/services/device/device-install-app-service.ts b/lib/services/device/device-install-app-service.ts index 1175b511aa..272e23e4f3 100644 --- a/lib/services/device/device-install-app-service.ts +++ b/lib/services/device/device-install-app-service.ts @@ -28,8 +28,7 @@ export class DeviceInstallAppService { public async installOnDevice( device: Mobile.IDevice, - buildData: IBuildData, - packageFile?: string + buildData: IBuildData ): Promise { this.$logger.info( `Installing on device ${device.deviceInfo.identifier}...` @@ -49,12 +48,38 @@ export class DeviceInstallAppService { device, projectDir: projectData.projectDir, }); + const buildOutputOptions = platformData.getValidBuildOutputData(buildData); + const outputPath = buildData.outputPath || platformData.getBuildOutputPath(buildData); + const packages = await this.$buildArtefactsService.getAllAppPackages( + outputPath, + buildOutputOptions + ); + let packageFile; + if (packages.length === 1) { + // will always be the case on iOS + packageFile = packages[0].packageName; + } else if (device.deviceInfo.abis) { + device.deviceInfo.abis.every(abi=>{ + const index = packages.findIndex(p => p.packageName.indexOf(abi) !== -1); + if (index !== -1) { + packageFile = packages[index].packageName; + return false; + } + return true; + }) + } else { + //we did not find corresponding abi let's try universal + const index = packages.findIndex(p => p.packageName.indexOf('universal') !== -1); + if (index !== -1) { + packageFile = packages[index].packageName; + } + } if (!packageFile) { - packageFile = await this.$buildArtefactsService.getLatestAppPackagePath( - platformData, - buildData + this.$logger.error( + `Could not find a package corresponding to the device with identifier '${device.deviceInfo.identifier}'.` ); + return; } await platformData.platformProjectService.cleanDeviceTempFolder( @@ -88,18 +113,17 @@ export class DeviceInstallAppService { } this.$logger.info( - `Successfully installed on device with identifier '${device.deviceInfo.identifier}'.` + `Successfully installed on device with identifier '${device.deviceInfo.identifier} using package ${packageFile}'.` ); } public async installOnDeviceIfNeeded( device: Mobile.IDevice, - buildData: IBuildData, - packageFile?: string + buildData: IBuildData ): Promise { const shouldInstall = await this.shouldInstall(device, buildData); if (shouldInstall) { - await this.installOnDevice(device, buildData, packageFile); + await this.installOnDevice(device, buildData); } } From dc30ac3dd4d850c93e9ff99aaba0ba4a16d9c573 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Sun, 20 Feb 2022 21:26:33 +0100 Subject: [PATCH 2/7] fix: better `copyAppPackages` handle --- lib/services/build-artefacts-service.ts | 28 ++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/services/build-artefacts-service.ts b/lib/services/build-artefacts-service.ts index 2ef5aca627..215155053e 100644 --- a/lib/services/build-artefacts-service.ts +++ b/lib/services/build-artefacts-service.ts @@ -92,23 +92,27 @@ export class BuildArtefactsService implements IBuildArtefactsService { this.$fs.ensureDirectoryExists(path.dirname(targetPath)); - let filterFilename: string; + let filterRegex: RegExp; + let targetIsDirectory = false; if ( - applicationPackages.length > 1 && this.$fs.exists(targetPath) && - !this.$fs.getFsStats(targetPath).isDirectory() + this.$fs.getFsStats(targetPath).isDirectory() ) { - filterFilename = path.basename(targetPath); - targetPath = path.dirname(targetPath); - this.$logger.trace( - `Multiple packages were built but only ${filterFilename} will be copied if existing'.` - ); + targetIsDirectory = true; + } else if (targetPath.match(/\.(ipa|aab|apk)/)){ + if (applicationPackages.length > 1){ + filterRegex = new RegExp('universal'); + this.$logger.trace( + `Multiple packages were built but only the universal one will be copied if existing'.` + ); + } + } else { + targetIsDirectory = true; } applicationPackages.forEach(pack => { - const fileName = path.basename(pack.packageName); - if (!filterFilename || fileName === filterFilename) { - const targetFilePath = path.join(targetPath, path.basename(pack.packageName)); - this.$fs.copyFile(pack.packageName, path.join(targetPath, path.basename(pack.packageName))); + const targetFilePath = targetIsDirectory ? path.join(targetPath, path.basename(pack.packageName)) : targetPath; + if (!filterRegex || filterRegex.test(pack.packageName)) { + this.$fs.copyFile(pack.packageName, targetFilePath); this.$logger.info(`Copied file '${pack.packageName}' to '${targetFilePath}'.`); } }); From fb32803be1b3e96bac816027d3c93eda5000e03b Mon Sep 17 00:00:00 2001 From: farfromrefuge Date: Thu, 9 Nov 2023 09:31:21 +0100 Subject: [PATCH 3/7] fix(android): in case we use `buildFilterDevicesArch` check if we need to rebuild for devices we are building for --- lib/services/android-project-service.ts | 40 +++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/lib/services/android-project-service.ts b/lib/services/android-project-service.ts index 96eff761da..661238b75e 100644 --- a/lib/services/android-project-service.ts +++ b/lib/services/android-project-service.ts @@ -47,6 +47,9 @@ import { import { IInjector } from "../common/definitions/yok"; import { injector } from "../common/yok"; import { INotConfiguredEnvOptions } from "../common/definitions/commands"; +import { IProjectChangesInfo } from "../definitions/project-changes"; +import { AndroidPrepareData } from "../data/prepare-data"; +import { AndroidBuildData } from "../data/build-data"; interface NativeDependency { name: string; @@ -148,6 +151,8 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject private $androidPluginBuildService: IAndroidPluginBuildService, private $platformEnvironmentRequirements: IPlatformEnvironmentRequirements, private $androidResourcesMigrationService: IAndroidResourcesMigrationService, + private $liveSyncProcessDataService: ILiveSyncProcessDataService, + private $devicesService: Mobile.IDevicesService, private $filesHashService: IFilesHashService, private $gradleCommandService: IGradleCommandService, private $gradleBuildService: IGradleBuildService, @@ -830,8 +835,39 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject await adb.executeShellCommand(["rm", "-rf", deviceRootPath]); } - public async checkForChanges(): Promise { - // Nothing android specific to check yet. + public async checkForChanges( + changesInfo: IProjectChangesInfo, + prepareData: AndroidPrepareData, + projectData: IProjectData + ): Promise { + //we need to check for abi change in connected device vs last built + const deviceDescriptors = this.$liveSyncProcessDataService.getDeviceDescriptors( + projectData.projectDir + ); + const platformData = this.getPlatformData(projectData); + deviceDescriptors.forEach(deviceDescriptor=>{ + const buildData = deviceDescriptor.buildData as AndroidBuildData; + if (buildData.buildFilterDevicesArch) { + const outputPath = platformData.getBuildOutputPath(deviceDescriptor.buildData); + const apkOutputPath = path.join(outputPath, prepareData.release ? "release" : "debug"); + if (!this.$fs.exists(outputPath)) { + return; + } + // check if we already build this arch + // if not we need to say native has changed + const device = this.$devicesService.getDevicesForPlatform(deviceDescriptor.buildData.platform).filter(d=>d.deviceInfo.identifier === deviceDescriptor.identifier)[0]; + const abis = device.deviceInfo.abis.filter(a=>!!a && a.length)[0]; + + const directoryContent = this.$fs.readDirectory(apkOutputPath); + const regexp = new RegExp(`${abis}.*\.apk`); + const files = _.filter(directoryContent, (entry: string) => { + return regexp.test(entry); + }); + if (files.length === 0) { + changesInfo.nativeChanged = true; + } + } + }) } public getDeploymentTarget(projectData: IProjectData): semver.SemVer { From 35788f01a03982d0966110f65ecce95da3173859 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Mon, 21 Feb 2022 11:51:43 +0100 Subject: [PATCH 4/7] feat: `filterDevicesArch` option to build only abi of connected devices for `run|debug` this passes a gradle `abiFilters` arg to the build process which could allow the gradle config to only build abis of connected devices. * build faster * could be used with split to only deploy a smaller apk to each device depending on its abi Default to false for now. Could become the default later It requires an update to the gradle file in the android runtime --- lib/commands/build.ts | 6 +++++- lib/data/build-data.ts | 2 ++ lib/definitions/build.d.ts | 1 + lib/helpers/deploy-command-helper.ts | 1 + lib/options.ts | 1 + lib/services/android/gradle-build-args-service.ts | 1 - lib/services/android/gradle-build-service.ts | 11 ++++++++++- 7 files changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/commands/build.ts b/lib/commands/build.ts index b3b732e2d6..5928ba51e0 100644 --- a/lib/commands/build.ts +++ b/lib/commands/build.ts @@ -52,7 +52,11 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase { const buildData = this.$buildDataService.getBuildData( this.$projectData.projectDir, platform, - this.$options + { + ...this.$options.argv, + // we disable buildFilterDevicesArch for build only to ensure we dont use it in production builds + buildFilterDevicesArch: false + } ); const outputPath = await this.$buildController.prepareAndBuild(buildData); diff --git a/lib/data/build-data.ts b/lib/data/build-data.ts index 87af14d166..b256c4ef1b 100644 --- a/lib/data/build-data.ts +++ b/lib/data/build-data.ts @@ -6,6 +6,7 @@ export class BuildData extends PrepareData implements IBuildData { public emulator?: boolean; public clean: boolean; public buildForDevice?: boolean; + public buildFilterDevicesArch?: boolean; public buildOutputStdio?: string; public outputPath?: string; public copyTo?: string; @@ -58,6 +59,7 @@ export class AndroidBuildData extends BuildData { this.keyStoreAliasPassword = data.keyStoreAliasPassword; this.keyStorePassword = data.keyStorePassword; this.androidBundle = data.androidBundle || data.aab; + this.buildFilterDevicesArch = !this.androidBundle && data.filterDevicesArch; this.gradlePath = data.gradlePath; this.gradleArgs = data.gradleArgs; } diff --git a/lib/definitions/build.d.ts b/lib/definitions/build.d.ts index a455ae8cff..41bab096ca 100644 --- a/lib/definitions/build.d.ts +++ b/lib/definitions/build.d.ts @@ -30,6 +30,7 @@ interface IAndroidBuildData extends IBuildData, IAndroidSigningData, IHasAndroidBundle { + buildFilterDevicesArch?: boolean; gradlePath?: string; gradleArgs?: string; } diff --git a/lib/helpers/deploy-command-helper.ts b/lib/helpers/deploy-command-helper.ts index ee2a33473a..2c0d5284f4 100644 --- a/lib/helpers/deploy-command-helper.ts +++ b/lib/helpers/deploy-command-helper.ts @@ -53,6 +53,7 @@ export class DeployCommandHelper { { ...this.$options.argv, outputPath, + buildFilterDevicesArch: false, buildForDevice: !d.isEmulator, skipWatcher: !this.$options.watch, nativePrepare: { diff --git a/lib/options.ts b/lib/options.ts index 26451d8264..13a84ed0d9 100644 --- a/lib/options.ts +++ b/lib/options.ts @@ -222,6 +222,7 @@ export class Options { gradlePath: { type: OptionType.String, hasSensitiveValue: false }, gradleArgs: { type: OptionType.String, hasSensitiveValue: false }, aab: { type: OptionType.Boolean, hasSensitiveValue: false }, + filterDevicesArch: { type: OptionType.Boolean, hasSensitiveValue: false }, performance: { type: OptionType.Object, hasSensitiveValue: true }, appleApplicationSpecificPassword: { type: OptionType.String, diff --git a/lib/services/android/gradle-build-args-service.ts b/lib/services/android/gradle-build-args-service.ts index d3c5dac1bc..b5c68382d0 100644 --- a/lib/services/android/gradle-build-args-service.ts +++ b/lib/services/android/gradle-build-args-service.ts @@ -30,7 +30,6 @@ export class GradleBuildArgsService implements IGradleBuildArgsService { ) { args.push("-PgatherAnalyticsData=true"); } - // allow modifying gradle args from a `before-build-task-args` hook await this.$hooksService.executeBeforeHooks("build-task-args", { hookArgs: { args }, diff --git a/lib/services/android/gradle-build-service.ts b/lib/services/android/gradle-build-service.ts index 4ce97ab89a..41f30f395d 100644 --- a/lib/services/android/gradle-build-service.ts +++ b/lib/services/android/gradle-build-service.ts @@ -16,7 +16,8 @@ export class GradleBuildService constructor( private $childProcess: IChildProcess, private $gradleBuildArgsService: IGradleBuildArgsService, - private $gradleCommandService: IGradleCommandService + private $gradleCommandService: IGradleCommandService, + private $devicesService: Mobile.IDevicesService ) { super(); } @@ -28,6 +29,14 @@ export class GradleBuildService const buildTaskArgs = await this.$gradleBuildArgsService.getBuildTaskArgs( buildData ); + if (buildData.buildFilterDevicesArch) { + const devices = this.$devicesService.getDevicesForPlatform(buildData.platform); + const abis = devices.map(d=>d.deviceInfo.abis[0]); + if (abis.length > 0) { + buildTaskArgs.push(`-PabiFilters=${abis.join(',')}`); + } + } + console.log('buildTaskArgs', buildTaskArgs); const spawnOptions = { emitOptions: { eventName: constants.BUILD_OUTPUT_EVENT_NAME }, throwError: true, From c74f66befb3260d707bc8e3897a6321e83452c4e Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Mon, 21 Feb 2022 11:55:28 +0100 Subject: [PATCH 5/7] chore: fix after merge # Conflicts: # lib/definitions/android-plugin-migrator.d.ts --- lib/definitions/android-plugin-migrator.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/definitions/android-plugin-migrator.d.ts b/lib/definitions/android-plugin-migrator.d.ts index f5ad873307..bea8371d00 100644 --- a/lib/definitions/android-plugin-migrator.d.ts +++ b/lib/definitions/android-plugin-migrator.d.ts @@ -10,8 +10,8 @@ interface IAndroidBuildOptions { pluginName: string; aarOutputDir: string; tempPluginDirPath: string; - gradlePath?: string; gradleArgs?: string; + gradlePath?: string; } interface IAndroidPluginBuildService { From 7fa6662824137b39a568cec1e8f3d1ea07d52298 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Mon, 21 Feb 2022 15:21:52 +0100 Subject: [PATCH 6/7] fix: filter for emulator only --- lib/services/android/gradle-build-service.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/services/android/gradle-build-service.ts b/lib/services/android/gradle-build-service.ts index 41f30f395d..002d6db6c9 100644 --- a/lib/services/android/gradle-build-service.ts +++ b/lib/services/android/gradle-build-service.ts @@ -30,7 +30,10 @@ export class GradleBuildService buildData ); if (buildData.buildFilterDevicesArch) { - const devices = this.$devicesService.getDevicesForPlatform(buildData.platform); + let devices = this.$devicesService.getDevicesForPlatform(buildData.platform); + if(buildData.emulator) { + devices = devices.filter(d=>d.isEmulator); + } const abis = devices.map(d=>d.deviceInfo.abis[0]); if (abis.length > 0) { buildTaskArgs.push(`-PabiFilters=${abis.join(',')}`); From 9a528521d868b775159b01612ea62947830c23ba Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Mon, 21 Feb 2022 15:22:12 +0100 Subject: [PATCH 7/7] chore: default `filterDevicesArch` to true --- lib/data/build-data.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/data/build-data.ts b/lib/data/build-data.ts index b256c4ef1b..d623ef7eb0 100644 --- a/lib/data/build-data.ts +++ b/lib/data/build-data.ts @@ -59,7 +59,7 @@ export class AndroidBuildData extends BuildData { this.keyStoreAliasPassword = data.keyStoreAliasPassword; this.keyStorePassword = data.keyStorePassword; this.androidBundle = data.androidBundle || data.aab; - this.buildFilterDevicesArch = !this.androidBundle && data.filterDevicesArch; + this.buildFilterDevicesArch = !this.androidBundle && data.filterDevicesArch !== false ; this.gradlePath = data.gradlePath; this.gradleArgs = data.gradleArgs; }