diff --git a/api/shadow.api b/api/shadow.api index 2df52965b..e7c4d8a76 100644 --- a/api/shadow.api +++ b/api/shadow.api @@ -415,14 +415,13 @@ public final class com/github/jengelman/gradle/plugins/shadow/transformers/Compo } public class com/github/jengelman/gradle/plugins/shadow/transformers/DontIncludeResourceTransformer : com/github/jengelman/gradle/plugins/shadow/transformers/Transformer { - public fun ()V + public fun (Lorg/gradle/api/model/ObjectFactory;)V public fun canTransformResource (Lorg/gradle/api/file/FileTreeElement;)Z public fun getName ()Ljava/lang/String; public fun getObjectFactory ()Lorg/gradle/api/model/ObjectFactory; - public final fun getResource ()Ljava/lang/String; + public final fun getResource ()Lorg/gradle/api/provider/Property; public fun hasTransformedResource ()Z public fun modifyOutputStream (Lorg/apache/tools/zip/ZipOutputStream;Z)V - public final fun setResource (Ljava/lang/String;)V public fun transform (Lcom/github/jengelman/gradle/plugins/shadow/transformers/TransformerContext;)V } diff --git a/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/DontIncludeResourceTransformer.kt b/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/DontIncludeResourceTransformer.kt index e39a30a04..c9e5fff7b 100644 --- a/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/DontIncludeResourceTransformer.kt +++ b/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/DontIncludeResourceTransformer.kt @@ -1,6 +1,10 @@ package com.github.jengelman.gradle.plugins.shadow.transformers +import com.github.jengelman.gradle.plugins.shadow.internal.property +import javax.inject.Inject import org.gradle.api.file.FileTreeElement +import org.gradle.api.model.ObjectFactory +import org.gradle.api.provider.Property import org.gradle.api.tasks.Input import org.gradle.api.tasks.Optional @@ -11,13 +15,15 @@ import org.gradle.api.tasks.Optional * * @author John Engelman */ -public open class DontIncludeResourceTransformer : Transformer by NoOpTransformer { +public open class DontIncludeResourceTransformer @Inject constructor( + override val objectFactory: ObjectFactory, +) : Transformer by NoOpTransformer { @get:Optional @get:Input - public var resource: String? = null + public val resource: Property = objectFactory.property() override fun canTransformResource(element: FileTreeElement): Boolean { val path = element.relativePath.pathString - return !resource.isNullOrEmpty() && path.endsWith(resource!!) + return !resource.orNull.isNullOrEmpty() && path.endsWith(resource.get()) } }