Class PackWasmTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
dev.gmitch215.bytebox.gradle.PackWasmTask
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 PackWasmTask extends org.gradle.api.DefaultTask
Puts the compiled module where the Worker imports it from, and enforces the size budget.

The module is carried as raw bytes rather than compiled by Wrangler, because a CompiledWasm module is compiled by the platform and there is no way to pass it the JS String Builtins option the compiler's output needs. Raw bytes also measure smaller at these sizes: Cloudflare's own gzip is applied either way, and a pre-compressed frame has to pay for a synchronous decompressor in the same bundle.

Since:
1.0.0
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.gradle.api.Named

    org.gradle.api.Named.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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract org.gradle.api.provider.Property<Long>
    Returns the ceiling to fail past, in bytes on the gzip meter, or -1 for none.
    abstract org.gradle.api.provider.Property<SizeSpec.Compressor>
    Returns the compressor, when one was chosen.
    abstract org.gradle.api.provider.Property<SizeSpec.ModuleType>
    Returns how the module is carried.
    abstract org.gradle.api.file.DirectoryProperty
    Returns where the Worker's sources live.
    abstract org.gradle.api.file.RegularFileProperty
    Returns the generated runtime beside it.
    abstract org.gradle.api.file.RegularFileProperty
    Returns the compiled module.
    void
    Packs the module.

    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, usesService

    Methods inherited from class org.gradle.api.internal.AbstractTask

    acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjects

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.gradle.api.Task

    doNotTrackState, notCompatibleWithConfigurationCache
  • Constructor Details

    • PackWasmTask

      public PackWasmTask()
  • Method Details

    • getWasm

      @InputFile @PathSensitive(NONE) public abstract org.gradle.api.file.RegularFileProperty getWasm()
      Returns the compiled module.
      Returns:
      the compiled module
    • getRuntime

      @InputFile @PathSensitive(NONE) public abstract org.gradle.api.file.RegularFileProperty getRuntime()
      Returns the generated runtime beside it.
      Returns:
      the generated runtime beside it
    • getModuleType

      @Input public abstract org.gradle.api.provider.Property<SizeSpec.ModuleType> getModuleType()
      Returns how the module is carried.
      Returns:
      how the module is carried
    • getBudget

      @Input public abstract org.gradle.api.provider.Property<Long> getBudget()
      Returns the ceiling to fail past, in bytes on the gzip meter, or -1 for none.
      Returns:
      the ceiling to fail past, in bytes on the gzip meter, or -1 for none
    • getOutputDirectory

      @OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getOutputDirectory()
      Returns where the Worker's sources live.
      Returns:
      where the Worker's sources live
    • getCompression

      @Input @Optional public abstract org.gradle.api.provider.Property<SizeSpec.Compressor> getCompression()
      Returns the compressor, when one was chosen.
      Returns:
      the compressor, when one was chosen
    • pack

      public void pack()
      Packs the module.