Class GenerateArtifactMetadataTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
com.konfigyr.gradle.GenerateArtifactMetadataTask
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 GenerateArtifactMetadataTask extends org.gradle.api.DefaultTask
Task that generates ArtifactMetadata for each resolved dependency and for the current project itself, then writes the results to the output directory.

The current project and all other projects in the build are identified through getProjectPath() and getProjectArtifacts(). Both properties are populated at configuration time, avoiding any access to Project objects during task execution and keeping the task compatible with the Gradle configuration cache.

The resolved artifact metadata locations are recorded in the manifest file. This manifest is later consumed by PublishArtifactMetadataTask to upload only the affected entries to the Konfigyr Artifactory.

Output files are named after the artifact coordinates, for example: com.konfigyr-konfigyr-artifactory-1.0.0.json

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<org.gradle.api.artifacts.ArtifactCollection>
    Collection that contains transformed artifact metadata from the ArtifactMetadataTransform.
    abstract org.gradle.api.file.ConfigurableFileCollection
    The collection of files that represent the classpath of the current project.
    abstract org.gradle.api.file.RegularFileProperty
    The manifest file that should be written that contains all the processed artifacts.
    abstract org.gradle.api.file.DirectoryProperty
    The output directory where serialized ArtifactMetadata should be written.
    abstract org.gradle.api.provider.MapProperty<String,com.konfigyr.artifactory.Artifact>
    A map of every project in the build, keyed by Gradle project path, with each value being a pre-built Artifact descriptor.
    abstract org.gradle.api.provider.Property<String>
    The Gradle path of the project this task belongs to (e.g.
    abstract org.gradle.api.file.ConfigurableFileCollection
    The collection of files that represent the classpath of the current project.
    abstract org.gradle.api.provider.Property<ArtifactoryService>
    Returns the ArtifactoryService to use for constructing and writing the artifact metadata.

    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

    • GenerateArtifactMetadataTask

      public GenerateArtifactMetadataTask()
  • Method Details

    • getService

      @Internal public abstract org.gradle.api.provider.Property<ArtifactoryService> getService()
      Returns the ArtifactoryService to use for constructing and writing the artifact metadata.
      Returns:
      the artifactory service to use, never null.
    • getArtifacts

      @Internal public abstract org.gradle.api.provider.Property<org.gradle.api.artifacts.ArtifactCollection> getArtifacts()
      Collection that contains transformed artifact metadata from the ArtifactMetadataTransform.

      Each ResolvedArtifactResult should be assocated with the metadata.json file containing the serialized PropertyDescriptors.

      Returns:
      the transformed artifact metadata, never null.
    • getRuntimeClasspath

      @InputFiles @Classpath public abstract org.gradle.api.file.ConfigurableFileCollection getRuntimeClasspath()
      The collection of files that represent the classpath of the current project. This classpath file collection is used to create a custom ClassLoader that would generate the ArtifactMetadata for the current Gradle project.
      Returns:
      the project's classpath, never null.
    • getClasspath

      @InputFiles @CompileClasspath public abstract org.gradle.api.file.ConfigurableFileCollection getClasspath()
      The collection of files that represent the classpath of the current project. This classpath file collection is used to create a custom ClassLoader that would generate the ArtifactMetadata for the current Gradle project.
      Returns:
      the project's classpath, never null.
    • getManifest

      @OutputFile public abstract org.gradle.api.file.RegularFileProperty getManifest()
      The manifest file that should be written that contains all the processed artifacts.
      Returns:
      the output manifest file location, never null.
    • getOutput

      @OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getOutput()
      The output directory where serialized ArtifactMetadata should be written.
      Returns:
      the output directory, never null.
    • getProjectPath

      @Input public abstract org.gradle.api.provider.Property<String> getProjectPath()
      The Gradle path of the project this task belongs to (e.g. :orders).

      Used as the lookup key into getProjectArtifacts() to identify the current project when generating its ArtifactMetadata.

      Returns:
      the project path, never null.
    • getProjectArtifacts

      @Input public abstract org.gradle.api.provider.MapProperty<String,com.konfigyr.artifactory.Artifact> getProjectArtifacts()
      A map of every project in the build, keyed by Gradle project path, with each value being a pre-built Artifact descriptor.

      The map is populated at configuration time so the task action never needs to access live Project objects, keeping this task compatible with the Gradle configuration cache.

      Returns:
      the project artifacts map, never null.