Created
May 25, 2021 09:18
-
-
Save marcellogalhardo/d9ec3974df5aa815815253a4a0ddbf09 to your computer and use it in GitHub Desktop.
Root gradle.build.kts global settings for KAPT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allprojects { | |
afterEvaluate { | |
// Global KAPT flags applied to all projects. | |
extensions.findByType<KaptExtension>()?.apply { | |
// Do not replace unknown types (including types for the generated classes) by NonExistentClass. | |
correctErrorTypes = true | |
// Provide links to locations in the original Kotlin code rather than generated Java stubs | |
// as it reports errors encountered during annotation processing. | |
mapDiagnosticLocations = true | |
javacOptions { | |
// Increase the max count of errors from annotation processors. Default is 100. | |
option("-Xmaxerrs", 500) | |
} | |
arguments { | |
// Verify if the task is a debug build. | |
val isDebugBuild = gradle.startParameter.taskNames.any { taskName -> | |
taskName.toLowerCase().contains("debug") | |
} | |
// Dagger optimizations, see https://google.github.io/dagger/compiler-options | |
if (!isDebugBuild) { | |
arg("dagger.formatGeneratedSource", "enabled") | |
} | |
arg("dagger.fastInit", "enabled") | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment