Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Scaling Android Builds in Pandemic Times

Iñaki Villar
November 17, 2020

Scaling Android Builds in Pandemic Times

Droidcon America

Iñaki Villar

November 17, 2020
Tweet

More Decks by Iñaki Villar

Other Decks in Technology

Transcript

  1. BUILD GRADLE PLUGINS .GRADLE .KTS DEP DEP DEP DEP DEP

    DEP ~/.gradle — wrapper — caches — modules-2 — files-1 — …
  2. - Task Type / Classpath - Build Stack Components (Gradle,

    AGP, KGP, builders…) - Build script when affects execution of the task - Names of the output properties Build Cache Key
  3. - Task Type / Classpath Build cache key for task

    'generateDebugBuildConfig' is d7ac6c5c1072df6d3f86efda018f0136 - Build Stack Components (Gradle, AGP, KGP, builders…) - Build script when affects execution of the task - Names of the output properties Build Cache Key
  4. buildCache { local { enabled = !gradle.ext.isCi } remote(HttpBuildCache) {

    url = buildCacheUrl push = gradle.ext.isCi } } https://docs.gradle.org/current/dsl/org.gradle.caching.http.HttpBuildCache.html
  5. buildCache { local { enabled = !gradle.ext.isCi } remote(HttpBuildCache) {

    url = buildCacheUrl push = gradle.ext.isCi } } buildCache { registerBuildCacheService(S3.class, S3CacheFactory.class) remote(S3.class) { enabled = true push = true region = AWS_REGION bucket = AWS_BUCKET awsAccessKeyId = AWS_KEY awsSecretKey = AWS_SECRET awsSessionToken = AWS_TOKEN } }
  6. buildCache { local { enabled = !gradle.ext.isCi } remote(HttpBuildCache) {

    url = buildCacheUrl push = gradle.ext.isCi } } buildCache { registerBuildCacheService(S3.class, S3CacheFactory.class) remote(S3.class) { enabled = true push = true region = AWS_REGION bucket = AWS_BUCKET awsAccessKeyId = AWS_KEY awsSecretKey = AWS_SECRET awsSessionToken = AWS_TOKEN } }
  7. buildCache { local { enabled = !gradle.ext.isCi } remote(HttpBuildCache) {

    url = buildCacheUrl push = gradle.ext.isCi } } buildCache { registerBuildCacheService(S3.class, S3CacheFactory.class) remote(S3.class) { enabled = true push = true region = AWS_REGION bucket = AWS_BUCKET awsAccessKeyId = AWS_KEY awsSecretKey = AWS_SECRET awsSessionToken = AWS_TOKEN } }
  8. Task requested from cache 6805 Hit 6805 100% Local disabled

    Remote 6805 100% Miss 0 CI BUILD LOCAL BUILD
  9. Task requested from cache 6805 Hit 6805 100% Local disabled

    Remote 6805 100% Miss 0 CI BUILD LOCAL BUILD
  10. Task requested from cache 6805 Hit 6805 100% Local disabled

    Remote 6805 100% Miss 0 CI BUILD LOCAL BUILD
  11. Task requested from cache 6805 Hit 6805 100% Local disabled

    Remote 6805 100% Miss 0 CI BUILD LOCAL BUILD
  12. Task requested from cache 6805 Hit 6805 100% Local disabled

    Remote 6805 100% Miss 0 Task requested from cache 6805 Hit 6755 99% Local 2728 40% Remote 4027 59% Miss 50 CI BUILD LOCAL BUILD
  13. Task requested from cache 6805 Hit 6805 100% Local disabled

    Remote 6805 100% Miss 0 Task requested from cache 6805 Hit 6755 99% Local 2728 40% Remote 4027 59% Miss 50 CI BUILD LOCAL BUILD
  14. Task requested from cache 6805 Hit 6805 100% Local disabled

    Remote 6805 100% Miss 0 Task requested from cache 6805 Hit 6755 99% Local 2728 40% Remote 4027 59% Miss 50 CI BUILD LOCAL BUILD
  15. Task requested from cache 6805 Hit 6805 100% Local disabled

    Remote 6805 100% Miss 0 Task requested from cache 6805 Hit 6755 99% Local 2728 40% Remote 4027 59% Miss 50 CI BUILD LOCAL BUILD
  16. Task requested from cache 6805 Hit 6805 100% Local disabled

    Remote 6805 100% Miss 0 Task requested from cache 6805 Hit 6755 99% Local 2728 40% Remote 4027 59% Miss 50 Remote Cache (HTTP) Operations Hit 4027 Miss library:ui:kaptDebugKotlin library:ui:compileDebugKotlin app:kaptDebugKotlin app:compileDebugKotlin … CI BUILD LOCAL BUILD
  17. Task requested from cache 6805 Hit 6805 100% Local disabled

    Remote 6805 100% Miss 0 Task requested from cache 6805 Hit 6755 99% Local 2728 40% Remote 4027 59% Miss 50 Remote Cache (HTTP) Operations Hit 4027 Miss library:ui:kaptDebugKotlin library:ui:compileDebugKotlin app:kaptDebugKotlin app:compileDebugKotlin … CI BUILD LOCAL BUILD
  18. > Task :library:data:generateDebugBuildConfig 'appPackageName' to build cache key: f6bd6b3389b872033d462029172c8612 'buildConfigPackageName'

    to build cache key: 314a123772713f0e033d60dfa62e8a83 'buildTypeName' to build cache key: 1d2b35e3e2924d8f29639aa6b3873a11 'debuggable' to build cache key: f6d7ed39fe24031e22d54f3fe65b901c 'enableGradleWorkers' to build cache key: f6d7ed39fe24031e22d54f3fe65b901c 'flavorName' to build cache key: f1d3ff8443297732862df21dc4e57262 'itemValues' to build cache key: 8222d82255460164427051d7537fa305 'library' to build cache key: f6d7ed39fe24031e22d54f3fe65b901c 'versionCode' to build cache key: 8d6fc65b288946cac11b2aaa4ef11de5 'versionName' to build cache key: f13b59d185c6ccc578fb0e600efd5f05 'mergedManifests' to build cache key: 5fd1e7396e8de4cb5c23dc6aadd7787a Appending output property name to build cache key: sourceOutputDir Build cache key for task ':library:data:generateDebugBuildConfig' is d7ac6c5c1072df6d3f86efda018f0136
  19. > Task :library:data:generateDebugBuildConfig 'appPackageName' to build cache key: f6bd6b3389b872033d462029172c8612 'buildConfigPackageName'

    to build cache key: 314a123772713f0e033d60dfa62e8a83 'buildTypeName' to build cache key: 1d2b35e3e2924d8f29639aa6b3873a11 'debuggable' to build cache key: f6d7ed39fe24031e22d54f3fe65b901c 'enableGradleWorkers' to build cache key: f6d7ed39fe24031e22d54f3fe65b901c 'flavorName' to build cache key: f1d3ff8443297732862df21dc4e57262 'itemValues' to build cache key: 8222d82255460164427051d7537fa305 'library' to build cache key: f6d7ed39fe24031e22d54f3fe65b901c 'versionCode' to build cache key: 8d6fc65b288946cac11b2aaa4ef11de5 'versionName' to build cache key: f13b59d185c6ccc578fb0e600efd5f05 'mergedManifests' to build cache key: 5fd1e7396e8de4cb5c23dc6aadd7787a Appending output property name to build cache key: sourceOutputDir Build cache key for task ':library:data:generateDebugBuildConfig' is d7ac6c5c1072df6d3f86efda018f0136
  20. > Task :library:data:generateDebugBuildConfig 'appPackageName' to build cache key: f6bd6b3389b872033d462029172c8612 'buildConfigPackageName'

    to build cache key: 314a123772713f0e033d60dfa62e8a83 'buildTypeName' to build cache key: 1d2b35e3e2924d8f29639aa6b3873a11 'debuggable' to build cache key: f6d7ed39fe24031e22d54f3fe65b901c 'enableGradleWorkers' to build cache key: f6d7ed39fe24031e22d54f3fe65b901c 'flavorName' to build cache key: f1d3ff8443297732862df21dc4e57262 'itemValues' to build cache key: 8222d82255460164427051d7537fa305 'library' to build cache key: f6d7ed39fe24031e22d54f3fe65b901c 'versionCode' to build cache key: 8d6fc65b288946cac11b2aaa4ef11de5 'versionName' to build cache key: f13b59d185c6ccc578fb0e600efd5f05 'mergedManifests' to build cache key: 5fd1e7396e8de4cb5c23dc6aadd7787a Appending output property name to build cache key: sourceOutputDir Build cache key for task ':library:data:generateDebugBuildConfig' is d7ac6c5c1072df6d3f86efda018f0136
  21. > Task :library:data:generateDebugBuildConfig 'appPackageName' to build cache key: f6bd6b3389b872033d462029172c8612 'buildConfigPackageName'

    to build cache key: 314a123772713f0e033d60dfa62e8a83 'buildTypeName' to build cache key: 1d2b35e3e2924d8f29639aa6b3873a11 'debuggable' to build cache key: f6d7ed39fe24031e22d54f3fe65b901c 'enableGradleWorkers' to build cache key: f6d7ed39fe24031e22d54f3fe65b901c 'flavorName' to build cache key: f1d3ff8443297732862df21dc4e57262 'itemValues' to build cache key: 8222d82255460164427051d7537fa305 'library' to build cache key: f6d7ed39fe24031e22d54f3fe65b901c 'versionCode' to build cache key: 8d6fc65b288946cac11b2aaa4ef11de5 'versionName' to build cache key: f13b59d185c6ccc578fb0e600efd5f05 'mergedManifests' to build cache key: 5fd1e7396e8de4cb5c23dc6aadd7787a Appending output property name to build cache key: sourceOutputDir Build cache key for task ':library:data:generateDebugBuildConfig' is d7ac6c5c1072df6d3f86efda018f0136
  22. f6bd6b3389b872033d462029172c8612 f6bd6b3389b872033d462029172c8612 coroutinesStr$kotlin_gradle_plugin incrementalCompilationEnabled sourceCompatibility targetCompatibility classpath commonSourceSet 314a123772713f0e033d60dfa62e8a83 1d2b35e3e2924d8f29639aa6b3873a11

    8d6fc65b288946cac11b2aaa4ef11de5 314a123772713f0e033d60dfa62e8a83 1d2b35e3e2924d8f29639aa6b3873a11 8d6fc65b288946cac11b2aaa4ef11de5 5fd1e7396e8de4cb5c23dc6aadd7787a 5fd1e7396e8de4cb5c23dc6aadd7787a CI BUILD LOCAL BUILD f6d7ed39fe24031e22d54f3fe65b901c 8222d82255460164427051d7537fa305
  23. f6bd6b3389b872033d462029172c8612 f6bd6b3389b872033d462029172c8612 coroutinesStr$kotlin_gradle_plugin sourceCompatibility targetCompatibility classpath commonSourceSet 314a123772713f0e033d60dfa62e8a83 1d2b35e3e2924d8f29639aa6b3873a11 8d6fc65b288946cac11b2aaa4ef11de5

    314a123772713f0e033d60dfa62e8a83 1d2b35e3e2924d8f29639aa6b3873a11 8d6fc65b288946cac11b2aaa4ef11de5 5fd1e7396e8de4cb5c23dc6aadd7787a 5fd1e7396e8de4cb5c23dc6aadd7787a f6d7ed39fe24031e22d54f3fe65b901c 8222d82255460164427051d7537fa305 CI BUILD LOCAL BUILD incrementalCompilationEnabled
  24. REMOTE CACHE LOCAL BUILD LOCAL BUILD LOCAL BUILD CI INTERNAL

    BUILD ENVIRONMENT EXTERNAL BUILD ENVIRONMENT
  25. REMOTE CACHE LOCAL BUILD LOCAL BUILD LOCAL BUILD POPULATE CACHE

    JOB CI INTERNAL BUILD ENVIRONMENT EXTERNAL BUILD ENVIRONMENT REPOSITORY
  26. CI BUILD EXTERNAL BUILD ENVIRONMENT REPOSITORY CI BUILD CI BUILD

    CI BUILD BUILD CACHE S3 BUCKET AWS-CLI AWS ROLE AES_256
  27. + + + + BUILD STACK CHANGE GRADLE AGP KGP

    BULDSRC REMOTE CACHE 314a123772713f0e033d60dfa62e8a83 1d2b35e3e2924d8f29639aa6b3873a11 8d6fc65b288946cac11b2aaa4ef11de5 5fd1e7396e8de4cb5c23dc6aadd7787a PR PR PR PR
  28. + + + + BUILD STACK CHANGE GRADLE AGP KGP

    BULDSRC REMOTE CACHE LOCAL BUILD LOCAL BUILD LOCAL BUILD LOCAL BUILD 314a123772713f0e033d60dfa62e8a83 1d2b35e3e2924d8f29639aa6b3873a11 8d6fc65b288946cac11b2aaa4ef11de5 5fd1e7396e8de4cb5c23dc6aadd7787a PR PR PR PR
  29. @ZacSweers @AutonomousApps @CesarDielo @arunkumar_9t2 @VladimirSitnikv @Louis_CAD @ubiratanfsoares @ychescale9 @sboishtyan @CristianGM_dev

    @nellyspageli @vRallev @artem_zin Thanks @anton_malinskiy @stepango @joenrv @schatchenko @___mokkun___ @jeoj