Skip to content

Commit 3a4e5d7

Browse files
committed
Properly track file contents
1 parent c17bcd0 commit 3a4e5d7

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

paperweight-core/src/main/kotlin/io/papermc/paperweight/checkstyle/PaperCheckstyle.kt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,22 @@ import io.papermc.paperweight.checkstyle.tasks.MergeCheckstyleConfigs
2626
import io.papermc.paperweight.checkstyle.tasks.PaperCheckstyleTask
2727
import io.papermc.paperweight.util.*
2828
import io.papermc.paperweight.util.constants.*
29-
import io.papermc.paperweight.util.path
3029
import javax.inject.Inject
31-
import kotlin.io.path.readText
3230
import org.gradle.api.Plugin
3331
import org.gradle.api.Project
3432
import org.gradle.api.file.ProjectLayout
3533
import org.gradle.api.plugins.quality.CheckstyleExtension
34+
import org.gradle.api.provider.ProviderFactory
3635
import org.gradle.kotlin.dsl.*
3736

3837
abstract class PaperCheckstyle : Plugin<Project> {
3938

4039
@get:Inject
4140
abstract val layout: ProjectLayout
4241

42+
@get:Inject
43+
abstract val providers: ProviderFactory
44+
4345
override fun apply(target: Project) {
4446
val ext = target.extensions.create<PaperCheckstyleExt>(PAPER_CHECKSTYLE_EXTENSION)
4547
target.plugins.apply(PaperCheckstylePlugin::class.java)
@@ -52,8 +54,16 @@ abstract class PaperCheckstyle : Plugin<Project> {
5254

5355
target.tasks.withType(PaperCheckstyleTask::class.java).configureEach {
5456
rootPath.convention(layout.settingsDirectory.asFile.path)
55-
directoriesToSkip.convention(ext.directoriesToSkipFile.map { it.path.readText().trim().split("\n").toSet() })
56-
typeUseAnnotations.convention(ext.typeUseAnnotationsFile.map { it.path.readText().trim().split("\n") })
57+
directoriesToSkip.convention(
58+
providers.fileContents(ext.directoriesToSkipFile).asText.map {
59+
it.trim().lines().map { line -> line.trim() }
60+
}
61+
)
62+
typeUseAnnotations.convention(
63+
providers.fileContents(ext.typeUseAnnotationsFile).asText.map {
64+
it.trim().lines().map { line -> line.trim() }
65+
}
66+
)
5767
customJavadocTags.convention(ext.customJavadocTags)
5868
configOverride.convention(mergeCheckstyleConfigs.flatMap { it.mergedConfigFile })
5969
reports.xml.required.convention(true)

0 commit comments

Comments
 (0)