From cbf2ca0c856cede615824c9371346477c07781bc Mon Sep 17 00:00:00 2001 From: fatme Date: Fri, 23 Mar 2018 08:46:32 +0200 Subject: [PATCH 1/2] Print warning when more than one package is produced from build In case when productFlavors or split option is used in .gradle file more than on .apk files are produced. Print warning that will be used the last one produced from build. --- lib/services/platform-service.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index 94cf094632..c6e5e2413c 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -788,9 +788,13 @@ export class PlatformService extends EventEmitter implements IPlatformService { private getLatestApplicationPackage(buildOutputPath: string, validBuildOutputData: IValidBuildOutputData): IApplicationPackage { let packages = this.getApplicationPackages(buildOutputPath, validBuildOutputData); + const packageExtName = path.extname(validBuildOutputData.packageNames[0]); if (packages.length === 0) { - const packageExtName = path.extname(validBuildOutputData.packageNames[0]); - this.$errors.fail("No %s found in %s directory", packageExtName, buildOutputPath); + this.$errors.fail(`No ${packageExtName} found in ${buildOutputPath} directory.`); + } + + if (packages.length > 1) { + this.$logger.warn(`More than one ${packageExtName} found in ${buildOutputPath} directory. Using the last one produced from build.`) } packages = _.sortBy(packages, pkg => pkg.time).reverse(); // We need to reverse because sortBy always sorts in ascending order From 66f5a34a11ceaa908e5249a1011ce86a1b04c715 Mon Sep 17 00:00:00 2001 From: Fatme Date: Fri, 23 Mar 2018 09:57:15 +0200 Subject: [PATCH 2/2] Fix lint error --- lib/services/platform-service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index c6e5e2413c..fa61489d05 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -794,7 +794,7 @@ export class PlatformService extends EventEmitter implements IPlatformService { } if (packages.length > 1) { - this.$logger.warn(`More than one ${packageExtName} found in ${buildOutputPath} directory. Using the last one produced from build.`) + this.$logger.warn(`More than one ${packageExtName} found in ${buildOutputPath} directory. Using the last one produced from build.`); } packages = _.sortBy(packages, pkg => pkg.time).reverse(); // We need to reverse because sortBy always sorts in ascending order