Class ArtifactAccessTransformer

java.lang.Object
net.minecraftforge.accesstransformers.gradle.ArtifactAccessTransformer
All Implemented Interfaces:
org.gradle.api.artifacts.transform.TransformAction<ArtifactAccessTransformer.Parameters>

public abstract class ArtifactAccessTransformer extends Object implements org.gradle.api.artifacts.transform.TransformAction<ArtifactAccessTransformer.Parameters>

Transforms artifacts using AccessTransformers.

This can be applied to any artifact as long as it is a jar file.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    The parameters for the transform action.
  • Constructor Summary

    Constructors
    Constructor
    Description
    The default constructor that is invoked by Gradle to instantiate this transform action.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract org.gradle.process.ExecOperations
    The exec operations provided by Gradle services.
    protected abstract org.gradle.api.provider.Provider<org.gradle.api.file.FileSystemLocation>
    The artifact to transform with AccessTransformers.
    protected abstract org.gradle.api.model.ObjectFactory
    The object factory provided by Gradle services.
    void
    transform(org.gradle.api.artifacts.transform.TransformOutputs outputs)
    Runs the transform action on the input artifact, queuing it for transformation with AccessTransformers.

    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.artifacts.transform.TransformAction

    getParameters
  • Constructor Details

    • ArtifactAccessTransformer

      public ArtifactAccessTransformer()
      The default constructor that is invoked by Gradle to instantiate this transform action.
  • Method Details

    • getObjects

      @Inject protected abstract org.gradle.api.model.ObjectFactory getObjects()
      The object factory provided by Gradle services.
      Returns:
      The object factory
      See Also:
    • getExecOperations

      @Inject protected abstract org.gradle.process.ExecOperations getExecOperations()
      The exec operations provided by Gradle services.
      Returns:
      The exec operations
      See Also:
    • getInputArtifact

      @InputArtifact protected abstract org.gradle.api.provider.Provider<org.gradle.api.file.FileSystemLocation> getInputArtifact()
      The artifact to transform with AccessTransformers.
      Returns:
      A property for the input artifact
    • transform

      public void transform(org.gradle.api.artifacts.transform.TransformOutputs outputs)

      Runs the transform action on the input artifact, queuing it for transformation with AccessTransformers.

      There are a few key distinctions that set this transform action apart from more traditional actions in Gradle and other plugins:

      • If the AccessTransformers configuration is unspecified or does not exist, this transformation is skipped entirely.
        • Gradle detects changes to this file, so if it is changed, this transform action will be invoked by Gradle.
      • This transformer uses in-house caching to detect if the input artifact actually needs to be transformed in the first place.
        • If caches are hit and an existing output is found, the transformation process is skipped entirely.
        • Due to Gradle using transient caching for its artifact transforms, this is required to avoid unnecessarily jar transformations, lengthening the build/sync time.
      Specified by:
      transform in interface org.gradle.api.artifacts.transform.TransformAction<ArtifactAccessTransformer.Parameters>
      Parameters:
      outputs - The outputs for this transform action