# runtime-kit 1.0 Every page: [llms.txt](llms.txt), or all in one file: [llms-full.txt](llms-full.txt) Plan a Java application for the JVM or a native executable. Runtime Kit separates the configuration of an application from the tool that prepares it. An immutable [`BuildPlan`](example/runtime/BuildPlan.md) holds the entry point and compiler arguments. A [`Planner.Local`](example/runtime/Planner.Local.md) validates the plan for the chosen [`Target`](example/runtime/Target.md). Start with the preparation guide for a runnable example, or explore the package reference for constructors, extension points, and error handling. ## Guides - [Write a preparation step](guides/custom-step.md): Use the generic extension point to derive a launch command. - [Prepare your first build](guides/prepare-a-build.md): Create an immutable plan, select a runtime, and handle validation errors. ## Packages - [`example.runtime`](example/runtime/index.md): Plans Java applications for a local JVM or native executable. ## Types in `example.runtime` - [`BuildPlan`](example/runtime/BuildPlan.md) (record): Describes how to build a Java application as a native executable. - [`BuildStep`](example/runtime/BuildStep.md) (interface): A named phase in the preparation of a BuildPlan. - [`Experimental`](example/runtime/Experimental.md) (annotation interface): Marks a runtime API whose contract may evolve before the next release. - [`PlanException`](example/runtime/PlanException.md) (exception): Indicates that a BuildPlan cannot be prepared. - [`Planner`](example/runtime/Planner.md) (sealed abstract class): Validates a BuildPlan before handing it to a BuildStep. - [`Planner.Local`](example/runtime/Planner.Local.md) (class): Prepares builds against a locally installed toolchain. - [`Planner.Options`](example/runtime/Planner.Options.md) (record): Configuration for Local, including how to report progress. - [`Planner.Options.Detail`](example/runtime/Planner.Options.Detail.md) (enum class): Controls progress while preparing a plan. - [`Target`](example/runtime/Target.md) (enum class): Selects the runtime that will consume a BuildPlan. # Write a preparation step [runtime-kit](../index.md) › Guides · Every page: [llms.txt](../llms.txt) *Use the generic extension point to derive a launch command.* ## Choose the output type [`BuildStep`](../example/runtime/BuildStep.md) describes the result of preparation. A step can return a command line, a manifest, or another build plan. ```java BuildStep> launch = p -> List.of("java", p.mainClass()); ``` ## Apply the step Pass a validated [`BuildPlan`](../example/runtime/BuildPlan.md) to the step. The result contains the command and its argument as separate entries. ```java var command = launch.prepare(BuildPlan.defaults("example.Main")); ``` --- Next: [Prepare your first build](prepare-a-build.md) # Prepare your first build [runtime-kit](../index.md) › Guides · Every page: [llms.txt](../llms.txt) *Create an immutable plan, select a runtime, and handle validation errors.* ## Choose an entry point Use [`BuildPlan.defaults(String)`](../example/runtime/BuildPlan.md#defaults%28java.lang.String%29) for a plan with no extra compiler flags. The entry point is the fully qualified class name. ```java var plan = BuildPlan.defaults("example.Main"); ``` ## Select the runtime Construct a [`Planner.Local`](../example/runtime/Planner.Local.md) for the JVM. For fine-grained progress reporting, pass [`Planner.Options`](../example/runtime/Planner.Options.md) to the overloaded constructor. ```java var planner = new Planner.Local(Target.JVM); ``` ## Validate the plan Preparation returns the validated plan. A blank entry point raises [`PlanException`](../example/runtime/PlanException.md) before execution. ```java try { var ready = planner.prepare(plan); System.out.println(ready.mainClass()); } catch (PlanException rejected) { System.err.println(rejected.getMessage()); } ``` --- Previous: [Write a preparation step](custom-step.md) # example.runtime [runtime-kit](../../index.md) · Every page: [llms.txt](../../llms.txt) Package in runtime-kit. Since 1.0. Plans Java applications for a local JVM or native executable. ### Preparing a build Start with [`example.runtime.BuildPlan.defaults(String)`](BuildPlan.md#defaults%28java.lang.String%29), select a [`example.runtime.Target`](Target.md), and pass the plan to [`example.runtime.Planner.Local`](Planner.Local.md). Preparation validates configuration before a compiler is invoked. ### Extending a build Implement [`example.runtime.BuildStep`](BuildStep.md) to transform a plan into another artifact. Report invalid input with [`example.runtime.PlanException`](PlanException.md). ## Interfaces - [`BuildStep`](BuildStep.md): A named phase in the preparation of a BuildPlan. ## Classes - [`Planner`](Planner.md): Validates a BuildPlan before handing it to a BuildStep. ## Records - [`BuildPlan`](BuildPlan.md): Describes how to build a Java application as a native executable. ## Enums - [`Target`](Target.md): Selects the runtime that will consume a BuildPlan. ## Exceptions - [`PlanException`](PlanException.md): Indicates that a BuildPlan cannot be prepared. ## Annotations - [`Experimental`](Experimental.md): Marks a runtime API whose contract may evolve before the next release. # BuildPlan ## API at a glance - mainClass: the fully qualified entry point - arguments: compiler arguments in invocation order - BuildPlan(String, List): Creates a plan with a stable copy of the arguments. - defaults(String): Returns a plan for the entry point using default compiler settings. Returns a plan with an empty argument list - toString(): Returns a string containing the record class name and its component names and values. - hashCode(): Returns a hash code computed from the record components. - equals(Object): Returns whether the other object is a record of the same class with equal components. - mainClass(): the fully qualified entry point [runtime-kit](../../index.md) › [example.runtime](index.md) · Every page: [llms.txt](../../llms.txt) Record in [`example.runtime`](index.md). Since 1.0. ```java public record BuildPlan(String mainClass, List arguments) ``` Inheritance: `Object` > `Record` > `BuildPlan` Describes how to build a Java application as a native executable. Pass this plan to a [`Planner.Local`](Planner.Local.md) for validation against a [`Target`](Target.md). For example: ```java var plan = new BuildPlan("example.Main", List.of("-O2")); ``` **Record components** - `mainClass` `String`: the fully qualified entry point - `arguments` `List`: compiler arguments in invocation order **See also** - [Write a preparation step](../../guides/custom-step.md) - [Prepare your first build](../../guides/prepare-a-build.md) ## Constructors ### BuildPlan(String, List) ```java public BuildPlan(String mainClass, List arguments) ``` Creates a plan with a stable copy of the arguments. **Parameters** - `mainClass` `String`: the fully qualified entry point - `arguments` `List`: compiler arguments in invocation order ## Methods ### defaults(String) ```java public static BuildPlan defaults(String mainClass) ``` Returns a plan for the entry point using default compiler settings. **Parameters** - `mainClass` `String`: the fully qualified entry point **Returns** [`BuildPlan`](BuildPlan.md): a plan with an empty argument list ### toString() ```java public final String toString() ``` Returns a string containing the record class name and its component names and values. **Returns** `String`: Returns a string containing the record class name and its component names and values. Overrides `toString()`. ### hashCode() ```java public final int hashCode() ``` Returns a hash code computed from the record components. **Returns** `int`: Returns a hash code computed from the record components. Overrides `hashCode()`. ### equals(Object) ```java public final boolean equals(Object o) ``` Returns whether the other object is a record of the same class with equal components. **Parameters** - `o` `Object`: The object to compare with this record. **Returns** `boolean`: Returns whether the other object is a record of the same class with equal components. Overrides `equals(java.lang.Object)`. ### mainClass() ```java public String mainClass() ``` the fully qualified entry point **Returns** `String`: the fully qualified entry point ### arguments() ```java public List arguments() ``` compiler arguments in invocation order **Returns** `List`: compiler arguments in invocation order ## Inherited members - From class `Object`: `getClass`, `notify`, `notifyAll`, `wait`, `wait`, `wait` # BuildStep ## API at a glance - prepare(BuildPlan): Prepares an artifact without executing the application. Returns the prepared artifact Throws PlanException if the configuration cannot be prepared [runtime-kit](../../index.md) › [example.runtime](index.md) · Every page: [llms.txt](../../llms.txt) Interface in [`example.runtime`](index.md). ```java @FunctionalInterface public interface BuildStep ``` A named phase in the preparation of a [`BuildPlan`](BuildPlan.md). **Type parameters** - ``: the artifact produced by the step **See also** - [Write a preparation step](../../guides/custom-step.md) ## Methods ### prepare(BuildPlan) ```java T prepare(BuildPlan plan) throws PlanException ``` Prepares an artifact without executing the application. **Parameters** - `plan` [`BuildPlan`](BuildPlan.md): the input configuration **Returns** `T`: the prepared artifact **Throws** - [`PlanException`](PlanException.md): if the configuration cannot be prepared # Experimental ## API at a glance - since(): The version in which the experiment began. [runtime-kit](../../index.md) › [example.runtime](index.md) · Every page: [llms.txt](../../llms.txt) Annotation interface in [`example.runtime`](index.md). ```java @Documented @Retention(RUNTIME) @Target({TYPE, METHOD}) public @interface Experimental ``` Marks a runtime API whose contract may evolve before the next release. ## Elements ### since() ```java String since() default "1.0" ``` The version in which the experiment began. **Returns** `String`: No description. Default: `"1.0"` # PlanException ## API at a glance - PlanException(String): Creates a failure with an explanation suitable for the build log. [runtime-kit](../../index.md) › [example.runtime](index.md) · Every page: [llms.txt](../../llms.txt) Exception in [`example.runtime`](index.md). ```java public final class PlanException extends Exception ``` Inheritance: `Object` > `Throwable` > `Exception` > `PlanException` Indicates that a [`BuildPlan`](BuildPlan.md) cannot be prepared. **See also** - [Prepare your first build](../../guides/prepare-a-build.md) ## Constructors ### PlanException(String) ```java public PlanException(String reason) ``` Creates a failure with an explanation suitable for the build log. **Parameters** - `reason` `String`: the rejected setting ## Inherited members - From class `Throwable`: `addSuppressed`, `fillInStackTrace`, `getCause`, `getLocalizedMessage`, `getMessage`, `getStackTrace`, `getSuppressed`, `initCause`, `printStackTrace`, `printStackTrace`, `printStackTrace`, `setStackTrace`, `toString` - From class `Object`: `equals`, `getClass`, `hashCode`, `notify`, `notifyAll`, `wait`, `wait`, `wait` # Planner ## API at a glance - target(): Identifies the runtime for prepared plans. Returns the selected target - prepare(BuildPlan): Validates that the plan names an entry point. Returns the validated plan Throws PlanException when the entry point is blank [runtime-kit](../../index.md) › [example.runtime](index.md) · Every page: [llms.txt](../../llms.txt) Sealed abstract class in [`example.runtime`](index.md). Since 1.0. ```java public abstract sealed class Planner implements BuildStep permits Planner.Local ``` Inheritance: `Object` > `Planner` Implements: [`BuildStep`](BuildStep.md)`<`[`BuildPlan`](BuildPlan.md)`>` Permitted subtypes: [`Planner.Local`](Planner.Local.md) Validates a [`BuildPlan`](BuildPlan.md) before handing it to a [`BuildStep`](BuildStep.md). Select a [`Target`](Target.md) and call [`prepare(BuildPlan)`](Planner.md#prepare%28example.runtime.BuildPlan%29) to check the entry point. **See also** - [`Planner.Options`](Planner.Options.md) ## Nested types - [`Planner.Local`](Planner.Local.md) (class): Prepares builds against a locally installed toolchain. - [`Planner.Options`](Planner.Options.md) (record): Configuration for Local, including how to report progress. ## Methods ### target() ```java public abstract Target target() ``` Identifies the runtime for prepared plans. **Returns** [`Target`](Target.md): the selected target ### prepare(BuildPlan) ```java public BuildPlan prepare(BuildPlan plan) throws PlanException ``` Validates that the plan names an entry point. **Parameters** - `plan` [`BuildPlan`](BuildPlan.md): configuration to validate **Returns** [`BuildPlan`](BuildPlan.md): the validated plan **Throws** - [`PlanException`](PlanException.md): when the entry point is blank Overrides [`prepare()`](BuildStep.md#prepare%28example.runtime.BuildPlan%29). ## Inherited members - From class `Object`: `equals`, `getClass`, `hashCode`, `notify`, `notifyAll`, `toString`, `wait`, `wait`, `wait` # Planner.Local ## API at a glance - Local(Planner.Options): Uses explicit planning options. - Local(Target): Uses the supplied target with quiet progress. - target(): Identifies the runtime for prepared plans. Returns the selected target - runtime(): Deprecated. Use target(). Returns the configured runtime. Returns the selected target [runtime-kit](../../index.md) › [example.runtime](index.md) · Every page: [llms.txt](../../llms.txt) Class in [`example.runtime`](index.md). Nested in [`Planner`](Planner.md). ```java @Experimental public static final class Planner.Local extends Planner ``` Inheritance: `Object` > [`Planner`](Planner.md) > `Local` Prepares builds against a locally installed toolchain. **See also** - [Prepare your first build](../../guides/prepare-a-build.md) ## Constructors ### Local(Planner.Options) ```java public Local(Planner.Options options) ``` Uses explicit planning options. **Parameters** - `options` [`Planner.Options`](Planner.Options.md): runtime and progress settings ### Local(Target) ```java public Local(Target target) ``` Uses the supplied target with quiet progress. **Parameters** - `target` [`Target`](Target.md): the runtime ## Methods ### target() ```java public Target target() ``` Identifies the runtime for prepared plans. Description copied from [`target()`](Planner.md#target%28%29). **Returns** [`Target`](Target.md): the selected target Overrides [`target()`](Planner.md#target%28%29). ### runtime() ```java @Deprecated(since = "1.0") public Target runtime() ``` > **Deprecated since 1.0.** > > Use [`target()`](Planner.Local.md#target%28%29). Returns the configured runtime. **Returns** [`Target`](Target.md): the selected target ## Inherited members - From class [`Planner`](Planner.md): [`prepare`](Planner.md#prepare%28example.runtime.BuildPlan%29) - From class `Object`: `equals`, `getClass`, `hashCode`, `notify`, `notifyAll`, `toString`, `wait`, `wait`, `wait` # Planner.Options ## API at a glance - target: the runtime - detail: the amount of progress to report - toString(): Returns a string containing the record class name and its component names and values. - hashCode(): Returns a hash code computed from the record components. - equals(Object): Returns whether the other object is a record of the same class with equal components. - target(): the runtime - detail(): the amount of progress to report [runtime-kit](../../index.md) › [example.runtime](index.md) · Every page: [llms.txt](../../llms.txt) Record in [`example.runtime`](index.md). Nested in [`Planner`](Planner.md). ```java public record Planner.Options(Target target, Planner.Options.Detail detail) ``` Inheritance: `Object` > `Record` > `Options` Configuration for [`Local`](Planner.Local.md), including how to report progress. **Record components** - `target` [`Target`](Target.md): the runtime - `detail` [`Planner.Options.Detail`](Planner.Options.Detail.md): the amount of progress to report **See also** - [Prepare your first build](../../guides/prepare-a-build.md) ## Nested types - [`Planner.Options.Detail`](Planner.Options.Detail.md) (enum class): Controls progress while preparing a plan. ## Constructors ### Options(Target, Planner.Options.Detail) ```java public Options(Target target, Planner.Options.Detail detail) ``` Declared by the compiler. Creates a new Options instance. **Parameters** - `target` [`Target`](Target.md): the runtime - `detail` [`Planner.Options.Detail`](Planner.Options.Detail.md): the amount of progress to report ## Methods ### toString() ```java public final String toString() ``` Returns a string containing the record class name and its component names and values. **Returns** `String`: Returns a string containing the record class name and its component names and values. Overrides `toString()`. ### hashCode() ```java public final int hashCode() ``` Returns a hash code computed from the record components. **Returns** `int`: Returns a hash code computed from the record components. Overrides `hashCode()`. ### equals(Object) ```java public final boolean equals(Object o) ``` Returns whether the other object is a record of the same class with equal components. **Parameters** - `o` `Object`: The object to compare with this record. **Returns** `boolean`: Returns whether the other object is a record of the same class with equal components. Overrides `equals(java.lang.Object)`. ### target() ```java public Target target() ``` the runtime **Returns** [`Target`](Target.md): the runtime ### detail() ```java public Planner.Options.Detail detail() ``` the amount of progress to report **Returns** [`Planner.Options.Detail`](Planner.Options.Detail.md): the amount of progress to report ## Inherited members - From class `Object`: `getClass`, `notify`, `notifyAll`, `wait`, `wait`, `wait` # Planner.Options.Detail ## API at a glance - QUIET: Report only the result. - VERBOSE: Include each preparation step. - values(): Returns the enum constants in declaration order. - valueOf(String): Returns the enum constant with the given name. [runtime-kit](../../index.md) › [example.runtime](index.md) · Every page: [llms.txt](../../llms.txt) Enum class in [`example.runtime`](index.md). Nested in [`Planner.Options`](Planner.Options.md). ```java public enum Planner.Options.Detail ``` Inheritance: `Object` > `Enum` > `Detail` Controls progress while preparing a plan. ## Enum constants ### QUIET ```java QUIET ``` Report only the result. ### VERBOSE ```java VERBOSE ``` Include each preparation step. ## Methods ### values() ```java public static Planner.Options.Detail[] values() ``` Returns the enum constants in declaration order. **Returns** [`Planner.Options.Detail`](Planner.Options.Detail.md)`[]`: Returns the enum constants in declaration order. ### valueOf(String) ```java public static Planner.Options.Detail valueOf(String name) ``` Returns the enum constant with the given name. **Parameters** - `name` `String`: The exact name of the enum constant. **Returns** [`Planner.Options.Detail`](Planner.Options.Detail.md): Returns the enum constant with the given name. ## Inherited members - From class `Enum`: `compareTo`, `describeConstable`, `equals`, `getDeclaringClass`, `hashCode`, `name`, `ordinal`, `toString`, `valueOf` - From class `Object`: `getClass`, `notify`, `notifyAll`, `wait`, `wait`, `wait` # Target ## API at a glance - JVM: Use the installed Java virtual machine. - NATIVE: Compile an operating-system executable. - values(): Returns the enum constants in declaration order. - valueOf(String): Returns the enum constant with the given name. [runtime-kit](../../index.md) › [example.runtime](index.md) · Every page: [llms.txt](../../llms.txt) Enum class in [`example.runtime`](index.md). ```java public enum Target ``` Inheritance: `Object` > `Enum` > `Target` Selects the runtime that will consume a [`BuildPlan`](BuildPlan.md). ## Enum constants ### JVM ```java JVM ``` Use the installed Java virtual machine. ### NATIVE ```java NATIVE ``` Compile an operating-system executable. ## Methods ### values() ```java public static Target[] values() ``` Returns the enum constants in declaration order. **Returns** [`Target`](Target.md)`[]`: Returns the enum constants in declaration order. ### valueOf(String) ```java public static Target valueOf(String name) ``` Returns the enum constant with the given name. **Parameters** - `name` `String`: The exact name of the enum constant. **Returns** [`Target`](Target.md): Returns the enum constant with the given name. ## Inherited members - From class `Enum`: `compareTo`, `describeConstable`, `equals`, `getDeclaringClass`, `hashCode`, `name`, `ordinal`, `toString`, `valueOf` - From class `Object`: `getClass`, `notify`, `notifyAll`, `wait`, `wait`, `wait`