Skip to content

Commit 1a77f90

Browse files
authored
Issue #163 rename jdt2jar to jtd2jar
Closes #163
1 parent 3608209 commit 1a77f90

15 files changed

Lines changed: 74 additions & 72 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ jobs:
6868
uses: docker/build-push-action@v6
6969
with:
7070
context: .
71-
file: jdt2jar/Dockerfile
71+
file: jtd2jar/Dockerfile
7272
push: false
7373
load: true
74-
tags: jdt2jar:ci
74+
tags: jtd2jar:ci
7575

7676
- name: Smoke test
7777
run: |
78-
docker run --rm jdt2jar:ci --help
78+
docker run --rm jtd2jar:ci --help

.github/workflows/maven.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ jobs:
7676
uses: docker/build-push-action@v6
7777
with:
7878
context: .
79-
file: jdt2jar/Dockerfile
79+
file: jtd2jar/Dockerfile
8080
push: false
8181
load: true
82-
tags: jdt2jar:ci
82+
tags: jtd2jar:ci
8383

8484
- name: Smoke test
8585
run: |
86-
docker run --rm jdt2jar:ci --help
86+
docker run --rm jtd2jar:ci --help

.github/workflows/release-on-tag.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ jobs:
5656
Pre-built distroless container image available on GitHub Container Registry:
5757
5858
```bash
59-
docker pull ghcr.io/${{ github.repository_owner }}/java.util.json.java21/jdt2jar:${{ steps.version.outputs.version }}
60-
docker pull ghcr.io/${{ github.repository_owner }}/java.util.json.java21/jdt2jar:latest
59+
docker pull ghcr.io/${{ github.repository_owner }}/java.util.json.java21/jtd2jar:${{ steps.version.outputs.version }}
60+
docker pull ghcr.io/${{ github.repository_owner }}/java.util.json.java21/jtd2jar:latest
6161
```
6262
63-
See [jdt2jar/README.md](https://github.com/${{ github.repository }}/blob/main/jdt2jar/README.md) for usage.
63+
See [jtd2jar/README.md](https://github.com/${{ github.repository }}/blob/main/jtd2jar/README.md) for usage.
6464
6565
- name: Build and Deploy to Central (release profile)
6666
id: deploy
@@ -150,8 +150,8 @@ jobs:
150150
uses: docker/build-push-action@v6
151151
with:
152152
context: .
153-
file: jdt2jar/Dockerfile
153+
file: jtd2jar/Dockerfile
154154
push: true
155155
tags: |
156-
ghcr.io/${{ github.repository_owner }}/java.util.json.java21/jdt2jar:${{ steps.version.outputs.version }}
157-
ghcr.io/${{ github.repository_owner }}/java.util.json.java21/jdt2jar:latest
156+
ghcr.io/${{ github.repository_owner }}/java.util.json.java21/jtd2jar:${{ steps.version.outputs.version }}
157+
ghcr.io/${{ github.repository_owner }}/java.util.json.java21/jtd2jar:latest

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This repo is organized into the following modules:
1616
| `json-java21` | Core `java.util.json` backport (parser, immutable types, `Json` API) | 21+ |
1717
| `json-java21-jtd` | JTD (RFC 8927) stack-machine interpreter — ideal for infrequent config parsing and one-time validation | 21+ |
1818
| `json-java21-jtd-codegen` | Bytecode code generator for JTD schemas — ahead-of-time compiled validators for repeated hot-path validation | 24+ (auto-skipped on JDK 21) |
19-
| `jdt2jar` | CLI + distroless container to pre-compile JTD schemas into standalone validator JARs (eliminates JDK 24+ runtime requirement) | 24+ (auto-skipped on JDK 21) |
19+
| `jtd2jar` | CLI + distroless container to pre-compile JTD schemas into standalone validator JARs (eliminates JDK 24+ runtime requirement) | 24+ (auto-skipped on JDK 21) |
2020
| `json-java21-jsonpath` | JsonPath query engine over `jdk.incubator.java.util.json` values (Goessner-style: filters, slices, recursive descent, unions) | 21+ |
2121
| `json-compatibility-suite` | JSON Test Suite conformance reporter (tests against [nst/JSONTestSuite](https://github.com/nst/JSONTestSuite)) | 21+ |
2222
| `json-java21-api-tracker` | Daily upstream API drift detector — fetches OpenJDK sandbox sources, compares public API signatures, reports differences | 25+ |
@@ -393,9 +393,9 @@ Jtd.Result result = validator.validate(schema, data);
393393

394394
## JTD to JAR Compiler (Optional)
395395

396-
An optional `jdt2jar` CLI tool and distroless Docker image are available for pre-compiling JTD schemas into standalone validator JARs at build time. This eliminates the JDK 24+ runtime requirement for generated validators — the JARs run on JDK 21+.
396+
An optional `jtd2jar` CLI tool and distroless Docker image are available for pre-compiling JTD schemas into standalone validator JARs at build time. This eliminates the JDK 24+ runtime requirement for generated validators — the JARs run on JDK 21+.
397397

398-
See [`jdt2jar/README.md`](jdt2jar/README.md) for build instructions, container usage, and the pre-built image on GitHub Container Registry (`ghcr.io`).
398+
See [`jtd2jar/README.md`](jtd2jar/README.md) for build instructions, container usage, and the pre-built image on GitHub Container Registry (`ghcr.io`).
399399

400400
## Building
401401

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
.env
1919

2020
# Local test artifacts
21-
/tmp/jdt2jar-*/
21+
/tmp/jtd2jar-*/
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
FROM eclipse-temurin:25-jdk AS build
44
WORKDIR /build
55
COPY . .
6-
RUN ["./mvnw", "-pl", "jdt2jar", "-am", "package", "-DskipTests", "-Dsurefire.failIfNoSpecifiedTests=false"]
7-
RUN ["java", "-cp", "/build/jdt2jar/target/jdt2jar.jar", "json.java21.jdt2jar.build.DockerImageBuilder", "/build/jdt2jar/target/jdt2jar.jar", "/opt/jre"]
6+
RUN ["./mvnw", "-pl", "jtd2jar", "-am", "package", "-DskipTests", "-Dsurefire.failIfNoSpecifiedTests=false"]
7+
RUN ["java", "-cp", "/build/jtd2jar/target/jtd2jar.jar", "json.java21.jtd2jar.build.DockerImageBuilder", "/build/jtd2jar/target/jtd2jar.jar", "/opt/jre"]
88
RUN ["mkdir", "-p", "/empty-work/tmp", "/empty-app"]
99

1010
FROM gcr.io/distroless/base-debian13:nonroot
@@ -13,5 +13,5 @@ COPY --from=build --chown=65532:65532 /empty-app /app
1313
WORKDIR /work
1414
ENV JAVA_TOOL_OPTIONS="-XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0 -Djava.io.tmpdir=/work/tmp -XX:+ExitOnOutOfMemoryError"
1515
COPY --from=build /opt/jre /jre
16-
COPY --from=build /build/jdt2jar/target/jdt2jar.jar /app/jdt2jar.jar
17-
ENTRYPOINT ["/jre/bin/java","-jar","/app/jdt2jar.jar"]
16+
COPY --from=build /build/jtd2jar/target/jtd2jar.jar /app/jtd2jar.jar
17+
ENTRYPOINT ["/jre/bin/java","-jar","/app/jtd2jar.jar"]
Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
# jdt2jar
1+
# jtd2jar
22

3-
`jdt2jar` compiles a JTD schema into a standalone validator JAR at build time. The generated JAR runs on JDK 21+ with no JDK 25+ runtime dependency.
3+
`jtd2jar` compiles a JTD schema into a standalone validator JAR at build time. The generated JAR runs on JDK 21+ with no JDK 25+ runtime dependency.
44

55
## Use Case
66

77
This tool bridges the gap between the interpreter and codegen paths:
88

99
- **Interpreter** ([`json-java21-jtd`](../json-java21-jtd/README.md)): ideal for infrequent config parsing — simple, no build step, runs on JDK 21+.
1010
- **Codegen** ([`json-java21-jtd-codegen`](../json-java21-jtd-codegen/README.md)): ideal for repeated hot-path validation — ~9x faster, but requires JDK 25+ at runtime.
11-
- **jdt2jar**: pre-compiles schemas into validator JARs at build time (using JDK 25+), then deploys them to any JDK 21+ runtime. Best for CI/CD pipelines, distroless containers, or environments where you want JIT-optimised validators without shipping a JDK 25+ runtime.
11+
- **jtd2jar**: pre-compiles schemas into validator JARs at build time (using JDK 25+), then deploys them to any JDK 21+ runtime. Best for CI/CD pipelines, distroless containers, or environments where you want JIT-optimised validators without shipping a JDK 25+ runtime.
1212

1313
> **Future note**: `java.util.json` has entered the JDK incubator (`jdk.incubator.json`). Once the API stabilises in the JDK itself, generated bytecode validators can depend directly on future JDK classes rather than this backport, making them even more efficient with zero library overhead.
1414
1515
## CLI
1616

1717
```bash
18-
jdt2jar <schema.json> [options]
18+
jtd2jar <schema.json> [options]
1919
```
2020

2121
Options:
@@ -35,24 +35,26 @@ A minimal distroless container image is available for offline schema compilation
3535
### Pre-built Image (GitHub Container Registry)
3636

3737
```bash
38-
docker pull ghcr.io/simbo1905/java.util.json.java21/jdt2jar:latest
39-
docker pull ghcr.io/simbo1905/java.util.json.java21/jdt2jar:2026.05.20
38+
docker pull ghcr.io/simbo1905/java.util.json.java21/jtd2jar:latest
39+
docker pull ghcr.io/simbo1905/java.util.json.java21/jtd2jar:2026.05.20
4040
```
4141

42+
> **Name change**: releases up to and including `2026.08.30` published this image under the misspelled name `ghcr.io/simbo1905/java.util.json.java21/jdt2jar`. Those tags remain on GHCR but are frozen; re-point to `jtd2jar`.
43+
4244
### Build Locally
4345

4446
Requires Docker and JDK 25+ (for the build stage). Build from the repository root:
4547

4648
```bash
47-
docker build -t jdt2jar -f jdt2jar/Dockerfile .
49+
docker build -t jtd2jar -f jtd2jar/Dockerfile .
4850
```
4951

5052
### Usage
5153

5254
The container's working directory is `/work`. Mount your project directory there:
5355

5456
```bash
55-
docker run --rm -v "$(pwd):/work" jdt2jar:latest schema.jtd.json --output schema-validator.jar --main
57+
docker run --rm -v "$(pwd):/work" jtd2jar:latest schema.jtd.json --output schema-validator.jar --main
5658
```
5759

5860
Validate a payload with the generated JAR:
@@ -64,18 +66,18 @@ java -jar schema-validator.jar --validate payload.json
6466
Or validate inside a container:
6567

6668
```bash
67-
docker run --rm -v "$(pwd):/work" --entrypoint /jre/bin/java jdt2jar:latest -jar /work/schema-validator.jar --validate /work/payload.json
69+
docker run --rm -v "$(pwd):/work" --entrypoint /jre/bin/java jtd2jar:latest -jar /work/schema-validator.jar --validate /work/payload.json
6870
```
6971

7072
### Helper Script
7173

7274
For environments where volume mounts are restricted (e.g., Colima on macOS with projects outside `~/`), use the helper script:
7375

7476
```bash
75-
./scripts/jdt2jar.sh schema.jtd.json --output schema-validator.jar --main
77+
./scripts/jtd2jar.sh schema.jtd.json --output schema-validator.jar --main
7678
```
7779

78-
The script syncs source to `~/tmp/jdt2jar-work`, runs the container, and syncs output back.
80+
The script syncs source to `~/tmp/jtd2jar-work`, runs the container, and syncs output back.
7981

8082
### Image Properties
8183

@@ -89,6 +91,6 @@ The script syncs source to `~/tmp/jdt2jar-work`, runs the container, and syncs o
8991
### Security Scanning
9092

9193
```bash
92-
syft packages image:ghcr.io/simbo1905/java.util.json.java21/jdt2jar:latest
93-
grype ghcr.io/simbo1905/java.util.json.java21/jdt2jar:latest
94+
syft packages image:ghcr.io/simbo1905/java.util.json.java21/jtd2jar:latest
95+
grype ghcr.io/simbo1905/java.util.json.java21/jtd2jar:latest
9496
```

jdt2jar/pom.xml renamed to jtd2jar/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
<version>2026.08.30</version>
1212
</parent>
1313

14-
<artifactId>jdt2jar</artifactId>
14+
<artifactId>jtd2jar</artifactId>
1515
<packaging>jar</packaging>
16-
<name>jdt2jar CLI</name>
16+
<name>jtd2jar CLI</name>
1717
<description>Offline JTD-to-JAR compiler that packages generated validators into standalone JAR files.</description>
1818

1919
<properties>
2020
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2121
<maven.compiler.release>24</maven.compiler.release>
22-
<project.build.finalName>jdt2jar</project.build.finalName>
22+
<project.build.finalName>jtd2jar</project.build.finalName>
2323
</properties>
2424

2525
<dependencies>
@@ -86,10 +86,10 @@
8686
<configuration>
8787
<createDependencyReducedPom>false</createDependencyReducedPom>
8888
<shadedArtifactAttached>false</shadedArtifactAttached>
89-
<finalName>jdt2jar</finalName>
89+
<finalName>jtd2jar</finalName>
9090
<transformers>
9191
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
92-
<mainClass>json.java21.jdt2jar.Jdt2Jar</mainClass>
92+
<mainClass>json.java21.jtd2jar.Jtd2Jar</mainClass>
9393
</transformer>
9494
</transformers>
9595
</configuration>

jdt2jar/src/main/java/json/java21/jdt2jar/Jdt2Jar.java renamed to jtd2jar/src/main/java/json/java21/jtd2jar/Jtd2Jar.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package json.java21.jdt2jar;
1+
package json.java21.jtd2jar;
22

33
import jdk.incubator.java.util.json.Json;
44
import json.java21.jtd.codegen.JtdCodegen;
@@ -23,26 +23,26 @@
2323
///
2424
/// Builds a standalone validator JAR from a schema file and can optionally
2525
/// include a `java -jar` entry point and a companion source file.
26-
public final class Jdt2Jar {
26+
public final class Jtd2Jar {
2727

28-
static final Logger LOG = Logger.getLogger(Jdt2Jar.class.getName());
28+
static final Logger LOG = Logger.getLogger(Jtd2Jar.class.getName());
2929

3030
private static final int DEFAULT_RUNTIME = 21;
3131
private static final String DEFAULT_PACKAGE = "jtd.generated";
3232
private static final String DEFAULT_CLASS = "SchemaValidator";
33-
private static final String PROPERTIES_ENTRY = "jdt2jar.properties";
33+
private static final String PROPERTIES_ENTRY = "jtd2jar.properties";
3434
private static final String SCHEMA_ENTRY = "jtd/schema.json";
35-
private static final String MAIN_CLASS = "json.java21.jdt2jar.runtime.ValidatorMain";
35+
private static final String MAIN_CLASS = "json.java21.jtd2jar.runtime.ValidatorMain";
3636

37-
private Jdt2Jar() {}
37+
private Jtd2Jar() {}
3838

3939
public static void main(String[] args) {
4040
System.exit(run(args));
4141
}
4242

4343
public static int run(String[] args) {
4444
try {
45-
return new Jdt2Jar().execute(args);
45+
return new Jtd2Jar().execute(args);
4646
} catch (UsageException e) {
4747
System.err.println(e.getMessage());
4848
System.err.println();
@@ -86,7 +86,7 @@ private static void writeValidatorJar(Path output, Options options, String schem
8686
final var manifest = new Manifest();
8787
final var attrs = manifest.getMainAttributes();
8888
attrs.putValue("Manifest-Version", "1.0");
89-
attrs.putValue("Created-By", "jdt2jar");
89+
attrs.putValue("Created-By", "jtd2jar");
9090
if (options.main()) {
9191
attrs.putValue("Main-Class", MAIN_CLASS);
9292
}
@@ -163,7 +163,7 @@ private static boolean shouldCopyRuntime(String path) {
163163
|| path.startsWith("json/java21/jtd/"))
164164
&& !path.startsWith("json/java21/jtd/codegen/")
165165
|| path.startsWith("json/java21/jtd/codegen/JtdValidator.class")
166-
|| path.startsWith("json/java21/jdt2jar/runtime/");
166+
|| path.startsWith("json/java21/jtd2jar/runtime/");
167167
}
168168

169169
private static void writeEntry(JarOutputStream out, Set<String> written, String name, byte[] bytes)
@@ -184,7 +184,7 @@ private static byte[] propertiesBytes(Options options) {
184184
props.setProperty("schemaEntry", SCHEMA_ENTRY);
185185
props.setProperty("runtime", Integer.toString(options.runtime()));
186186
try (final var out = new ByteArrayOutputStream()) {
187-
props.store(out, "jdt2jar");
187+
props.store(out, "jtd2jar");
188188
return out.toByteArray();
189189
} catch (IOException e) {
190190
throw new UncheckedIOException(e);
@@ -204,7 +204,7 @@ private static void writeSourceFile(Path sourcePath, Options options) throws IOE
204204
205205
import jdk.incubator.java.util.json.JsonValue;
206206
import json.java21.jtd.JtdValidationResult;
207-
import json.java21.jdt2jar.runtime.ValidatorMain;
207+
import json.java21.jtd2jar.runtime.ValidatorMain;
208208
209209
public final class %s implements json.java21.jtd.JtdValidator {
210210
private final String schemaJson;
@@ -308,7 +308,7 @@ private static String toQualifiedName(String packageName, String className) {
308308

309309
private static void printUsage() {
310310
System.out.println("""
311-
jdt2jar <schema.json> [options]
311+
jtd2jar <schema.json> [options]
312312
313313
Options:
314314
--output <path> Output JAR path (default: <schema-name>-validator.jar)

jdt2jar/src/main/java/json/java21/jdt2jar/build/DockerImageBuilder.java renamed to jtd2jar/src/main/java/json/java21/jtd2jar/build/DockerImageBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package json.java21.jdt2jar.build;
1+
package json.java21.jtd2jar.build;
22

33
import java.io.IOException;
44
import java.nio.charset.StandardCharsets;
@@ -16,7 +16,7 @@ private DockerImageBuilder() {}
1616

1717
public static void main(String[] args) throws Exception {
1818
if (args.length != 2) {
19-
throw new IllegalArgumentException("Usage: DockerImageBuilder <jdt2jar.jar> <jre-output-dir>");
19+
throw new IllegalArgumentException("Usage: DockerImageBuilder <jtd2jar.jar> <jre-output-dir>");
2020
}
2121
final var jar = Path.of(args[0]);
2222
final var jreOutput = Path.of(args[1]);

0 commit comments

Comments
 (0)