1
0
Fork 0

Only set real BUILD_DATE for non-debug builds

This avoids BuildConfig modifications between local dev builds,
and speeds up the builds by avoiding running tasks that depend on BuildConfig.

Locally, depending on exact build circumstances, this saves about 5% of build runtime
for simple code changes, and about 90% of build runtime for no-op builds.
master
Grisha Kruglov 2020-05-20 19:41:00 -07:00 committed by Grisha Kruglov
parent aa0b8f65b1
commit 0e47f55c24
1 changed files with 7 additions and 3 deletions

View File

@ -346,9 +346,13 @@ android.applicationVariants.all { variant ->
}
def buildDate = Config.generateBuildDate()
buildConfigField 'String', 'BUILD_DATE', '"' + buildDate + '"'
def variantName = variant.getName()
// Setting buildDate with every build changes the generated BuildConfig, which slows down the
// build. Only do this for non-debug builds, to speed-up builds produced during local development.
if (isDebug) {
buildConfigField 'String', 'BUILD_DATE', '"debug build"'
} else {
buildConfigField 'String', 'BUILD_DATE', '"' + buildDate + '"'
}
// -------------------------------------------------------------------------------------------------
// Adjust: Read token from local file if it exists (Only release builds)