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
9 changes: 9 additions & 0 deletions documentation/Functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,12 @@ cobiGenJava("path/to/java/file/MyEntity.java",[1,3,5,6,8])
createDevon4jProject("cobigenexample")

***

### buildJava
#### parameter
1. The project directory
2. Indicator whether tests should be run
#### example
buildJava("cobigenexample", true)

***
27 changes: 26 additions & 1 deletion runners/console/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ export class Console extends Runner {
return result;
}

runBuildJava(step: Step, command: Command): RunResult {
let result = new RunResult();
result.returnCode = 0;

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

return result;
}

runCobiGenJava(step: Step, command: Command): RunResult {
return null;
}
Expand Down Expand Up @@ -103,6 +117,17 @@ export class Console extends Runner {
.fileExits(path.join(this.getWorkingDirectory(), "devonfw", "software", "cobigen-cli", "cobigen"));
}

async assertBuildJava(step: Step, command: Command, result: RunResult) {
let workspaceDir = path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main");

new Assertions()
.noErrorCode(result)
.noException(result)
.directoryExits(path.join(workspaceDir, command.parameters[0], "api", "target"))
.directoryExits(path.join(workspaceDir, command.parameters[0], "core", "target"))
.directoryExits(path.join(workspaceDir, command.parameters[0], "server", "target"));
}

async assertCobiGenJava(step: Step, command: Command, result: RunResult) {
console.log("there is no assertion yet for the cobiGenJava command");
}
Expand All @@ -123,7 +148,7 @@ export class Console extends Runner {
private executeCommandSync(command: string, directory: string, result: RunResult, input?: string) {
if(result.returnCode != 0) return;

let process = child_process.spawnSync(command, { shell: true, cwd: directory, input: input });
let process = child_process.spawnSync(command, { shell: true, cwd: directory, input: input, maxBuffer: Infinity });
if(process.status != 0) {
console.log("Error executing command: " + command + " (exit code: " + process.status + ")");
console.log(process.stderr.toString(), process.stdout.toString());
Expand Down