Class FetchApiSpecTask
- 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>
-
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidfetch()Unpacks the archive, verifies it against its own manifest, and records the result in the lockfile.abstract org.gradle.api.file.ConfigurableFileCollectionThe resolved archive.protected abstract org.gradle.api.file.ArchiveOperationsGradle's archive operations, used to unpack the fetched.tgz.abstract org.gradle.api.provider.Property<String> Which channel the archive came from.protected abstract org.gradle.api.file.FileSystemOperationsgetFiles()Gradle's filesystem operations, used to clear and repopulate the destination.abstract org.gradle.api.file.DirectoryPropertygetInto()Where the documents are unpacked to.abstract org.gradle.api.file.RegularFilePropertyThe lockfile this task records what it unpacked in.abstract org.gradle.api.provider.Property<String> The contract being fetched.abstract org.gradle.api.provider.Property<String> The version being fetched.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, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getLoggingManager, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, 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, notCompatibleWithConfigurationCache
-
Constructor Details
-
FetchApiSpecTask
public FetchApiSpecTask()Creates the task. Gradle instantiates this when a subscription is declared.
-
-
Method Details
-
getArchives
@Inject protected abstract org.gradle.api.file.ArchiveOperations getArchives()Gradle's archive operations, used to unpack the fetched.tgz.- Returns:
- the injected archive operations
-
getFiles
@Inject protected abstract org.gradle.api.file.FileSystemOperations getFiles()Gradle's filesystem operations, used to clear and repopulate the destination.- Returns:
- the injected filesystem operations
-
getArchive
@InputFiles @PathSensitive(NAME_ONLY) public abstract org.gradle.api.file.ConfigurableFileCollection getArchive()The resolved archive.For the
mavenchannel this is a resolved dependency, so Gradle has already downloaded, cached and verified the artifact itself before this task runs. For thefilechannel it is the path the archive belongs at, which need not exist before this task runs: a task earlier in the same build may be the one that publishes it.- Returns:
- the archive to unpack, as a single-file collection
-
getTarget
The contract being fetched.Used to key the lockfile entry and to name the target in any failure.
- Returns:
- the target name
-
getVersion
The version being fetched.Checked against the version the archive's own manifest declares, so an archive published under the wrong coordinates is refused rather than unpacked.
- Returns:
- the version to record in the lockfile
-
getChannel
Which channel the archive came from.Recorded in the lockfile so that a reader can tell where a contract was resolved from without re-running the build.
- Returns:
- the channel name,
"maven"or"file"
-
getInto
@OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getInto()Where the documents are unpacked to.Declared as an output, so Gradle treats a modified document as making this task out of date and refetches it.
- Returns:
- the destination directory
-
getLockfile
@Internal public abstract org.gradle.api.file.RegularFileProperty getLockfile()The lockfile this task records what it unpacked in.@Internal: every subscription in the project records its entry in this one file, so it is no single fetch's output. Whether this fetch is up to date depends onlockRecordsThisFetch()instead.- Returns:
- the lockfile location
-
fetch
public void fetch()Unpacks the archive, verifies it against its own manifest, and records the result in the lockfile.Four things are refused rather than unpacked: an archive that is not there, an archive whose manifest names a different version, an archive missing a document its manifest declares, and an archive whose contents do not hash to what its manifest says. A fifth is refused at the lockfile: a version already locked, coming back with different bytes — published to the file channel again, or, from a repository, a released version rebuilt or a tag moved.
- Throws:
org.gradle.api.GradleException- if any of those checks fail
-