Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion documentation/Functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ createDevon4jProject("cobigenexample")
### buildJava
#### parameter
1. The project directory
2. Indicator whether tests should be run
2. (Optional) Indicator whether tests should be run. Default is false.
#### example
buildJava("cobigenexample", true)

Expand Down
39 changes: 16 additions & 23 deletions runners/console/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,7 @@ export class Console extends Runner {
let result = new RunResult();
result.returnCode = 0;

if(this.platform == ConsolePlatform.WINDOWS) {
let scriptsDir = path.join(this.getWorkingDirectory(), "devonfw", "scripts");
this.executeCommandSync(scriptsDir + "\\devon cobigen", path.join(this.getWorkingDirectory(), "devonfw"), result);
} else {
this.executeCommandSync("~/.devon/devon cobigen", path.join(this.getWorkingDirectory(), "devonfw"), result);
}
this.executeDevonCommandSync("cobigen", path.join(this.getWorkingDirectory(), "devonfw"), result);
return result;
}

Expand All @@ -71,12 +66,7 @@ export class Console extends Runner {

let workspaceDir = path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main");
let projectName = command.parameters[0];
if(this.platform == ConsolePlatform.WINDOWS) {
let scriptsDir = path.join(this.getWorkingDirectory(), "devonfw", "scripts");
this.executeCommandSync(scriptsDir + "\\devon java create com.example.application." + projectName, workspaceDir, result);
} else {
this.executeCommandSync("~/.devon/devon java create com.example.application." + projectName, workspaceDir, result);
}
this.executeDevonCommandSync("java create com.example.application." + projectName, workspaceDir, result);

return result;
}
Expand Down Expand Up @@ -105,12 +95,11 @@ export class Console extends Runner {
let result = new RunResult();
result.returnCode = 0;

let projectDir = path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main", command.parameters[0])
if(this.platform == ConsolePlatform.WINDOWS) {
let scriptsDir = path.join(this.getWorkingDirectory(), "devonfw", "scripts");
this.executeCommandSync(scriptsDir + "\\devon mvn clean install -Dmaven.test.skip=" + !command.parameters[1], projectDir, result);
let projectDir = path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main", command.parameters[0]);
if(command.parameters.length == 2 && command.parameters[1] == true){
this.executeDevonCommandSync("mvn clean install", projectDir, result);
} else {
this.executeCommandSync("~/.devon/devon mvn clean install -Dmaven.test.skip=" + !command.parameters[1], projectDir, result);
this.executeDevonCommandSync("mvn clean install -Dmaven.test.skip=true", projectDir, result);
}

return result;
Expand All @@ -121,12 +110,7 @@ export class Console extends Runner {
result.returnCode = 0;

let workspaceDir = path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main");
if(this.platform == ConsolePlatform.WINDOWS) {
let scriptsDir = path.join(this.getWorkingDirectory(), "devonfw", "scripts");
this.executeCommandSync(scriptsDir + "\\devon cobigen generate " + command.parameters[0], workspaceDir, result, command.parameters[1].toString());
} else {
this.executeCommandSync("~/.devon/devon cobigen generate " + command.parameters[0], workspaceDir, result, command.parameters[1].toString());
}
this.executeDevonCommandSync("cobigen generate " + command.parameters[0], workspaceDir, result, command.parameters[1].toString());

return result;
}
Expand Down Expand Up @@ -203,4 +187,13 @@ export class Console extends Runner {
result.returnCode = process.status;
}
}

private executeDevonCommandSync(devonCommand: string, directory: string, result: RunResult, input?: string) {
if(this.platform == ConsolePlatform.WINDOWS) {
let scriptsDir = path.join(this.getWorkingDirectory(), "devonfw", "scripts");
this.executeCommandSync(scriptsDir + "\\devon " + devonCommand, directory, result, input);
} else {
this.executeCommandSync("~/.devon/devon " + devonCommand, directory, result, input);
}
}
}