# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#########################################
# JVM Args
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Ensure important default jvmargs aren't overwritten. See https://github.com/gradle/gradle/issues/19750
#
# For more information about how Gradle JVM options were chosen:
# - Xmx - Maximum heap size. If the codebase grew it should be updated.
# - Xms - Minimum heap size, we set it to the peak measured heap size.
# - UseG1GC - If the goal is to return as much memory as possible to the machine, G1GC is the better
# choice. It is also very nearly as fast as ParallelGC.
# - Metaspace - See https://www.jasonpearson.dev/metaspace-in-jvm-builds/
# - SoftRefLRUPolicyMSPerMB would default to 1000 which with a 4gb heap translates to ~51 minutes.
# A value of 1 means ~4 seconds before SoftRefs can be collected, which means its realistic to
# collect them as needed during a build that should take seconds to minutes.
# - CodeCache normally defaults to a very small size. Increasing it from platform defaults of 32-48m
# because of how many classes can be loaded into memory and then cached as native compiled code
# for a small speed boost.
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=2g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# For more information about how Kotlin Daemon JVM options were chosen:
# - Kotlin JVM args only inherit Xmx, ReservedCodeCache, and MaxMetaspace. Since we are specifying
# other args we need to specify all of them here.
# - We're using the Kotlin Gradle Plugin's default value for ReservedCodeCacheSize, if we do not then
# the Gradle JVM arg value for ReservedCodeCacheSize will be used.
kotlin.daemon.jvmargs=-XX:+UseG1GC -XX:SoftRefLRUPolicyMSPerMB=1 -XX:ReservedCodeCacheSize=320m -XX:+HeapDumpOnOutOfMemoryError -Xmx1g -Xms512m
# For more information about how Gradle Worker JVM options were chosen
org.gradle.testWorker.jvmargs=-Dfile.encoding=UTF-8 -XX:+UseG1GC -XX:SoftRefLRUPolicyMSPerMB=1 -XX:ReservedCodeCacheSize=128m -XX:+HeapDumpOnOutOfMemoryError -Xmx512g -Xms256m
#########################################
# Non-default Gradle performance settings
# Gradle will use the local (and if configured, remote) build cache if true. This means that each
# step of the build that has deterministic outputs for the same inputs will be able to skip building
# in future builds. The local build cache is written to path
# `$GRADLE_USER_HOME/caches/build-cache-1`
org.gradle.caching=true
# Gradle will run in parallel mode if true.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true
# Gradle will use the local configuration cache if true. This means that for each step of the
# configuration phase that has deterministic outputs for the same inputs will be able to skip
# in future builds. The local configuration cache is written to path
# `$GRADLE_PROJECT_ROOT/.gradle/configuration-cache/<hasH>`
org.gradle.configuration-cache=true
org.gradle.configuration-cache.problems=warn
# This is an experimental flag starting in Gradle 8.11 to load config cache entries in parallel.
org.gradle.configuration-cache.parallel=true
# The following would be a semicolon separated list of glob wildcard file paths to ignore file
# system checks. As of early 2024 all known issues have been addressed and this should no longer be
# necessary. I am leaving this flag here for historical documentation purposes.
# org.gradle.configuration-cache.inputs.unsafe.ignore.file-system-checks=
# Before Gradle 8.4, some undeclared configuration inputs that were never used in the configuration
# logic could still be read when the task graph was serialized by the configuration cache. However,
# their changes would not invalidate the configuration cache afterward. Starting with Gradle 8.4,
# such undeclared configuration inputs are correctly tracked.
# As of 2/1/2024 AGP seems to have an undeclared configuration input based on Android SDK platform
# tool installation metadata, but this should never invalidate the configuration cache.
# https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:adoption:changes_in_behavior
# Trying out removing this
# org.gradle.configuration-cache.inputs.unsafe.ignore.in-serialization=true
# Isolated Projects allows configuration and tooling model creation for each project to safely
# run in parallel, with the result cached and invalidated independently for each project.
# Plugin Support:
# AGP: 8.8.0-alpha09
# KGP: Unknown
# Compose Compiler: Unknown
# See https://docs.gradle.org/current/userguide/isolated_projects.html
org.gradle.unsafe.isolated-projects=false
#########################################
# Android
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
android.uniquePackageNames=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.defaults.buildFeatures.buildconfig=false
android.enableBuildConfigAsBytecode=true
android.r8.maxWorkers=2
# Suppress warnings about experimental AGP properties we're using
# Ironically, this property itself is also experimental, so we have to suppress it too.
android.suppressUnsupportedOptionWarnings=android.suppressUnsupportedOptionWarnings,\
android.lint.useK2Uast,\
android.enableBuildConfigAsBytecode,\
android.r8.maxWorkers
android.lint.useK2Uast=true
# Disable features we do not use
android.defaults.buildfeatures.aidl=false
android.defaults.buildfeatures.buildconfig=false
android.defaults.buildfeatures.renderscript=false
android.defaults.buildfeatures.resvalues=false
android.defaults.buildfeatures.shaders=false
#########################################
# Kotlin
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# New Kotlin IC flags, should become defaults in Kotlin 2.0
kotlin.compiler.suppressExperimentalICOptimizationsWarning=true
kotlin.compiler.keepIncrementalCompilationCachesInMemory=true
kotlin.compiler.preciseCompilationResultsBackup=true
kotlin.incremental=true
kotlin.incremental.useClasspathSnapshot=true
# Anvil experimental incremental compilation and build caching
com.squareup.anvil.trackSourceFiles=true
ksp.useKSP2=false