Skip to content

Commit

Permalink
Added fix for the start action for command using mvn/gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
SuparnaSuresh committed Nov 27, 2024
1 parent 4add2ce commit bb35940
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/util/commandUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function getGradleCommandForWin(gradleCmdStart: string, buildGradlePath: string,
switch (terminalType) {
case ShellType.GIT_BASH:
gradleCmdStart = Path.join(gradleCmdStart, "gradlew");
return formDefaultCommand(gradleCmdStart, buildGradlePath, command, "-b=", customCommand); //Bash
return formDefaultCommandWithPath(gradleCmdStart, buildGradlePath, command, "-b=", customCommand); //Bash
case ShellType.POWERSHELL:
gradleCmdStart = Path.join(gradleCmdStart, "gradlew.bat");
return formPowershellCommand(gradleCmdStart, buildGradlePath, command, "-b=", customCommand);
Expand All @@ -170,7 +170,7 @@ function getGradleCommandForWin(gradleCmdStart: string, buildGradlePath: string,
default:
// The default case is ShellType CMD or OTHERS
gradleCmdStart = Path.join(gradleCmdStart, "gradlew.bat");
return formDefaultCommand(gradleCmdStart, buildGradlePath, command, "-b=", customCommand);
return formDefaultCommandWithPath(gradleCmdStart, buildGradlePath, command, "-b=", customCommand);
}
}

Expand All @@ -190,7 +190,7 @@ function getMavenCommandForWin(mvnCmdStart: string, pomPath: string, command: st
default:
// The default case is ShellType CMD or OTHERS
mvnCmdStart = Path.join(mvnCmdStart, "mvnw.cmd");
return formDefaultCommand(mvnCmdStart, pomPath, command, "-f ", customCommand);
return formDefaultCommandWithPath(mvnCmdStart, pomPath, command, "-f ", customCommand);
}
}

Expand Down Expand Up @@ -218,6 +218,16 @@ function formLinuxBasedCommand(cmdStart: string, command: string, wrapperType: S
* Returns default command
*/
function formDefaultCommand(projectPath: string, buildFilePath: String, command: string, cmdOption: String, customCommand?: string): string {
if (customCommand) {
return `${projectPath} ` + `${command}` + ` ${customCommand}` + ` ${cmdOption}"${buildFilePath}"`;
}
return `${projectPath} ` + `${command}` + ` ${cmdOption}"${buildFilePath}"`;
}

/**
* Returns default format for the command with Path
*/
function formDefaultCommandWithPath(projectPath: string, buildFilePath: String, command: string, cmdOption: String, customCommand?: string): string {
if (customCommand) {
return "\"" + projectPath + "\" " + `${command}` + ` ${customCommand}` + ` ${cmdOption}"${buildFilePath}"`;
}
Expand Down

0 comments on commit bb35940

Please sign in to comment.