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 ClassesModifier and TypeClassDescriptionstatic interfaceThe parameters for the transform action. -
Constructor Summary
ConstructorsConstructorDescriptionThe default constructor that is invoked by Gradle to instantiate this transform action. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract org.gradle.process.ExecOperationsThe 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.ObjectFactoryThe object factory provided by Gradle services.voidtransform(org.gradle.api.artifacts.transform.TransformOutputs outputs) Runs the transform action on the input artifact, queuing it for transformation with AccessTransformers.static voidvalidateConfig(org.gradle.api.model.ObjectFactory objects, org.gradle.api.provider.ProviderFactory providers, Object dependency, org.gradle.api.file.RegularFileProperty config) Validates the given AccessTransformer configuration file to ensure it is ready for use by the artifact transformer.static voidvalidateConfig(org.gradle.api.Project project, Object dependency, org.gradle.api.file.RegularFileProperty config) Validates the given AccessTransformer configuration file to ensure it is ready for use by the artifact transformer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
transformin interfaceorg.gradle.api.artifacts.transform.TransformAction<ArtifactAccessTransformer.Parameters>- Parameters:
outputs- The outputs for this transform action
- If the AccessTransformers configuration is unspecified or does not exist, this
transformation is skipped entirely.
-
validateConfig
public static void validateConfig(org.gradle.api.Project project, Object dependency, org.gradle.api.file.RegularFileProperty config) Validates the given AccessTransformer configuration file to ensure it is ready for use by the artifact transformer.- Parameters:
project- The project using AccessTransformersdependency- The dependency to be transformedconfig- The AccessTransformer configuration file- Throws:
RuntimeException- If validation of the configuration file failed
-
validateConfig
public static void validateConfig(org.gradle.api.model.ObjectFactory objects, org.gradle.api.provider.ProviderFactory providers, Object dependency, org.gradle.api.file.RegularFileProperty config) Validates the given AccessTransformer configuration file to ensure it is ready for use by the artifact transformer.- Parameters:
objects- The object factory for debuggingproviders- The provider factory for debuggingdependency- The dependency to be transformedconfig- The AccessTransformer configuration file- Throws:
RuntimeException- If validation of the configuration file failed
-