Compare commits

...

3 Commits

Author SHA1 Message Date
Stefan Wolf
b6b0b3098a Remove references to validateTaskProperties
The task is now called `validatePlugins`.
2021-02-23 20:33:33 +03:00
Stefan Wolf
562fce38a3 Add PathSensitive annotation to all input file properties
So new validation which will be added in Gradle 7.1
won't cause warnings during the build.
2021-02-23 20:33:32 +03:00
Stefan Wolf
83bba4f854 Enable stricker Kotlin Gradle Plugin validation 2021-02-23 20:33:28 +03:00
12 changed files with 32 additions and 6 deletions

View File

@@ -41,7 +41,7 @@ open class DexMethodCount : DefaultTask() {
dependsOn(jar)
}
@Internal // plain output properties are not supported, mark as internal to suppress warning from validateTaskProperties
@Internal // plain output properties are not supported, mark as internal to suppress warning from validatePlugins
lateinit var counts: Counts
@get:OutputFile

View File

@@ -156,7 +156,7 @@ tasks.withType<KotlinCompile> {
tasks.withType<Test> {
onlyIf { !project.hasProperty("noTest") }
dependsOn(":kotlin-gradle-plugin:validateTaskProperties")
dependsOn(":kotlin-gradle-plugin:validatePlugins")
dependsOnKotlinGradlePluginInstall()
executable = "${rootProject.extra["JDK_18"]!!}/bin/java"

View File

@@ -146,12 +146,13 @@ tasks {
callGroovy("manifestAttributes", manifest, project)
}
named<ValidateTaskProperties>("validateTaskProperties") {
failOnWarning = true
withType<ValidatePlugins>().configureEach {
failOnWarning.set(true)
enableStricterValidation.set(true)
}
named("install") {
dependsOn(named("validateTaskProperties"))
dependsOn(named("validatePlugins"))
}
named<DokkaTask>("dokka") {
@@ -162,7 +163,7 @@ tasks {
projectTest {
executable = "${rootProject.extra["JDK_18"]!!}/bin/java"
dependsOn(tasks.named("validateTaskProperties"))
dependsOn(tasks.named("validatePlugins"))
workingDir = rootDir
}

View File

@@ -39,6 +39,7 @@ constructor(
var sourceMapStackTraces = true
@Optional
@PathSensitive(PathSensitivity.ABSOLUTE)
@InputFile
val inputFileProperty: RegularFileProperty = project.newFileProperty()

View File

@@ -16,6 +16,8 @@ import org.gradle.api.initialization.IncludedBuild
import org.gradle.api.internal.artifacts.DefaultProjectComponentIdentifier
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.bundling.Zip
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
@@ -354,9 +356,11 @@ internal class KotlinCompilationNpmResolver(
@get:Input
val internalDependencies: Collection<String>,
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles
val internalCompositeDependencies: Collection<File>,
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles
val externalGradleDependencies: Collection<File>,

View File

@@ -9,6 +9,8 @@ import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
import java.io.File
@@ -31,11 +33,13 @@ open class KotlinNpmInstallTask : DefaultTask() {
val args: MutableList<String> = mutableListOf()
@Suppress("unused")
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles
val packageJsonFiles: Collection<File> by lazy {
resolutionManager.packageJsonFiles
}
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles
val preparedFiles: Collection<File> by lazy {
nodeJs.packageManager.preparedFiles(nodeJs)

View File

@@ -12,6 +12,8 @@ import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.process.internal.DefaultProcessForkOptions
import org.gradle.util.ConfigureUtil
import org.jetbrains.kotlin.gradle.internal.testing.TCServiceMessagesTestExecutionSpec
@@ -65,6 +67,7 @@ constructor(
val testFrameworkSettings: String
@Input get() = testFramework!!.settingsState
@PathSensitive(PathSensitivity.ABSOLUTE)
@InputFile
val inputFileProperty: RegularFileProperty = project.newFileProperty()
@@ -72,6 +75,7 @@ constructor(
var debug: Boolean = false
@Suppress("unused")
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles
val runtimeClasspath: FileCollection by lazy {
compilation.runtimeDependencyFiles
@@ -79,6 +83,7 @@ constructor(
@Suppress("unused")
@get:InputFiles
@get:PathSensitive(PathSensitivity.ABSOLUTE)
internal val compilationOutputs: FileCollection by lazy {
compilation.output.allOutputs
}

View File

@@ -88,6 +88,7 @@ constructor(
internal var resolveFromModulesFirst: Boolean = false
@Suppress("unused")
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles
val runtimeClasspath: FileCollection by lazy {
compilation.compileDependencyFiles
@@ -145,6 +146,7 @@ constructor(
private val projectDir = project.projectDir
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:Optional
@get:InputDirectory
open val configDirectory: File? by lazy {

View File

@@ -36,12 +36,14 @@ internal open class CommonizerTask : DefaultTask() {
@get:Input
var targetGroups: Set<KonanTargetGroup> = emptySet()
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputDirectory
@Suppress("unused") // Only for up-to-date checker. The directory with the original common libs.
val originalCommonLibrariesDirectory = konanHome
.resolve(KONAN_DISTRIBUTION_KLIB_DIR)
.resolve(KONAN_DISTRIBUTION_COMMON_LIBS_DIR)
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputDirectory
@Suppress("unused") // Only for up-to-date checker. The directory with the original platform libs.
val originalPlatformLibrariesDirectory = konanHome
@@ -52,6 +54,7 @@ internal open class CommonizerTask : DefaultTask() {
val commonizerTargetOutputDirectories
get() = targetGroups.map { targets -> project.nativeDistributionCommonizerOutputDirectory(targets) }
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles
@Suppress("unused") // Only for up-to-date checker.
val successMarkers

View File

@@ -364,6 +364,7 @@ open class PodGenTask : DefaultTask() {
}
}
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFile
internal lateinit var podspec: Provider<File>
@@ -480,12 +481,14 @@ private fun getBuildSettingFileName(pod: CocoapodsDependency, sdk: String): Stri
*/
open class PodBuildTask : DefaultTask() {
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFile
internal lateinit var buildSettingsFile: Provider<File>
@get:Nested
internal lateinit var pod: Provider<CocoapodsDependency>
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles
internal val srcDir: FileTree
get() = project.fileTree(

View File

@@ -105,11 +105,13 @@ open class FatFrameworkTask: DefaultTask() {
private val fatDsym: IosDsymFiles
get() = fatFramework.dSYM
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles
@get:SkipWhenEmpty
protected val inputFrameworkFiles: Iterable<FileTree>
get() = frameworks.map { project.fileTree(it.outputFile) }
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles
protected val inputDsymFiles: Iterable<FileTree>
get() = frameworks.mapNotNull { framework ->

View File

@@ -33,6 +33,7 @@ abstract class KotlinNativeTest : KotlinTest() {
@get:Internal
val executableProperty: Property<FileCollection> = project.objects.property(FileCollection::class.java)
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles // use FileCollection & @InputFiles rather than @InputFile to allow for task dependencies built-into this FileCollection
@get:SkipWhenEmpty
@Suppress("UNUSED") // Gradle input