Class 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>
-
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 TypeMethodDescriptionprotected voidcompile(org.gradle.work.InputChanges inputChanges) org.gradle.api.file.FileCollectionWe override in order to apply theCompileClasspath, 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.ExecOperationsprotected abstract org.gradle.api.file.FileSystemOperationsInjected so deletes go through Gradle's ownDeleterservice rather thanFile.delete(), which would leave the virtual file system believing the files are there.org.gradle.api.file.ConfigurableFileCollectionabstract org.gradle.api.file.ConfigurableFileCollectionThe Java classes output directory, tracked for fine-grained change detection.protected abstract org.gradle.api.file.ProjectLayoutprotected abstract org.gradle.api.model.ObjectFactoryorg.gradle.api.tasks.compile.CompileOptionsgroovy.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.ProviderFactoryorg.gradle.api.file.FileTreeorg.gradle.api.file.ConfigurableFileCollectionReturns the Gosu source roots (directories).org.gradle.api.file.FileCollectionThe Gosu sources, and the sole tracked view of them:getSource()is@Internalso the set is fingerprinted once, here.voidsetGosuClasspath(org.gradle.api.file.FileCollection gosuClasspath) voidsetOrderClasspath(groovy.lang.Closure<org.gradle.api.file.FileCollection> orderClasspath) Normally setting this value is not required.org.gradle.api.tasks.SourceTaskOverridesSourceTask.source(java.lang.Object...)to also register non-SourceDirectorySet, non-FileTreearguments ingetSourceRoots()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, setTargetCompatibilityMethods inherited from class org.gradle.api.tasks.SourceTask
exclude, exclude, exclude, exclude, getExcludes, getIncludes, getPatternSet, getPatternSetFactory, include, include, include, include, setExcludes, setIncludes, setSource, setSourceMethods inherited from class org.gradle.api.internal.ConventionTask
conventionMapping, conventionMapping, getConventionMappingMethods 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
-
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 ownDeleterservice rather thanFile.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 ongetStableSources(). This mirrorsJavaCompile, which annotates itsgetSource()override the same way.@PathSensitiveis deliberately absent: Gradle reports a validation error when a property carries@Internalalongside a declared input modifier. Declaring@Internalalso discards every annotation category inherited fromSourceTask.getSource()-- including@SkipWhenEmptyand@IgnoreEmptyDirectories-- which is why both now sit ongetStableSources().- Overrides:
getSourcein classorg.gradle.api.tasks.SourceTask
-
source
OverridesSourceTask.source(java.lang.Object...)to also register non-SourceDirectorySet, non-FileTreearguments ingetSourceRoots()so that directories added by external plugins (e.g. via aProvider<Directory>orProvider<File>) are treated as Gosu type-system source roots.SourceDirectorySetis excluded becauseGosuBasePluginalready wires itsgetSourceDirectories()intosourceRoots.FileTreeis excluded because resolving one yields individual files rather than root directories.- Overrides:
sourcein classorg.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@Internalso the set is fingerprinted once, here.@SkipWhenEmptyrather 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.@SkipWhenEmptyis the stronger of the pair: it yieldsInputBehavior.PRIMARY, which tracks per-file changes forInputChangesexactly as@Incrementaldoes and skips the task with its previous outputs removed when no Gosu source remains.@IgnoreEmptyDirectorieskeeps a tree of empty package directories counting as "no source" for that check. Both annotations used to reach the task by inheritance fromSourceTask.getSource(); declaring@Internalthere discards inherited categories, so they are restated here. This is the same arrangementJavaCompileuses.@PathSensitive(RELATIVE), notNAME_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 movingcom/example/Foo.gstocom/other/Foo.gswould leave the fingerprint unchanged and the task wronglyUP-TO-DATE.RELATIVEis still relocatable, so@CacheableTaskand build-cache portability are unaffected. MatchesGosuDoc.getSource()andJavaCompile.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
- 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 theCompileClasspath, 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 explicitsetClasspathfrom another plugin or build script, anything else -- so no filtering is needed at those sites. Local.classfiles are tracked instead through the@IncrementalgetJavaClassesDir()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:
getClasspathin classorg.gradle.api.tasks.compile.AbstractCompile
-
getGosuClasspath
@Classpath @InputFiles public org.gradle.api.file.ConfigurableFileCollection getGosuClasspath()- Specified by:
getGosuClasspathin interfaceInfersGosuRuntime- Returns:
- the classpath to use to load the Gosu compiler.
-
setGosuClasspath
public void setGosuClasspath(org.gradle.api.file.FileCollection gosuClasspath) - Specified by:
setGosuClasspathin interfaceInfersGosuRuntime
-
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 byGosuBasePluginusing theSourceDirectorySet.getSourceDirectories()public API. -
getDependencyFile
@OutputFile @Optional public org.gradle.api.provider.Provider<org.gradle.api.file.RegularFile> getDependencyFile()The gosuc dependency-tracking file. Declared@OutputFileso Gradle caches it alongside the.classfiles -- on aFROM_CACHErestore 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 aRegularFileProperty: lazily evaluated, but deliberately with no setter. The path is derived from the task name so thatcompileGosuandcompileTestGosucannot be aimed at one another's graph; a settable property would give that guarantee away for no benefit.The provider is **absent unless
gosuOptions.incrementalCompilationis on**, which is what@Optionalnow 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-filesolely in incremental mode, so nothing would ever write it. Evaluated lazily, so a build script toggling the flag after task creation is still seen.
-