From a6aa53fe6079216aa7167966b55b5c46ea4521b6 Mon Sep 17 00:00:00 2001 From: Zac Sweers Date: Thu, 10 Oct 2024 22:26:25 -0400 Subject: [PATCH] Strict plugin validation --- platforms/gradle/foundry-gradle-plugin/build.gradle.kts | 2 ++ .../main/kotlin/foundry/gradle/dependencyrake/DependencyRake.kt | 2 ++ .../src/main/kotlin/foundry/gradle/tasks/AndroidTestApksTask.kt | 2 ++ .../main/kotlin/foundry/gradle/tasks/BaseDependencyCheckTask.kt | 2 ++ .../src/main/kotlin/foundry/gradle/tasks/BaseDownloadTask.kt | 2 ++ 5 files changed, 10 insertions(+) diff --git a/platforms/gradle/foundry-gradle-plugin/build.gradle.kts b/platforms/gradle/foundry-gradle-plugin/build.gradle.kts index b35699281..1260d7832 100644 --- a/platforms/gradle/foundry-gradle-plugin/build.gradle.kts +++ b/platforms/gradle/foundry-gradle-plugin/build.gradle.kts @@ -55,6 +55,8 @@ tasks.named("processResources") { moshi { enableSealed.set(true) } +tasks.named("validatePlugins") { enableStricterValidation.set(true) } + // This is necessary for included builds, as the KGP plugin isn't applied in them and thus doesn't // apply disambiguation rules dependencies.constraints { diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/dependencyrake/DependencyRake.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/dependencyrake/DependencyRake.kt index 874b49c47..1c17733f7 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/dependencyrake/DependencyRake.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/dependencyrake/DependencyRake.kt @@ -48,6 +48,7 @@ import org.gradle.api.tasks.PathSensitivity import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.TaskProvider import org.gradle.api.tasks.UntrackedTask +import org.gradle.work.DisableCachingByDefault private const val IGNORE_COMMENT = "// dependency-rake=ignore" @@ -71,6 +72,7 @@ private val MANAGED_DEPENDENCIES = * advice to the project build file. This is usually not run directly, but rather added as a * finalizer to the `AdviceTask` it reads from. */ +@DisableCachingByDefault internal abstract class RakeDependencies @Inject constructor(objects: ObjectFactory, providers: ProviderFactory) : AbstractPostProcessingTask() { diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/AndroidTestApksTask.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/AndroidTestApksTask.kt index a09f2e8a0..6d3a6e8d4 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/AndroidTestApksTask.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/AndroidTestApksTask.kt @@ -34,6 +34,7 @@ import org.gradle.api.tasks.PathSensitive import org.gradle.api.tasks.PathSensitivity.RELATIVE import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.TaskProvider +import org.gradle.work.DisableCachingByDefault /** * A task that aggregates all the androidTest apk paths and writes them (newline-delimited) to an @@ -41,6 +42,7 @@ import org.gradle.api.tasks.TaskProvider * * Not cacheable because this outputs absolute paths. */ +@DisableCachingByDefault public abstract class AndroidTestApksTask : DefaultTask() { @get:PathSensitive(RELATIVE) @get:InputFiles diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/BaseDependencyCheckTask.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/BaseDependencyCheckTask.kt index 2a0bfa5c9..2b36eb7af 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/BaseDependencyCheckTask.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/BaseDependencyCheckTask.kt @@ -24,7 +24,9 @@ import org.gradle.api.provider.MapProperty import org.gradle.api.tasks.Input import org.gradle.api.tasks.TaskAction import org.gradle.internal.component.external.model.ModuleComponentArtifactIdentifier +import org.gradle.work.DisableCachingByDefault +@DisableCachingByDefault public abstract class BaseDependencyCheckTask : DefaultTask() { @get:Input public abstract val identifiersToVersions: MapProperty diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/BaseDownloadTask.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/BaseDownloadTask.kt index 3255b25b6..def20d626 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/BaseDownloadTask.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/BaseDownloadTask.kt @@ -29,6 +29,7 @@ import org.gradle.api.tasks.Input import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.TaskAction import org.gradle.internal.logging.progress.ProgressLoggerFactory +import org.gradle.work.DisableCachingByDefault /** * Downloads a binary from its GitHub releases. @@ -38,6 +39,7 @@ import org.gradle.internal.logging.progress.ProgressLoggerFactory * ./gradlew * ``` */ +@DisableCachingByDefault internal abstract class BaseDownloadTask( private val targetName: String, private val addExecPrefix: Boolean = false,