From 311a68cfdad0c93a9321f6638956496e86c60f88 Mon Sep 17 00:00:00 2001 From: Rick Busarow Date: Tue, 3 Dec 2024 13:54:39 -0600 Subject: [PATCH] enable `trackSourceFiles` by default --- README.md | 10 +++++----- .../com/squareup/anvil/compiler/CommandLineOptions.kt | 2 +- .../com/squareup/anvil/plugin/AnvilExtensionTest.kt | 2 +- .../java/com/squareup/anvil/plugin/AnvilExtension.kt | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 26e870b18..08be619ba 100644 --- a/README.md +++ b/README.md @@ -323,17 +323,17 @@ Anvil will automatically set `correctErrorTypes` to false to avoid this issue. #### Incremental Kotlin compilation breaks Anvil's feature to merge contributions > [!TIP] -> Anvil now experimentally supports incremental compilation and Gradle's build caching, +> Anvil now supports incremental compilation and Gradle's build caching, > as of [v2.5.0](https://github.com/square/anvil/releases/tag/v2.5.0-beta01). > -> This feature is disabled by default. -> It can be enabled via a Gradle property or the Gradle DSL: +> This feature is enabled by default. +> It can be disabled via a Gradle property or the Gradle DSL: >
> Gradle Properties > > ```properties > # gradle.properties -> com.squareup.anvil.trackSourceFiles=true # default is false +> com.squareup.anvil.trackSourceFiles=false # default is true > ``` > >
@@ -343,7 +343,7 @@ Anvil will automatically set `correctErrorTypes` to false to avoid this issue. > ```groovy > // build.gradle > anvil { -> trackSourceFiles = true // default is false +> trackSourceFiles = false // default is true > } > ``` > diff --git a/compiler/src/main/java/com/squareup/anvil/compiler/CommandLineOptions.kt b/compiler/src/main/java/com/squareup/anvil/compiler/CommandLineOptions.kt index 71cfde693..02450092d 100644 --- a/compiler/src/main/java/com/squareup/anvil/compiler/CommandLineOptions.kt +++ b/compiler/src/main/java/com/squareup/anvil/compiler/CommandLineOptions.kt @@ -20,7 +20,7 @@ public class CommandLineOptions private constructor( generateFactories = get(generateDaggerFactoriesKey, false), generateFactoriesOnly = get(generateDaggerFactoriesOnlyKey, false), disableComponentMerging = get(disableComponentMergingKey, false), - trackSourceFiles = get(trackSourceFilesKey, false), + trackSourceFiles = get(trackSourceFilesKey, true), willHaveDaggerFactories = get(willHaveDaggerFactoriesKey, false), backend = parseBackend(), componentMergingBackend = parseComponentMergingBackend(), diff --git a/gradle-plugin/src/gradleTest/java/com/squareup/anvil/plugin/AnvilExtensionTest.kt b/gradle-plugin/src/gradleTest/java/com/squareup/anvil/plugin/AnvilExtensionTest.kt index 928ba34c5..a801f53f3 100644 --- a/gradle-plugin/src/gradleTest/java/com/squareup/anvil/plugin/AnvilExtensionTest.kt +++ b/gradle-plugin/src/gradleTest/java/com/squareup/anvil/plugin/AnvilExtensionTest.kt @@ -26,7 +26,7 @@ class AnvilExtensionTest : BaseGradleTest() { kase(a1 = "disableComponentMerging", false), kase(a1 = "syncGeneratedSources", false), kase(a1 = "addOptionalAnnotations", false), - kase(a1 = "trackSourceFiles", false), + kase(a1 = "trackSourceFiles", true), ) fun GradleProjectBuilder.gradlePropertiesFile(propertyName: String, value: Any) { diff --git a/gradle-plugin/src/main/java/com/squareup/anvil/plugin/AnvilExtension.kt b/gradle-plugin/src/main/java/com/squareup/anvil/plugin/AnvilExtension.kt index ba5829e81..f1ee8d85e 100644 --- a/gradle-plugin/src/main/java/com/squareup/anvil/plugin/AnvilExtension.kt +++ b/gradle-plugin/src/main/java/com/squareup/anvil/plugin/AnvilExtension.kt @@ -110,7 +110,7 @@ public abstract class AnvilExtension @Inject constructor( * - Generated code is cached in a way that Gradle understands, * and will be restored from cache along with other build artifacts. * - * This feature is disabled by default. + * This feature is enabled by default. * * This property can also be set via a Gradle property: * @@ -119,7 +119,7 @@ public abstract class AnvilExtension @Inject constructor( * ``` */ public val trackSourceFiles: Property = objects.property(Boolean::class.java) - .conventionFromProperty("com.squareup.anvil.trackSourceFiles", false) + .conventionFromProperty("com.squareup.anvil.trackSourceFiles", true) @Suppress("PropertyName") internal var _variantFilter: Action? = null