register
  abstract fun <T : TransformParameters?> registerTransform(actionType: Class<out TransformAction<T>>, registrationAction: Action<in TransformSpec<T>>)
Registers an artifact transform.
 The registration action needs to specify the from and to attributes. It may also provide parameters for the transform action by using parameters. 
For example:
// You have a transform action like this:
abstract class MyTransform implements TransformAction<Parameters> {
    interface Parameters extends TransformParameters {
        @Input
        Property<String> getStringParameter();
        @InputFiles
        ConfigurableFileCollection getInputFiles();
    }
    void transform(TransformOutputs outputs) {
        // ...
    }
}
// Then you can register the action like this:
def artifactType = Attribute.of('artifactType', String)
dependencies.registerTransform(MyTransform) {
    from.attribute(artifactType, "jar")
    to.attribute(artifactType, "java-classes-directory")
    parameters {
        stringParameter.set("Some string")
        inputFiles.from("my-input-file")
    }
}
Content copied to clipboard
Since
5.3