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.
This commit is contained in:
Stefan Wolf
2021-01-29 19:01:36 +03:00
committed by Andrey Uskov
parent 8b01df6772
commit 200ef832d2
9 changed files with 25 additions and 0 deletions
@@ -39,6 +39,7 @@ constructor(
var sourceMapStackTraces = true var sourceMapStackTraces = true
@Optional @Optional
@PathSensitive(PathSensitivity.ABSOLUTE)
@InputFile @InputFile
val inputFileProperty: RegularFileProperty = project.newFileProperty() val inputFileProperty: RegularFileProperty = project.newFileProperty()
@@ -16,6 +16,8 @@ import org.gradle.api.initialization.IncludedBuild
import org.gradle.api.internal.artifacts.DefaultProjectComponentIdentifier import org.gradle.api.internal.artifacts.DefaultProjectComponentIdentifier
import org.gradle.api.tasks.Input import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles 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.TaskProvider
import org.gradle.api.tasks.bundling.Zip import org.gradle.api.tasks.bundling.Zip
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
@@ -354,9 +356,11 @@ internal class KotlinCompilationNpmResolver(
@get:Input @get:Input
val internalDependencies: Collection<String>, val internalDependencies: Collection<String>,
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles @get:InputFiles
val internalCompositeDependencies: Collection<File>, val internalCompositeDependencies: Collection<File>,
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles @get:InputFiles
val externalGradleDependencies: Collection<File>, val externalGradleDependencies: Collection<File>,
@@ -9,6 +9,8 @@ import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Input import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.OutputFile 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.gradle.api.tasks.TaskAction
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
import java.io.File import java.io.File
@@ -31,11 +33,13 @@ open class KotlinNpmInstallTask : DefaultTask() {
val args: MutableList<String> = mutableListOf() val args: MutableList<String> = mutableListOf()
@Suppress("unused") @Suppress("unused")
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles @get:InputFiles
val packageJsonFiles: Collection<File> by lazy { val packageJsonFiles: Collection<File> by lazy {
resolutionManager.packageJsonFiles resolutionManager.packageJsonFiles
} }
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles @get:InputFiles
val preparedFiles: Collection<File> by lazy { val preparedFiles: Collection<File> by lazy {
nodeJs.packageManager.preparedFiles(nodeJs) nodeJs.packageManager.preparedFiles(nodeJs)
@@ -12,6 +12,8 @@ import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFile import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.InputFiles import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.Internal 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.process.internal.DefaultProcessForkOptions
import org.gradle.util.ConfigureUtil import org.gradle.util.ConfigureUtil
import org.jetbrains.kotlin.gradle.internal.testing.TCServiceMessagesTestExecutionSpec import org.jetbrains.kotlin.gradle.internal.testing.TCServiceMessagesTestExecutionSpec
@@ -65,6 +67,7 @@ constructor(
val testFrameworkSettings: String val testFrameworkSettings: String
@Input get() = testFramework!!.settingsState @Input get() = testFramework!!.settingsState
@PathSensitive(PathSensitivity.ABSOLUTE)
@InputFile @InputFile
val inputFileProperty: RegularFileProperty = project.newFileProperty() val inputFileProperty: RegularFileProperty = project.newFileProperty()
@@ -72,6 +75,7 @@ constructor(
var debug: Boolean = false var debug: Boolean = false
@Suppress("unused") @Suppress("unused")
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles @get:InputFiles
val runtimeClasspath: FileCollection by lazy { val runtimeClasspath: FileCollection by lazy {
compilation.runtimeDependencyFiles compilation.runtimeDependencyFiles
@@ -79,6 +83,7 @@ constructor(
@Suppress("unused") @Suppress("unused")
@get:InputFiles @get:InputFiles
@get:PathSensitive(PathSensitivity.ABSOLUTE)
internal val compilationOutputs: FileCollection by lazy { internal val compilationOutputs: FileCollection by lazy {
compilation.output.allOutputs compilation.output.allOutputs
} }
@@ -88,6 +88,7 @@ constructor(
internal var resolveFromModulesFirst: Boolean = false internal var resolveFromModulesFirst: Boolean = false
@Suppress("unused") @Suppress("unused")
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles @get:InputFiles
val runtimeClasspath: FileCollection by lazy { val runtimeClasspath: FileCollection by lazy {
compilation.compileDependencyFiles compilation.compileDependencyFiles
@@ -145,6 +146,7 @@ constructor(
private val projectDir = project.projectDir private val projectDir = project.projectDir
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:Optional @get:Optional
@get:InputDirectory @get:InputDirectory
open val configDirectory: File? by lazy { open val configDirectory: File? by lazy {
@@ -36,12 +36,14 @@ internal open class CommonizerTask : DefaultTask() {
@get:Input @get:Input
var targetGroups: Set<KonanTargetGroup> = emptySet() var targetGroups: Set<KonanTargetGroup> = emptySet()
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputDirectory @get:InputDirectory
@Suppress("unused") // Only for up-to-date checker. The directory with the original common libs. @Suppress("unused") // Only for up-to-date checker. The directory with the original common libs.
val originalCommonLibrariesDirectory = konanHome val originalCommonLibrariesDirectory = konanHome
.resolve(KONAN_DISTRIBUTION_KLIB_DIR) .resolve(KONAN_DISTRIBUTION_KLIB_DIR)
.resolve(KONAN_DISTRIBUTION_COMMON_LIBS_DIR) .resolve(KONAN_DISTRIBUTION_COMMON_LIBS_DIR)
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputDirectory @get:InputDirectory
@Suppress("unused") // Only for up-to-date checker. The directory with the original platform libs. @Suppress("unused") // Only for up-to-date checker. The directory with the original platform libs.
val originalPlatformLibrariesDirectory = konanHome val originalPlatformLibrariesDirectory = konanHome
@@ -52,6 +54,7 @@ internal open class CommonizerTask : DefaultTask() {
val commonizerTargetOutputDirectories val commonizerTargetOutputDirectories
get() = targetGroups.map { targets -> project.nativeDistributionCommonizerOutputDirectory(targets) } get() = targetGroups.map { targets -> project.nativeDistributionCommonizerOutputDirectory(targets) }
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles @get:InputFiles
@Suppress("unused") // Only for up-to-date checker. @Suppress("unused") // Only for up-to-date checker.
val successMarkers val successMarkers
@@ -364,6 +364,7 @@ open class PodGenTask : DefaultTask() {
} }
} }
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFile @get:InputFile
internal lateinit var podspec: Provider<File> internal lateinit var podspec: Provider<File>
@@ -480,12 +481,14 @@ private fun getBuildSettingFileName(pod: CocoapodsDependency, sdk: String): Stri
*/ */
open class PodBuildTask : DefaultTask() { open class PodBuildTask : DefaultTask() {
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFile @get:InputFile
internal lateinit var buildSettingsFile: Provider<File> internal lateinit var buildSettingsFile: Provider<File>
@get:Nested @get:Nested
internal lateinit var pod: Provider<CocoapodsDependency> internal lateinit var pod: Provider<CocoapodsDependency>
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles @get:InputFiles
internal val srcDir: FileTree internal val srcDir: FileTree
get() = project.fileTree( get() = project.fileTree(
@@ -105,11 +105,13 @@ open class FatFrameworkTask: DefaultTask() {
private val fatDsym: IosDsymFiles private val fatDsym: IosDsymFiles
get() = fatFramework.dSYM get() = fatFramework.dSYM
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles @get:InputFiles
@get:SkipWhenEmpty @get:SkipWhenEmpty
protected val inputFrameworkFiles: Iterable<FileTree> protected val inputFrameworkFiles: Iterable<FileTree>
get() = frameworks.map { project.fileTree(it.outputFile) } get() = frameworks.map { project.fileTree(it.outputFile) }
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:InputFiles @get:InputFiles
protected val inputDsymFiles: Iterable<FileTree> protected val inputDsymFiles: Iterable<FileTree>
get() = frameworks.mapNotNull { framework -> get() = frameworks.mapNotNull { framework ->
@@ -33,6 +33,7 @@ abstract class KotlinNativeTest : KotlinTest() {
@get:Internal @get:Internal
val executableProperty: Property<FileCollection> = project.objects.property(FileCollection::class.java) 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:InputFiles // use FileCollection & @InputFiles rather than @InputFile to allow for task dependencies built-into this FileCollection
@get:SkipWhenEmpty @get:SkipWhenEmpty
@Suppress("UNUSED") // Gradle input @Suppress("UNUSED") // Gradle input