@@ -27,14 +27,19 @@ import io.papermc.paperweight.checkstyle.tasks.PaperCheckstyleTask
2727import io.papermc.paperweight.util.*
2828import io.papermc.paperweight.util.constants.*
2929import io.papermc.paperweight.util.path
30+ import javax.inject.Inject
3031import kotlin.io.path.readText
3132import org.gradle.api.Plugin
3233import org.gradle.api.Project
34+ import org.gradle.api.file.ProjectLayout
3335import org.gradle.api.plugins.quality.CheckstyleExtension
3436import org.gradle.kotlin.dsl.*
3537
3638abstract class PaperCheckstyle : Plugin <Project > {
3739
40+ @get:Inject
41+ abstract val layout: ProjectLayout
42+
3843 override fun apply (target : Project ) {
3944 val ext = target.extensions.create<PaperCheckstyleExt >(PAPER_CHECKSTYLE_EXTENSION )
4045 target.plugins.apply (PaperCheckstylePlugin ::class .java)
@@ -46,11 +51,15 @@ abstract class PaperCheckstyle : Plugin<Project> {
4651 val mergeCheckstyleConfigs by target.tasks.registering<MergeCheckstyleConfigs >()
4752
4853 target.tasks.withType(PaperCheckstyleTask ::class .java).configureEach {
49- rootPath.convention(project.rootDir .path)
54+ rootPath.convention(layout.settingsDirectory.asFile .path)
5055 directoriesToSkip.convention(ext.directoriesToSkipFile.map { it.path.readText().trim().split(" \n " ).toSet() })
5156 typeUseAnnotations.convention(ext.typeUseAnnotationsFile.map { it.path.readText().trim().split(" \n " ) })
5257 customJavadocTags.convention(ext.customJavadocTags)
5358 configOverride.convention(mergeCheckstyleConfigs.flatMap { it.mergedConfigFile })
59+ reports.xml.required.convention(true )
60+ reports.html.required.convention(true )
61+ maxHeapSize.convention(" 2g" )
62+ configDirectory.convention(layout.settingsDirectory.dir(" .checkstyle" ))
5463 }
5564 }
5665}
0 commit comments