Package dev.gmitch215.bytebox.gradle


package dev.gmitch215.bytebox.gradle
The Gradle plugin that turns a Java workspace into a Cloudflare Worker.

ByteboxPlugin registers the bytebox { } block and a pipeline ending in buildWorker. What makes it more than a wrapper around the compiler is that it derives rather than asks: which handlers the Worker exports comes from the interfaces the handler class implements, and which JSON codecs exist comes from what is annotated. Neither is declared twice, so neither can drift.

Two things are worth knowing before reading the tasks. The generated code lives in its own source set rather than in main, because deciding what to generate means reading the compiled handler and putting the result in main would make compiling it depend on itself. And everything up to buildWorker runs with no Cloudflare credentials at all — only the commands that reach the account need a login, and each says so.

Since:
1.0.0
  • Class
    Description
    One declared binding, with the name it resolved to.
    The bindings { } block.
    Identifiers a D1 database can carry.
    Identifiers a KV namespace can carry.
    Identifiers an R2 bucket can carry.
    Prints every declared binding, its resolved name, and the remote resource it points at.
    A binding type, for the short form of the bindings block.
    The bytebox { } block.
    Compiles a Java workspace into a Cloudflare Worker.
    Checks a compatibility date before Wrangler has to.
    A Durable Object class written in Java, and which of its handlers exist.
    Writes a JSON codec for every type asked for, and one class that registers them all.
    Writes the Java class the compiled module exports its handlers from.
    Writes Java bindings for the npm packages a project asks for, from their TypeScript types.
    Writes the Worker project around the compiled module: the Wrangler configuration, the JavaScript entry point, and the package manifest.
    Writes a codec for every type annotated @SerialType, in Java's own serialization format.
    Puts the compiled module where the Worker imports it from, and enforces the size budget.
    Finds something that can run a Node command-line tool.
    Measures the compiled module and prints one row per compression axis.
    The size { } block: how the compiled module is packed, and how big it may get.
    Which compressor packs the module.
    How the compiled module is carried in the bundle.
    Which triggers a handler class handles.
    The wrangler { } block: what goes into the generated configuration.
    Runs the Wrangler CLI in the generated Worker project.