Class GosuCompile

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.internal.ConventionTask
org.gradle.api.tasks.SourceTask
org.gradle.api.tasks.compile.AbstractCompile
org.gosulang.gradle.tasks.compile.GosuCompile
All Implemented Interfaces:
Comparable<org.gradle.api.Task>, InfersGosuRuntime, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.api.tasks.util.PatternFilterable, org.gradle.util.Configurable<org.gradle.api.Task>

@CacheableTask public abstract class GosuCompile extends org.gradle.api.tasks.compile.AbstractCompile implements InfersGosuRuntime
  • 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    compile(org.gradle.work.InputChanges inputChanges)
     
    org.gradle.api.file.FileCollection
    We override in order to apply the CompileClasspath, in order to ignore changes in JAR'd resources.
    org.gradle.api.provider.Provider<org.gradle.api.file.RegularFile>
    The gosuc dependency-tracking file.
    protected abstract org.gradle.process.ExecOperations
     
    protected abstract org.gradle.api.file.FileSystemOperations
    Injected so deletes go through Gradle's own Deleter service rather than File.delete(), which would leave the virtual file system believing the files are there.
    org.gradle.api.file.ConfigurableFileCollection
     
     
    abstract org.gradle.api.file.ConfigurableFileCollection
    The Java classes output directory, tracked for fine-grained change detection.
    protected abstract org.gradle.api.file.ProjectLayout
     
    protected abstract org.gradle.api.model.ObjectFactory
     
    org.gradle.api.tasks.compile.CompileOptions
     
    groovy.lang.Closure<org.gradle.api.file.FileCollection>
    Annotating as @Input or @InputFiles causes errors in Guidewire applications, even when paired with @Optional.
    protected abstract org.gradle.api.provider.ProviderFactory
     
    org.gradle.api.file.FileTree
    org.gradle.api.file.ConfigurableFileCollection
    Returns the Gosu source roots (directories).
    org.gradle.api.file.FileCollection
    The Gosu sources, and the sole tracked view of them: getSource() is @Internal so the set is fingerprinted once, here.
    void
    setGosuClasspath(org.gradle.api.file.FileCollection gosuClasspath)
     
    void
    setOrderClasspath(groovy.lang.Closure<org.gradle.api.file.FileCollection> orderClasspath)
    Normally setting this value is not required.
    org.gradle.api.tasks.SourceTask
    source(Object... sources)
    Overrides SourceTask.source(java.lang.Object...) to also register non-SourceDirectorySet, non-FileTree arguments in getSourceRoots() so that directories added by external plugins (e.g.

    Methods inherited from class org.gradle.api.tasks.compile.AbstractCompile

    getDestinationDir, getDestinationDirectory, getSourceCompatibility, getTargetCompatibility, setClasspath, setDestinationDir, setDestinationDir, setSourceCompatibility, setTargetCompatibility

    Methods inherited from class org.gradle.api.tasks.SourceTask

    exclude, exclude, exclude, exclude, getExcludes, getIncludes, getPatternSet, getPatternSetFactory, include, include, include, include, setExcludes, setIncludes, setSource, setSource

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

    conventionMapping, conventionMapping, getConventionMapping

    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, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, 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, getConvention, notCompatibleWithConfigurationCache
  • Constructor Details

    • GosuCompile

      public GosuCompile()
  • Method Details

    • getObjectFactory

      @Inject protected abstract org.gradle.api.model.ObjectFactory getObjectFactory()
    • getExecOperations

      @Inject protected abstract org.gradle.process.ExecOperations getExecOperations()
    • getLayout

      @Inject protected abstract org.gradle.api.file.ProjectLayout getLayout()
    • getProviderFactory

      @Inject protected abstract org.gradle.api.provider.ProviderFactory getProviderFactory()
    • getFileSystemOperations

      @Inject protected abstract org.gradle.api.file.FileSystemOperations getFileSystemOperations()
      Injected so deletes go through Gradle's own Deleter service rather than File.delete(), which would leave the virtual file system believing the files are there.
    • compile

      protected void compile(org.gradle.work.InputChanges inputChanges)
    • getSource

      @Internal("tracked via stableSources") public org.gradle.api.file.FileTree getSource()

      Not tracked as an input in its own right -- getStableSources() covers the same files and is the property the task action queries for changes. Tracking both would fingerprint the source set twice and, because Gradle keys its incremental-input registry by the value object a getter returns, would reintroduce the aliasing hazard described on getStableSources(). This mirrors JavaCompile, which annotates its getSource() override the same way.

      @PathSensitive is deliberately absent: Gradle reports a validation error when a property carries @Internal alongside a declared input modifier. Declaring @Internal also discards every annotation category inherited from SourceTask.getSource() -- including @SkipWhenEmpty and @IgnoreEmptyDirectories -- which is why both now sit on getStableSources().

      Overrides:
      getSource in class org.gradle.api.tasks.SourceTask
    • source

      public org.gradle.api.tasks.SourceTask source(Object... sources)
      Overrides SourceTask.source(java.lang.Object...) to also register non-SourceDirectorySet, non-FileTree arguments in getSourceRoots() so that directories added by external plugins (e.g. via a Provider<Directory> or Provider<File>) are treated as Gosu type-system source roots. SourceDirectorySet is excluded because GosuBasePlugin already wires its getSourceDirectories() into sourceRoots. FileTree is excluded because resolving one yields individual files rather than root directories.
      Overrides:
      source in class org.gradle.api.tasks.SourceTask
    • getStableSources

      @SkipWhenEmpty @IgnoreEmptyDirectories @PathSensitive(RELATIVE) @InputFiles public org.gradle.api.file.FileCollection getStableSources()
      The Gosu sources, and the sole tracked view of them: getSource() is @Internal so the set is fingerprinted once, here.

      @SkipWhenEmpty rather than @Incremental -- the two are interchangeable for this task's purpose but cannot be combined, because Gradle files them under one annotation category and rejects a property carrying both. @SkipWhenEmpty is the stronger of the pair: it yields InputBehavior.PRIMARY, which tracks per-file changes for InputChanges exactly as @Incremental does and skips the task with its previous outputs removed when no Gosu source remains. @IgnoreEmptyDirectories keeps a tree of empty package directories counting as "no source" for that check. Both annotations used to reach the task by inheritance from SourceTask.getSource(); declaring @Internal there discards inherited categories, so they are restated here. This is the same arrangement JavaCompile uses.

      @PathSensitive(RELATIVE), not NAME_ONLY: a Gosu type's FQCN is its path relative to the source root -- extractFQCNFromSourceFile(java.io.File) derives it that way, and gosuc keys its dependency graph on the same mapping. Normalising to the bare filename would discard exactly that information, so moving com/example/Foo.gs to com/other/Foo.gs would leave the fingerprint unchanged and the task wrongly UP-TO-DATE. RELATIVE is still relocatable, so @CacheableTask and build-cache portability are unaffected. Matches GosuDoc.getSource() and JavaCompile.getStableSources().

    • getJavaClassesDir

      @CompileClasspath @Incremental @Optional public abstract org.gradle.api.file.ConfigurableFileCollection getJavaClassesDir()
      The Java classes output directory, tracked for fine-grained change detection. This tracks the compileJava task's output directory to detect which specific Java class files have changed (ABI changes only, not implementation changes). Populated by GosuBasePlugin from the SourceSet's Java output directory.

      Gradle supplies the instance, so this is never null -- an unpopulated collection is empty, which is the Gosu-only source set case.

      Returns:
      the Java classes output directory
    • getGosuOptions

      public GosuCompileOptions getGosuOptions()
      Returns:
      Gosu-specific compilation options.
    • getOptions

      public org.gradle.api.tasks.compile.CompileOptions getOptions()
    • getClasspath

      @CompileClasspath public org.gradle.api.file.FileCollection getClasspath()
      We override in order to apply the CompileClasspath, in order to ignore changes in JAR'd resources. Also filters out javaClassesDir to prevent local .class file changes from triggering full rebuilds.

      This is the single place javaClassesDir is kept out of Gradle's tracked classpath input. Filtering on read covers every way a value can arrive -- the convention mapping in GosuBasePlugin, an explicit setClasspath from another plugin or build script, anything else -- so no filtering is needed at those sites. Local .class files are tracked instead through the @Incremental getJavaClassesDir() input; createSpec() re-adds them to the classpath actually handed to gosuc.

      This filtering ONLY applies when javaClassesDir has been populated. When it is empty -- a Gosu-only source set -- the classpath is returned unmodified.

      Overrides:
      getClasspath in class org.gradle.api.tasks.compile.AbstractCompile
    • getGosuClasspath

      @Classpath @InputFiles public org.gradle.api.file.ConfigurableFileCollection getGosuClasspath()
      Specified by:
      getGosuClasspath in interface InfersGosuRuntime
      Returns:
      the classpath to use to load the Gosu compiler.
    • setGosuClasspath

      public void setGosuClasspath(org.gradle.api.file.FileCollection gosuClasspath)
      Specified by:
      setGosuClasspath in interface InfersGosuRuntime
    • getOrderClasspath

      @Internal public groovy.lang.Closure<org.gradle.api.file.FileCollection> getOrderClasspath()
      Annotating as @Input or @InputFiles causes errors in Guidewire applications, even when paired with @Optional. Marking as @Internal instead to skip warning thrown by :validateTaskProperties (org.gradle.plugin.devel.tasks.ValidateTaskProperties)
      Returns:
      a Closure returning a classpath to be passed to the GosuCompile task
    • setOrderClasspath

      public void setOrderClasspath(groovy.lang.Closure<org.gradle.api.file.FileCollection> orderClasspath)
      Normally setting this value is not required. Certain projects relying on depth-first resolution of module dependencies can use this Closure to reorder the classpath as needed.
      Parameters:
      orderClasspath - a Closure returning a classpath to be passed to the GosuCompile task
    • getSourceRoots

      @Internal public org.gradle.api.file.ConfigurableFileCollection getSourceRoots()
      Returns the Gosu source roots (directories). Wired at configuration time by GosuBasePlugin using the SourceDirectorySet.getSourceDirectories() public API.
    • getDependencyFile

      @OutputFile @Optional public org.gradle.api.provider.Provider<org.gradle.api.file.RegularFile> getDependencyFile()
      The gosuc dependency-tracking file. Declared @OutputFile so Gradle caches it alongside the .class files -- on a FROM_CACHE restore the dep file returns to disk and the next incremental compileGosu can use it as a baseline graph instead of falling back to a full rebuild.

      Returned as a Provider, not a RegularFileProperty: lazily evaluated, but deliberately with no setter. The path is derived from the task name so that compileGosu and compileTestGosu cannot be aimed at one another's graph; a settable property would give that guarantee away for no benefit.

      The provider is **absent unless gosuOptions.incrementalCompilation is on**, which is what @Optional now means here: not "a declared output that may fail to appear on disk", but "on a non-incremental build this task declares no such output at all". That matches reality -- gosuc is passed -dependency-file solely in incremental mode, so nothing would ever write it. Evaluated lazily, so a build script toggling the flag after task creation is still seen.