diff --git a/README.md b/README.md index 8cf8fcb..2293eef 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ parser and a code generator using [freemarker](https://freemarker.apache.org). \____________________\ ``` ## How to Run -You need a Java 24 runtime and java in the path. A very convenient way to install a java runtime is [SdkMan](https://sdkman.io). +You need a Java 21 (or later) runtime and java in the path. A very convenient way to install a java runtime is [SdkMan](https://sdkman.io). Unpack the archive, run the provided shellscript file. diff --git a/endgen-dist/src/main/resources/run.sh b/endgen-dist/src/main/resources/run.sh index 720ffe7..75894b3 100755 --- a/endgen-dist/src/main/resources/run.sh +++ b/endgen-dist/src/main/resources/run.sh @@ -1,4 +1,4 @@ #! /bin/sh SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) cd "${SCRIPT_DIR}" -java -jar parser-${artifact.baseVersion}.jar \ No newline at end of file +java -jar parser-${artifact.baseVersion}.jar "$@" \ No newline at end of file diff --git a/parser/pom.xml b/parser/pom.xml index c2f56aa..02c7c9c 100644 --- a/parser/pom.xml +++ b/parser/pom.xml @@ -51,7 +51,7 @@ 3.13.0 ${maven.compiler.source} - ${maven.compiler.source} + ${maven.compiler.target} @@ -91,4 +91,4 @@ - + \ No newline at end of file diff --git a/parser/src/main/java/nu/zoom/dsl/cli/EndpointsCLI.java b/parser/src/main/java/nu/zoom/dsl/cli/EndpointsCLI.java index 57bf2bc..b26cb9c 100644 --- a/parser/src/main/java/nu/zoom/dsl/cli/EndpointsCLI.java +++ b/parser/src/main/java/nu/zoom/dsl/cli/EndpointsCLI.java @@ -61,11 +61,16 @@ public class EndpointsCLI implements Callable { validateTemplateDirectory(); validateInputFile(); validateOutputDirectory(); + verbose("Parsing " + file.toAbsolutePath()); DocumentNode rootNode = ParserWrapper.parse(file); + verbose("AST: " + rootNode); + verbose("Generating from templates in: " + templateDir.toAbsolutePath()); Generator generator = new Generator(templateDir, rootNode, outputDir); List generatedPaths = generator.generate(); if (generatedPaths.isEmpty()) { System.out.println("No generated paths found."); + } else { + generatedPaths.forEach(p -> verbose("Generated: " + p.toAbsolutePath())); } return 0; } catch (Exception e) { @@ -74,6 +79,12 @@ public class EndpointsCLI implements Callable { } } + private void verbose(String message) { + if (this.verbose) { + System.out.println(message); + } + } + private void validateOutputDirectory() throws IOException { if (Files.notExists(this.outputDir)) { Files.createDirectories(this.outputDir); diff --git a/test01.endpoints b/test01.endpoints index e2db8ab..6f212ed 100644 --- a/test01.endpoints +++ b/test01.endpoints @@ -17,8 +17,7 @@ { some: configvalue, someother: value, - package: se.rutdev.senash, - ending: .scala + package: se.rutdev.senash } /some/endpoint <- SomeType(foo:String)