diff --git a/src/utils/cordovaAndroidEnvironmentHelper.ts b/src/utils/cordovaAndroidEnvironmentHelper.ts index 9c2919b3..41e887eb 100644 --- a/src/utils/cordovaAndroidEnvironmentHelper.ts +++ b/src/utils/cordovaAndroidEnvironmentHelper.ts @@ -8,7 +8,12 @@ import { window } from "vscode"; export class CordovaAndroidEnvironmentHelper { public static checkEnvironment(cwd: string, env: any, logger: any): Promise { logger.log("Requirements check results for android:"); - return Promise.all([checkJava(cwd, env), checkAndroidSDK(cwd, env), checkGradle(cwd, env)]) + return Promise.all([ + checkJava(cwd, env), + checkAndroidSDK(cwd, env), + checkGradle(cwd, env), + checkPlugman(cwd, env), + ]) .then(() => { logger.log("Environment checks completed."); }) @@ -71,5 +76,25 @@ export class CordovaAndroidEnvironmentHelper { }); }); } + + function checkPlugman(cwd: string, env: any): Promise { + return new Promise((resolve, reject) => { + child_process.exec( + "npm list -g plugman --depth=0", + { + cwd, + env, + }, + (error, stdout, stderr) => { + if (error) { + logger.log(`Plugman not found: ${stderr}`); + return reject(error); + } + logger.log(`Plugman: ${stdout.match(/plugman@(\d+\.\d+\.\d+)/)[1]}`); + resolve(); + }, + ); + }); + } } } diff --git a/src/utils/cordovaCommandHelper.ts b/src/utils/cordovaCommandHelper.ts index 95c30638..2bf23d09 100644 --- a/src/utils/cordovaCommandHelper.ts +++ b/src/utils/cordovaCommandHelper.ts @@ -134,14 +134,38 @@ export class CordovaCommandHelper { }); process.stdout.on("close", () => { - logger.log( - localize( - "FinishedExecuting", - "########### FINISHED EXECUTING: {0} ###########", - commandToExecute, - ), - ); - resolve({}); + // Workaround for dealing with plugman environment verification + if (command === "requirements") { + process = child_process.exec("npm list -g plugman --depth=0", { + cwd: projectRoot, + env, + }); + + process.stdout.on("data", (e: string) => { + const match = e.match(/\d+\.\d+\.\d+/); + logger.log(`Plugman: ${match[0]}`); + }); + + process.stdout.on("close", () => { + logger.log( + localize( + "FinishedExecuting", + "########### FINISHED EXECUTING: {0} ###########", + commandToExecute, + ), + ); + resolve({}); + }); + } else { + logger.log( + localize( + "FinishedExecuting", + "########### FINISHED EXECUTING: {0} ###########", + commandToExecute, + ), + ); + resolve({}); + } }); } });