From 1abc1a3164fbd939243983cc0a4d41e189577405 Mon Sep 17 00:00:00 2001 From: Johan Maasing Date: Sat, 12 Apr 2025 19:59:44 +0200 Subject: [PATCH] Fix packaging --- README.md | 35 ++++++++++++++ assembly/pom.xml | 23 ---------- endgen-dist/pom.xml | 46 +++++++++++++++++++ endgen-dist/src/assembly/src.xml | 44 ++++++++++++++++++ endgen-dist/src/main/resources/run.sh | 4 ++ parser/pom.xml | 13 ++++++ .../java/nu/zoom/dsl/cli/EndpointsCLI.java | 2 +- pom.xml | 2 +- 8 files changed, 144 insertions(+), 25 deletions(-) delete mode 100644 assembly/pom.xml create mode 100644 endgen-dist/pom.xml create mode 100644 endgen-dist/src/assembly/src.xml create mode 100755 endgen-dist/src/main/resources/run.sh diff --git a/README.md b/README.md index ee46c4d..c647419 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,41 @@ separate files (for endpoint-definitions, circe serializer support etc). So I wrote a [DSL](https://en.wikipedia.org/wiki/Domain-specific_language) parsed by an [ANTLR4](https://www.antlr.org) parser and a code generator using [freemarker](https://freemarker.apache.org). +``` + | Endgen | + ------------------------------------------------- +----------- ||--------| |-----------| |------------|| +| endpoint | || Parser | | In-Memory | | Freemarker || --------------- +| file | --> || | --> | AST | --> | engine || --> | Output file | +\__________\ ||--------| |-----------| |------------|| \_____________\ + ------------------------------------------------- - + ^ + | + ---------------- + | Template.ftl | + \_______________\ +``` +## 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). + +Unpack the archive, run the provided shellscript file. + +### Usage +``` +Usage: EndpointsCLI [-hvV] [-o=] [-t=] +Generate source code from an endpoints specification file. + The source endpoints DSL file. + -h, --help Show this help message and exit. + -o, --output= The directory to write the generated code to. + Default is ~/endpoints-output + -t, --template= + The template directory. Default is + ~/endpoints-templates + -v, --verbose Print verbose debug messages. + -V, --version Print version information and exit. +``` + ## DSL example In the simplest form the DSL looks like this diff --git a/assembly/pom.xml b/assembly/pom.xml deleted file mode 100644 index e8c323f..0000000 --- a/assembly/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - 4.0.0 - - - nu.zoom.dsl - endgen - 1.0-SNAPSHOT - - - assembly - - - - nu.zoom.dsl - parser - ${project.parent.version} - - - - \ No newline at end of file diff --git a/endgen-dist/pom.xml b/endgen-dist/pom.xml new file mode 100644 index 0000000..9d2a59c --- /dev/null +++ b/endgen-dist/pom.xml @@ -0,0 +1,46 @@ + + + 4.0.0 + + + nu.zoom.dsl + endgen + 1.0-SNAPSHOT + + + endgen-dist + + + + + maven-assembly-plugin + 3.6.0 + + + src/assembly/src.xml + + + + + make-assembly + package + + single + + + + + + + + + + nu.zoom.dsl + parser + ${project.parent.version} + + + + \ No newline at end of file diff --git a/endgen-dist/src/assembly/src.xml b/endgen-dist/src/assembly/src.xml new file mode 100644 index 0000000..118ca91 --- /dev/null +++ b/endgen-dist/src/assembly/src.xml @@ -0,0 +1,44 @@ + + bin + false + endgen-${project.version} + + dir + zip + + + + src/main/resources/run.sh + + true + + + + + libs + + nu.zoom.dsl:parser:* + + true + ${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension} + true + false + runtime + false + + + + + nu.zoom.dsl:parser:* + + true + ${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension} + true + false + runtime + false + + + \ No newline at end of file diff --git a/endgen-dist/src/main/resources/run.sh b/endgen-dist/src/main/resources/run.sh new file mode 100755 index 0000000..720ffe7 --- /dev/null +++ b/endgen-dist/src/main/resources/run.sh @@ -0,0 +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 diff --git a/parser/pom.xml b/parser/pom.xml index 1bd7d29..5e312e1 100644 --- a/parser/pom.xml +++ b/parser/pom.xml @@ -56,6 +56,19 @@ 24 + + org.apache.maven.plugins + maven-jar-plugin + + + + libs/ + true + nu.zoom.dsl.cli.EndpointsCLI + + + +