From dd40c9db797c95c223aa3dde7f1f0fbeaf4fb023 Mon Sep 17 00:00:00 2001 From: Rosen Vladimirov Date: Sun, 27 May 2018 14:10:43 +0300 Subject: [PATCH] fix: platform remove command fails with old Android runtime After upgrading `nativescript-doctor`, the version of the Java is validated against the current Android runtime version. In case the runtime version cannot work with Java 10, `nativescript-doctor` does not allow the operation to continue. This breaks the `platform remove` command, as it checks the system requirements first, before executing the actual removal. However, this is no longer required as the code for removing the platform is `try-catched` and in case the current environment is not setup correctly, it will try to remove the platforms/ dir and the respective key in package.json. So remove the environment validation from this command. Also remove the `validatePlatformInstalled` call from the `canExecute` method of the command, as it is actually called in the `removePlatforms` method. --- lib/commands/remove-platform.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/commands/remove-platform.ts b/lib/commands/remove-platform.ts index e6132e14bf..3ee9b90dc7 100644 --- a/lib/commands/remove-platform.ts +++ b/lib/commands/remove-platform.ts @@ -3,8 +3,7 @@ export class RemovePlatformCommand implements ICommand { constructor(private $platformService: IPlatformService, private $projectData: IProjectData, - private $errors: IErrors, - private $platformsData: IPlatformsData) { + private $errors: IErrors) { this.$projectData.initializeProjectData(); } @@ -17,12 +16,9 @@ export class RemovePlatformCommand implements ICommand { this.$errors.fail("No platform specified. Please specify a platform to remove"); } - for (const platform of args) { - this.$platformService.validatePlatformInstalled(platform, this.$projectData); - const platformData = this.$platformsData.getPlatformData(platform, this.$projectData); - const platformProjectService = platformData.platformProjectService; - await platformProjectService.validate(this.$projectData); - } + _.each(args, platform => { + this.$platformService.validatePlatform(platform, this.$projectData); + }); return true; }