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.

In ForgeGradle, this is only applied to the Minecraft classes artifact. It can, however, be apoplied to any artifact as long as it is a jar file.

  • Constructor Details

    • ArtifactAccessTransformer

      @Inject public ArtifactAccessTransformer(ExecOperations execOperations)
      The default constructor that is invoked by Gradle to instantiate this transform action.
      Parameters:
      execOperations - The exec operations used by this transform action
  • Method Details

    • 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