Class SpellscrollBuildUiTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
app.spellscroll.task.SpellscrollBuildUiTask
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>

@DisableCachingByDefault(because="Delegates to npm which manages its own incremental builds") public abstract class SpellscrollBuildUiTask extends org.gradle.api.DefaultTask
Gradle task that builds the Spellscroll UI module using npm.

Runs npm install and npm run build inside the configured uiModuleDir. The build output is written to the outputDir and automatically bundled into the plugin JAR under /ui via processResources.

The task skips gracefully (with a lifecycle log message) if any of the following are true:

  • The UI module directory does not exist.
  • No package.json is found in the UI module directory.
  • package.json does not declare a dependency on @spellscroll/ui-sdk.

Caching is disabled because npm manages its own incremental builds internally. Run ./gradlew spellscrollBuildUi manually only if needed; it runs automatically as part of the normal build via its processResources dependency.

  • 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
    void
    Runs npm install and npm run build in the UI module directory.
    abstract org.gradle.api.file.DirectoryProperty
    The directory into which npm places its build output.
    abstract org.gradle.api.provider.Property<String>
    Path to the UI module npm project directory (i.e.

    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

    • SpellscrollBuildUiTask

      public SpellscrollBuildUiTask()
  • Method Details

    • getUiModuleDir

      @Input public abstract org.gradle.api.provider.Property<String> getUiModuleDir()
      Path to the UI module npm project directory (i.e. the directory containing package.json and spellscroll.config.js).
      Returns:
      the UI module directory property
    • getOutputDir

      @OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getOutputDir()
      The directory into which npm places its build output. Declared so Gradle's up-to-date checks know what this task produces, and so processResources can reference it as a source.

      Defaults to build/generated/frontend.

      Returns:
      the output directory property
    • buildUi

      public void buildUi() throws IOException, InterruptedException
      Runs npm install and npm run build in the UI module directory.

      Silently skips (creating the output directory if necessary) when the UI module is absent or does not use @spellscroll/ui-sdk.

      Throws:
      IOException - if the npm process cannot be started or the output directory cannot be created
      InterruptedException - if the current thread is interrupted while waiting for npm