Class ArtifactAccessTransformer

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

public abstract class ArtifactAccessTransformer extends Object implements TransformAction<ArtifactAccessTransformer.Parameters>

Transforms artifacts using AccessTransformers.

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

  • Constructor Details

    • ArtifactAccessTransformer

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

    • getObjects

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

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

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

      public void 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 TransformAction<ArtifactAccessTransformer.Parameters>
      Parameters:
      outputs - The outputs for this transform action