Skip to content

Commit

Permalink
Convert header & source path sensitivity to relative
Browse files Browse the repository at this point in the history
  • Loading branch information
ihym committed Jan 5, 2023
1 parent 09eea5d commit dad7610
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/groovy/nl/javadude/gradle/plugins/license/License.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import nl.javadude.gradle.plugins.license.maven.LicenseFormatMojo
import org.gradle.api.GradleException
import org.gradle.api.NamedDomainObjectContainer
import org.gradle.api.file.FileCollection
import org.gradle.api.file.FileTree
import org.gradle.api.tasks.*

import javax.inject.Inject
Expand Down Expand Up @@ -73,6 +74,7 @@ class License extends SourceTask implements VerificationTask {

@Optional
@InputFile
@PathSensitive(PathSensitivity.RELATIVE)
File header

/**
Expand Down Expand Up @@ -113,6 +115,14 @@ class License extends SourceTask implements VerificationTask {
this.check = check
}

@InputFiles
@SkipWhenEmpty
@IgnoreEmptyDirectories
@PathSensitive(PathSensitivity.RELATIVE)
public FileTree getSource() {
return this.sourceFiles.getAsFileTree().matching(this.patternSet);
}

@TaskAction
protected void process() {
// Plain weird, but this ensures that the lazy closure from the extension is properly wired into the excludes field of the SourceTask.
Expand Down

0 comments on commit dad7610

Please sign in to comment.