diff --git a/build - Shortcut.lnk b/build - Shortcut.lnk new file mode 100644 index 00000000..5cad8205 Binary files /dev/null and b/build - Shortcut.lnk differ diff --git a/documentation/Functions.md b/documentation/Functions.md index 9ef2396e..01d7fbef 100644 --- a/documentation/Functions.md +++ b/documentation/Functions.md @@ -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) + +*** diff --git a/runners/console/index.ts b/runners/console/index.ts index bb1219db..f42a6dc3 100644 --- a/runners/console/index.ts +++ b/runners/console/index.ts @@ -79,6 +79,10 @@ export class Console extends Runner { return null; } + runBuildJava(step: Step, command: Command): RunResult { + return null; + } + async assertInstallDevonfwIde(step: Step, command: Command, result: RunResult) { let installedTools = command.parameters[0]; @@ -120,6 +124,11 @@ export class Console extends Runner { .fileExits(path.join(workspaceDir, command.parameters[0], "core", "src", "main", "java", "com", "example", "application", command.parameters[0], "SpringBootApp.java")); } + async assertbuildJava(step: Step, command: Command, result: RunResult) { + console.log("assertbuildJava exceptions"); + } + + private executeCommandSync(command: string, directory: string, result: RunResult, input?: string) { if(result.returnCode != 0) return; diff --git a/runners/katacoda/index.ts b/runners/katacoda/index.ts index 459ea488..28df6699 100644 --- a/runners/katacoda/index.ts +++ b/runners/katacoda/index.ts @@ -112,6 +112,31 @@ export class Katacoda extends Runner { return null; } + runCreateDevon4jProject(step: Step, command: Command): RunResult{ + return null; + } + + runBuildJava(step: Step, command: Command): RunResult{ + + //cdCommand needs to be added + let cdCommand = ""; + + let skipTestDescr = ""; + let skipTest = ""; + + if(command.parameters[1] == true){ + skipTest = '-Dmaven.test.skip=' + command.parameters[1]; + skipTestDescr = "We do not need to execute the test cases, so we can skip them by using the option '-Dmaven.test.skip=true'." + } + this.steps.push({ + "title": "Build the java project", + "text": "step" + this.stepsCount + ".md" + }); + this.renderTemplate("buildJava.md", this.outputPathTutorial + "step" + (this.stepsCount++) + ".md", { text: step.text, textAfter: step.textAfter, cdCommand: cdCommand, skipTest: skipTest, skipTestDescr: skipTestDescr}); + return null; + + } + private renderTemplate(name: string, targetPath: string, variables) { let template = fs.readFileSync(path.join(this.getRunnerDirectory(),"templates", name), 'utf8'); let result = ejs.render(template, variables); diff --git a/runners/katacoda/templates/buildJava.md b/runners/katacoda/templates/buildJava.md new file mode 100644 index 00000000..f7a3c51e --- /dev/null +++ b/runners/katacoda/templates/buildJava.md @@ -0,0 +1,13 @@ +<%= text; %> + +<%= cdCommand; %> + +Use the following devon command to build the java project. + +`devon mvn clean install <%= skipTest; %>`{{execute}} + +The maven command 'clean' will clear the target directory beforehand. + +<%= skipTestDescr; %> + +<%= textAfter; %> \ No newline at end of file