Skip to content

Commit

Permalink
fix(nx-spring-boot): make builders executable platform independant
Browse files Browse the repository at this point in the history
  • Loading branch information
tinesoft committed Oct 24, 2020
1 parent 5c75781 commit b27bc4c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/nx-spring-boot/src/core/gradle-build.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export class GradleBuild implements BuildCore {
}

getExecutable() {
return './gradlew';
const isWin = process.platform === "win32";
return `./gradlew${isWin ? '.cmd' : ''}`;
}

getCommand( alias: BuildCommandAliasType){
Expand Down
5 changes: 3 additions & 2 deletions packages/nx-spring-boot/src/core/maven-build.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ export class MavenBuild implements BuildCore {
}

getBuildSystemType() {
return BuildSystem.GRADLE;
return BuildSystem.MAVEN;
}

getExecutable() {
return './mvnw';
const isWin = process.platform === "win32";
return `./mvnw${isWin ? '.cmd' : ''}`;
}

getCommand( alias: BuildCommandAliasType){
Expand Down
6 changes: 4 additions & 2 deletions packages/nx-spring-boot/src/utils/boot-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import { BuildCommandAliasType, BuildCore } from '../core/build-core.class';
import { GradleBuild } from '../core/gradle-build.class';
import { MavenBuild } from '../core/maven-build.class';

function determineBuildSystem(cwd: string): BuildCore {
const isWin = process.platform === "win32";

export function determineBuildSystem(cwd: string): BuildCore {
try {
execSync(`./mvnw --version`, {
execSync(`./mvnw${isWin ? '.cmd' : ''} --version`, {
cwd,
stdio: ['ignore', 'ignore', 'ignore'],
});
Expand Down

0 comments on commit b27bc4c

Please sign in to comment.