Class GenerateBamlTask
java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
com.boundaryml.baml.gradle.GenerateBamlTask
- All Implemented Interfaces:
Comparable<org.gradle.api.Task>,org.gradle.api.internal.DynamicObjectAware,org.gradle.api.internal.TaskInternal,org.gradle.api.Named,org.gradle.api.plugins.ExtensionAware,org.gradle.api.Task,org.gradle.util.Configurable<org.gradle.api.Task>
@CacheableTask
public abstract class GenerateBamlTask
extends org.gradle.api.DefaultTask
Runs
baml generate to produce the typed BAML Java SDK.
Cacheable and incremental: the declared inputs are baml.toml, every
file under baml_src/, and the resolved CLI version string; the output
is build/generated/sources/baml/java/main. Gradle skips the task as
UP-TO-DATE when none of those changed.
The output directory is cleaned before each generation (BAML's own
generate does not remove stale files — a renamed/deleted BAML class
would otherwise leave a stale .java that still compiles).
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gradle.api.Task
org.gradle.api.Task.Namer -
Field Summary
Fields inherited from interface org.gradle.api.Task
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidgenerate()abstract org.gradle.api.provider.Property<String> Thebamlexecutable (bare name resolved on PATH, or abs path).abstract org.gradle.api.file.ConfigurableFileCollectionEvery file underbaml_src/— the BAML sources.abstract org.gradle.api.file.RegularFilePropertybaml.toml— a declared input so config changes retrigger generation.abstract org.gradle.api.provider.Property<String> The resolved CLI version (frombaml --version).abstract org.gradle.process.ExecOperationsabstract org.gradle.api.file.FileSystemOperationsabstract org.gradle.api.file.DirectoryPropertybuild/generated/sources/baml/java/main— the generated tree root.abstract org.gradle.api.file.DirectoryPropertyThe project directory passed to the CLI as--from.Methods inherited from class org.gradle.api.DefaultTask
compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesServiceMethods inherited from class org.gradle.api.internal.AbstractTask
acceptServiceReferences, appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, setImpliesSubProjectsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gradle.api.Task
doNotTrackState, getConvention, notCompatibleWithConfigurationCache
-
Constructor Details
-
GenerateBamlTask
public GenerateBamlTask()
-
-
Method Details
-
getBamlExecutable
Thebamlexecutable (bare name resolved on PATH, or abs path). -
getSrcDir
@Internal public abstract org.gradle.api.file.DirectoryProperty getSrcDir()The project directory passed to the CLI as--from. -
getBamlToml
@InputFile @PathSensitive(RELATIVE) public abstract org.gradle.api.file.RegularFileProperty getBamlToml()baml.toml— a declared input so config changes retrigger generation. -
getBamlSources
@InputFiles @PathSensitive(RELATIVE) public abstract org.gradle.api.file.ConfigurableFileCollection getBamlSources()Every file underbaml_src/— the BAML sources. -
getBamlVersion
The resolved CLI version (frombaml --version). An@Inputso a toolchain bump retriggers generation. Wired byBamlPluginto a provider that returns an empty string when the executable is missing or fails to run — in which casegenerate()fails with an install hint (never at configuration time). -
getOutputDir
@OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getOutputDir()build/generated/sources/baml/java/main— the generated tree root. -
getExecOperations
@Inject public abstract org.gradle.process.ExecOperations getExecOperations() -
getFileSystemOperations
@Inject public abstract org.gradle.api.file.FileSystemOperations getFileSystemOperations() -
generate
public void generate()
-