Class BamlPlugin

java.lang.Object
com.boundaryml.baml.gradle.BamlPlugin
All Implemented Interfaces:
org.gradle.api.Plugin<org.gradle.api.Project>

public class BamlPlugin extends Object implements org.gradle.api.Plugin<org.gradle.api.Project>
The BAML Gradle plugin (com.boundaryml.baml) — pattern C of ref-java-packaging.md: generate the typed BAML Java SDK at build time.

Applying the plugin:

  • applies the java plugin (so the source sets exist);
  • registers the baml { ... } extension;
  • registers the cacheable GenerateBamlTask generateBaml;
  • adds generateBaml's output as a Java source root and its baml_sdk/**&#47;*.b64 bytecode as a resource, and makes compileJava / processResources depend on it;
  • auto-manages the BAML runtime dependencies (the JavaFX-plugin pattern): injects com.boundaryml:baml-bridge at the plugin's own version plus the native jar for the build machine, so plugins { id("com.boundaryml.baml") version "X" } is the entire setup. See BamlExtension for the opt-outs.

The generated tree lands under build/generated/sources/baml/java/main and is (re)generated only when baml.toml, baml_src/**, or the resolved CLI version change.

  • Constructor Details

    • BamlPlugin

      public BamlPlugin()
  • Method Details

    • apply

      public void apply(org.gradle.api.Project project)
      Specified by:
      apply in interface org.gradle.api.Plugin<org.gradle.api.Project>