Add verbose output while running, fix arguments to run.sh
This commit is contained in:
parent
98529dd3bd
commit
35ef968ed1
5 changed files with 16 additions and 6 deletions
|
@ -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.
|
||||
|
||||
|
|
|
@ -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
|
||||
java -jar parser-${artifact.baseVersion}.jar "$@"
|
|
@ -51,7 +51,7 @@
|
|||
<version>3.13.0</version>
|
||||
<configuration>
|
||||
<source>${maven.compiler.source}</source>
|
||||
<target>${maven.compiler.source}</target>
|
||||
<target>${maven.compiler.target}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -91,4 +91,4 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
</project>
|
|
@ -61,11 +61,16 @@ public class EndpointsCLI implements Callable<Integer> {
|
|||
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<Path> 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<Integer> {
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
{
|
||||
some: configvalue,
|
||||
someother: value,
|
||||
package: se.rutdev.senash,
|
||||
ending: .scala
|
||||
package: se.rutdev.senash
|
||||
}
|
||||
|
||||
/some/endpoint <- SomeType(foo:String)
|
||||
|
|
Loading…
Add table
Reference in a new issue