Class ArtifactMetadataTransform
- All Implemented Interfaces:
org.gradle.api.artifacts.transform.TransformAction<com.konfigyr.gradle.ArtifactMetadataTransform.Parameters>
TransformAction that processes each JAR on the runtimeClasspath and produces
a self-describing output file containing the PropertyDescriptor metadata. This transform
action would create a custom ClassLoader using the current artifact and its dependencies to
resolve the Spring Boot configuration metadata files and generate the property descriptors.
The resulting artifacts can be looked up using a custom ArtifactView
where the artifactType is set to konfigyr-metadata. Artifacts that do not contain
Spring Boot configuration metadata would not be included in the view.
The transform is annotated CacheableTransform. Gradle will cache the output directory keyed
on the JAR's content hash. A JAR that has not changed between builds will never be re-processed;
the cached output directory is reused directly, making incremental builds extremely fast.
- Since:
- 1.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract org.gradle.api.provider.Provider<org.gradle.api.file.FileSystemLocation> The location of the artifact file being transformed.abstract org.gradle.api.file.FileCollectionThe file collection containing the dependencies of the artifact being transformed.voidtransform(org.gradle.api.artifacts.transform.TransformOutputs outputs) 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
-
ArtifactMetadataTransform
public ArtifactMetadataTransform()
-
-
Method Details
-
getArtifact
@InputArtifact @CompileClasspath public abstract org.gradle.api.provider.Provider<org.gradle.api.file.FileSystemLocation> getArtifact()The location of the artifact file being transformed.@Classpathannotation here tells Gradle to derive the cache key from the artifacts content hash rather than its path. This is essential for correctness in reproducible and relocatable builds.- Returns:
- the artifact file, never null.
-
getDependencies
@CompileClasspath @InputArtifactDependencies public abstract org.gradle.api.file.FileCollection getDependencies()The file collection containing the dependencies of the artifact being transformed.This collection is used to create a custom
ClassLoaderthat can resolve the Java types from the Spring Boot configuration metadata files to resolve theJsonSchemafor each property.- Returns:
- the dependencies of the artifact, never null.
-
transform
public void transform(org.gradle.api.artifacts.transform.TransformOutputs outputs) - Specified by:
transformin interfaceorg.gradle.api.artifacts.transform.TransformAction<com.konfigyr.gradle.ArtifactMetadataTransform.Parameters>
-