MergeLicenseResourceTransformer

open class MergeLicenseResourceTransformer(val objectFactory: ObjectFactory, patternSet: PatternSet) : PatternFilterableResourceTransformer

Generates a license file using the configured license text source.

An optional SPDX-License-Identifier can be placed in front of the license text to avoid ambiguous license detection by license-detection-tools.

License texts found in the file names:

  • META-INF/LICENSE

  • META-INF/LICENSE.txt

  • META-INF/LICENSE.md

  • LICENSE

  • LICENSE.txt

  • LICENSE.md

are included for the shadowed jar sources.

To exclude these defaults, add excludes to the transformer configuration.

Use the org.gradle.api.tasks.util.PatternFilterable functions to specify a different set of files to include, the paths mentioned above are then not considered unless explicitly included.

Constructors

Link copied to clipboard
constructor(objectFactory: ObjectFactory, patternSet: PatternSet)
@Inject
constructor(objectFactory: ObjectFactory)

Properties

Link copied to clipboard
@get:InputFile
@get:PathSensitive(value = PathSensitivity.RELATIVE)
open val artifactLicense: RegularFileProperty

Path to the project's license text, this property must be configured.

Link copied to clipboard
@get:Input
open val artifactLicenseSpdxId: Property<String>

The generated license file is potentially a collection of multiple license texts. To avoid ambiguous license detection by license-detection-tools, an SPDX license identifier header (SPDX-License-Identifier:) is added at the beginning of the generated file if the value of this property is present and not empty. Defaults to Apache-2.0.

Link copied to clipboard
@get:Input
open override val excludes: MutableSet<String>
Link copied to clipboard
@get:Input
open val firstSeparator: Property<String>

Separator between the project's license text and license texts from the included dependencies.

Link copied to clipboard
@get:Input
open override val includes: MutableSet<String>
Link copied to clipboard
@get:Internal
open override val name: String
Link copied to clipboard
override val objectFactory: ObjectFactory

This is used for creating Gradle's lazy properties in the subclass, Shadow's build-in transformers that depend on this have been injected via ObjectFactory.newInstance. Custom transformers should implement or inject this property if they need to access it.

Link copied to clipboard
@get:Input
open val outputPath: Property<String>

Path to write the aggregated license file to. Defaults to META-INF/LICENSE.

Link copied to clipboard
@Internal
val patternSet: PatternSet
Link copied to clipboard
@get:Input
open val separator: Property<String>

Separator between included dependency license texts.

Functions

Link copied to clipboard
open override fun canTransformResource(element: FileTreeElement): Boolean
Link copied to clipboard
open override fun exclude(excludeSpec: Closure<*>?): PatternFilterable?
open override fun exclude(excludes: Iterable<String?>?): PatternFilterable?
open override fun exclude(excludeSpec: Spec<FileTreeElement?>?): PatternFilterable?
open override fun exclude(vararg excludes: String?): PatternFilterable?
Link copied to clipboard
@Input
open override fun getExcludes(): MutableSet<String>
Link copied to clipboard
@Input
open override fun getIncludes(): MutableSet<String>
Link copied to clipboard
@Internal
open override fun getName(): String
Link copied to clipboard
open override fun hasTransformedResource(): Boolean
Link copied to clipboard
open override fun include(includeSpec: Closure<*>?): PatternFilterable?
open override fun include(includes: Iterable<String?>?): PatternFilterable?
open override fun include(includeSpec: Spec<FileTreeElement?>?): PatternFilterable?
open override fun include(vararg includes: String?): PatternFilterable?
Link copied to clipboard
open override fun modifyOutputStream(os: ZipOutputStream, preserveFileTimestamps: Boolean)
Link copied to clipboard
open override fun setExcludes(excludes: Iterable<String?>?): PatternFilterable?
Link copied to clipboard
open override fun setIncludes(includes: Iterable<String?>?): PatternFilterable?
Link copied to clipboard
open override fun transform(context: TransformerContext)