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

Mainframer или как ускорить сборку проекта в несколько раз не написав ни строчки кода, на примере Android

Mariya
November 02, 2019

Mainframer или как ускорить сборку проекта в несколько раз не написав ни строчки кода, на примере Android

Mariya

November 02, 2019
Tweet

More Decks by Mariya

Other Decks in Technology

Transcript

  1. 3 Mainframer INTRODUCTION INTO ISSUE • Huge project (8 years)

    • Long running project • Support few release branches • Slow gradle sync • Time consuming compilation time Grodno, 2019
  2. 4 Mainframer INTRODUCTION INTO ISSUE Grodno, 2019 14 branded apps

    9 environments 2 build types 252 build variants
  3. 5 Mainframer INTRODUCTION INTO ISSUE How much does it take

    to switch between branches, change a few lines and check changes ? Grodno, 2019 Config is : Core i7 (3rd gen) 2.3 GHz / 3.3 GHz turbo 4 cores 16 GB DDR3
  4. 6 Mainframer INTRODUCTION INTO ISSUE How much does it take

    to switch between branches, change a few lines and check changes ? Grodno, 2019 23 min!
  5. 8 Mainframer HOW WE SPEED UP SYNC TIME Filter unnecessary

    flavors • Release variant. 252/2 = 126 • All environments. We have 8 environments and additional flavor with environment switcher. 126/9 = 14 build variants. Grodno, 2019
  6. 9 Mainframer HOW WE SPEED UP COMPILATION TIME gradle.properties •

    org.gradle.daemon=true • org.gradle.parallel=true • org.gradle.caching=true • org.gradle.configureondemand=true • Use latest Gradle and JVM versions • Apply plugins judiciously • Avoid expensive or blocking work • Minimize dynamic and snapshot versions • Don’t resolve dependencies at configuration time • Avoid unnecessary and unused dependencies • Multi modules Grodno, 2019
  7. 11 Mainframer WHAT IS MAINFRAMER ? A tool that executes

    a command on a remote machine while syncing files back and forth. https://github.com/buildfoundation/mainframer Grodno, 2019
  8. 12 Mainframer HOW IT WORKS • Syncs the folder where

    command is executing • Runs command on remote machine • Remote machine compiles the project the same way as on local machine • Syncs back the result Example with command line • Local compilation – ./gradlew assembleDebug • Remote compilation - ./mainframer ./gradlew assembleDebug Grodno, 2019
  9. 13 Mainframer HOW TO SETUP Remote machine Enable access via

    ssh Install sdk and other required soft Create user for each developer Local machine Download mainframer_run.sh and put into project folder . https://epa.ms/1rLgEd Copy public ssh key to remote machine Specify user name and remote machine name (ip address) Grodno, 2019
  10. 15 Mainframer COMPATIBILITY Works from the box • Unix •

    Mac OS Works on windows via WSL, Cygwin etc. Grodno, 2019
  11. 16 Mainframer OUR TEMPORARY PC CONFIGURATION Core i7 7700 4

    cores / 8 hyper threads 3.6 GHz / 4.2 GHz turbo 32 GB RAM. DDR 3 Grodno, 2019
  12. 18 Mainframer OUR PERMANENT CONFIGURATION Core i9 9900K • 8

    cores • 16 hyper threads • 3.6 GHz • 5 GHz turbo 64 GB RAM • DDR 4 • 2666 GHz 1 TB SSD M.2 Grodno, 2019 How much ? 2500$
  13. 20 Mainframer Grodno, 2019 1 user 2 users 3 users

    4 users 5 users 6 users 7 users 8 users Core i7 vs Core i9 Core i7 Core i9
  14. Config is : Core i7 (9th gen) 2.6 GHz /

    4.5 GHz turbo 6 cores 16 GB DDR4 21 Mainframer. Remote build VS Macbook 2017 Grodno, 2019
  15. 23 Mainframer ADDITIONAL PROS • Linux as additional operation system

    • Remote cache • Additional CI machine Grodno, 2019
  16. 24 Mainframer ISSUES • Gradle task appears after Android studio

    restart To fix is “Help->Edit Custom VM options-> -Dgradle.ide.gradle.run.configuration.fix.enabled=false” • Sometimes windows can lock build folder and the result of remote build can’t sync back • If build isn’t successful, you can see error in build log , but can’t tap on it and quickly navigate to file Grodno, 2019