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
|
## 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.
|
Unpack the archive, run the provided shellscript file.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
cd "${SCRIPT_DIR}"
|
cd "${SCRIPT_DIR}"
|
||||||
java -jar parser-${artifact.baseVersion}.jar
|
java -jar parser-${artifact.baseVersion}.jar "$@"
|
|
@ -51,7 +51,7 @@
|
||||||
<version>3.13.0</version>
|
<version>3.13.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>${maven.compiler.source}</source>
|
<source>${maven.compiler.source}</source>
|
||||||
<target>${maven.compiler.source}</target>
|
<target>${maven.compiler.target}</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|
|
@ -61,11 +61,16 @@ public class EndpointsCLI implements Callable<Integer> {
|
||||||
validateTemplateDirectory();
|
validateTemplateDirectory();
|
||||||
validateInputFile();
|
validateInputFile();
|
||||||
validateOutputDirectory();
|
validateOutputDirectory();
|
||||||
|
verbose("Parsing " + file.toAbsolutePath());
|
||||||
DocumentNode rootNode = ParserWrapper.parse(file);
|
DocumentNode rootNode = ParserWrapper.parse(file);
|
||||||
|
verbose("AST: " + rootNode);
|
||||||
|
verbose("Generating from templates in: " + templateDir.toAbsolutePath());
|
||||||
Generator generator = new Generator(templateDir, rootNode, outputDir);
|
Generator generator = new Generator(templateDir, rootNode, outputDir);
|
||||||
List<Path> generatedPaths = generator.generate();
|
List<Path> generatedPaths = generator.generate();
|
||||||
if (generatedPaths.isEmpty()) {
|
if (generatedPaths.isEmpty()) {
|
||||||
System.out.println("No generated paths found.");
|
System.out.println("No generated paths found.");
|
||||||
|
} else {
|
||||||
|
generatedPaths.forEach(p -> verbose("Generated: " + p.toAbsolutePath()));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} catch (Exception e) {
|
} 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 {
|
private void validateOutputDirectory() throws IOException {
|
||||||
if (Files.notExists(this.outputDir)) {
|
if (Files.notExists(this.outputDir)) {
|
||||||
Files.createDirectories(this.outputDir);
|
Files.createDirectories(this.outputDir);
|
||||||
|
|
|
@ -17,8 +17,7 @@
|
||||||
{
|
{
|
||||||
some: configvalue,
|
some: configvalue,
|
||||||
someother: value,
|
someother: value,
|
||||||
package: se.rutdev.senash,
|
package: se.rutdev.senash
|
||||||
ending: .scala
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/some/endpoint <- SomeType(foo:String)
|
/some/endpoint <- SomeType(foo:String)
|
||||||
|
|
Loading…
Add table
Reference in a new issue