gradle android
play

Gradle & Android Etienne Studer, VP of Product Tooling - PowerPoint PPT Presentation

Gradle & Android Etienne Studer, VP of Product Tooling Motivation Facts implicit complexity of the domain multi-language support resource/code generation platform diversity Complexity compileX86FreeDebug


  1. Gradle & Android Etienne Studer, 
 VP of Product Tooling

  2. Motivation

  3. Facts • implicit complexity of the domain • multi-language support • resource/code generation • platform diversity

  4. Complexity

  5. compileX86FreeDebug compileX86FreeDebugAidl compileX86FreeDebugRenderscript compileX86FreeTest compileX86FreeTestAidl compileX86FreeTestRenderscript dexX86FreeTest generateX86FreeDebugBuildConfig generateX86FreeTestBuildConfig mergeX86FreeDebugAssets mergeX86FreeDebugResources mergeX86FreeTestAssets mergeX86FreeTestResources packageX86FreeTest prepareX86FreeDebugDependencies prepareX86FreeTestDependencies processX86FreeDebugManifest processX86FreeDebugResources processX86FreeTestJavaRes processX86FreeTestResources Conciseness processX86FreeTestTestManifest validateDebugSigning assembleX86Paid - Assembles all builds for flavor X86Paid [assembleX86PaidDebug, assembleX86PaidRelease] assembleX86PaidDebug - Assembles the Debug build for flavor X86Paid compileX86PaidDebug compileX86PaidDebugAidl compileX86PaidDebugRenderscript dexX86PaidDebug generateX86PaidDebugBuildConfig mergeX86PaidDebugAssets mergeX86PaidDebugResources packageX86PaidDebug prepareX86PaidDebugDependencies processX86PaidDebugJavaRes processX86PaidDebugManifest processX86PaidDebugResources validateDebugSigning assembleX86PaidRelease - Assembles the Release build for flavor X86Paid compileX86PaidRelease compileX86PaidReleaseAidl compileX86PaidReleaseRenderscript dexX86PaidRelease generateX86PaidReleaseBuildConfig mergeX86PaidReleaseAssets mergeX86PaidReleaseResources packageX86PaidRelease prepareX86PaidReleaseDependencies android { processX86PaidReleaseJavaRes processX86PaidReleaseManifest processX86PaidReleaseResources assembleX86PaidTest - Assembles the Test build for the X86PaidDebug build compileX86PaidDebug compileX86PaidDebugAidl compileSdkVersion 20 compileX86PaidDebugRenderscript compileX86PaidTest compileX86PaidTestAidl compileX86PaidTestRenderscript dexX86PaidTest generateX86PaidDebugBuildConfig generateX86PaidTestBuildConfig buildToolsVersion "20.0.0" mergeX86PaidDebugAssets mergeX86PaidDebugResources mergeX86PaidTestAssets mergeX86PaidTestResources packageX86PaidTest prepareX86PaidDebugDependencies prepareX86PaidTestDependencies processX86PaidDebugManifest processX86PaidDebugResources processX86PaidTestJavaRes processX86PaidTestResources processX86PaidTestTestManifest validateDebugSigning flavorDimensions "version" , "abi" build - Assembles and tests this project. [assemble, check] buildDependents - Assembles and tests this project and all projects that depend on it. [build] buildNeeded - Assembles and tests this project and all projects it depends on. [build] clean - Deletes the build directory. Help tasks ---------- dependencies - Displays all dependencies declared in root project 'flavors'. dependencyInsight - Displays the insight into a specific dependency in root project 'flavors'. help - Displays a help message projects - Displays the sub-projects of root project 'flavors'. properties - Displays the properties of root project 'flavors'. tasks - Displays the tasks runnable from root project 'flavors' (some of the displayed tasks may belong to subprojects). productFlavors { Install tasks ------------- installArmFreeDebug - Installs the Debug build for flavor ArmFree compileArmFreeDebug compileArmFreeDebugAidl free { compileArmFreeDebugRenderscript dexArmFreeDebug generateArmFreeDebugBuildConfig mergeArmFreeDebugAssets mergeArmFreeDebugResources packageArmFreeDebug prepareArmFreeDebugDependencies flavorDimension "version" processArmFreeDebugJavaRes processArmFreeDebugManifest processArmFreeDebugResources validateDebugSigning installArmFreeTest - Installs the Test build for the ArmFreeDebug build compileArmFreeDebug } compileArmFreeDebugAidl compileArmFreeDebugRenderscript compileArmFreeTest compileArmFreeTestAidl compileArmFreeTestRenderscript dexArmFreeTest generateArmFreeDebugBuildConfig paid { generateArmFreeTestBuildConfig mergeArmFreeDebugAssets mergeArmFreeDebugResources mergeArmFreeTestAssets mergeArmFreeTestResources packageArmFreeTest flavorDimension "version" prepareArmFreeDebugDependencies prepareArmFreeTestDependencies processArmFreeDebugManifest processArmFreeDebugResources processArmFreeTestJavaRes processArmFreeTestResources processArmFreeTestTestManifest } validateDebugSigning installArmPaidDebug - Installs the Debug build for flavor ArmPaid compileArmPaidDebug compileArmPaidDebugAidl compileArmPaidDebugRenderscript dexArmPaidDebug generateArmPaidDebugBuildConfig mergeArmPaidDebugAssets mergeArmPaidDebugResources packageArmPaidDebug prepareArmPaidDebugDependencies processArmPaidDebugJavaRes processArmPaidDebugManifest arm { processArmPaidDebugResources validateDebugSigning installArmPaidTest - Installs the Test build for the ArmPaidDebug build compileArmPaidDebug compileArmPaidDebugAidl compileArmPaidDebugRenderscript flavorDimension "abi" compileArmPaidTest compileArmPaidTestAidl compileArmPaidTestRenderscript dexArmPaidTest generateArmPaidDebugBuildConfig generateArmPaidTestBuildConfig mergeArmPaidDebugAssets } mergeArmPaidDebugResources mergeArmPaidTestAssets mergeArmPaidTestResources packageArmPaidTest prepareArmPaidDebugDependencies prepareArmPaidTestDependencies x86 { processArmPaidDebugManifest processArmPaidDebugResources processArmPaidTestJavaRes processArmPaidTestResources processArmPaidTestTestManifest validateDebugSigning installX86FreeDebug - Installs the Debug build for flavor X86Free flavorDimension "abi" compileX86FreeDebug compileX86FreeDebugAidl compileX86FreeDebugRenderscript dexX86FreeDebug generateX86FreeDebugBuildConfig mergeX86FreeDebugAssets } mergeX86FreeDebugResources packageX86FreeDebug prepareX86FreeDebugDependencies processX86FreeDebugJavaRes processX86FreeDebugManifest processX86FreeDebugResources validateDebugSigning } installX86FreeTest - Installs the Test build for the X86FreeDebug build compileX86FreeDebug compileX86FreeDebugAidl compileX86FreeDebugRenderscript compileX86FreeTest compileX86FreeTestAidl compileX86FreeTestRenderscript dexX86FreeTest generateX86FreeDebugBuildConfig generateX86FreeTestBuildConfig mergeX86FreeDebugAssets mergeX86FreeDebugResources mergeX86FreeTestAssets mergeX86FreeTestResources packageX86FreeTest prepareX86FreeDebugDependencies prepareX86FreeTestDependencies processX86FreeDebugManifest processX86FreeDebugResources processX86FreeTestJavaRes processX86FreeTestResources processX86FreeTestTestManifest validateDebugSigning installX86PaidDebug - Installs the Debug build for flavor X86Paid compileX86PaidDebug compileX86PaidDebugAidl compileX86PaidDebugRenderscript

  6. Polyglot • multiple languages • multiple teams • coordinated releases

  7. Product delivery • more than just building APKs • documentation with tested code examples • auto-provisioned dev environments • automated release process • …

  8. The Android Build System Android Studio IDE + Android Gradle Plugin + Gradle Platform + Android Tooling

  9. Have a single truth of build logic Put all build logic into the build. 
 Derive all information from the build model.

  10. AS Cmd Line (developer) (build master) Tooling API Launcher Gradle Server (daemon) (cont integ) In a unified build, 
 Gradle is the single source of build logic.

  11. Tooling API • Proxy for embedding Gradle • Extension mechanism to provide custom models • See DefaultAndroidProject model get build models Client VM Gradle Daemon with gradle-tooling-api.jar for Gradle build invoke build tasks

  12. Tooling API • Backward & forward compatible 
 From 1.0 to 2.8 • Runtime Isolation 
 Separate daemon process • High Level Services 
 Build Cancellation,Continuous Mode, Test Execution, etc. • Build Event Model 
 Life-cycle events, task events, test events

  13. Performance

  14. Goal Minimize the build time while 
 using as little memory as needed.

  15. Observation Typically, not much changes in the build between consecutive invocations of the build. When little changes in the build, little work should be done by the build.

  16. Approach Performance enhancements are achieved through evolutionary improvements and revolutionary changes.

  17. Building with Gradle - today 2-phase build: - Configuration phase - Execution phase

  18. Execution Phase • Incremental build feature .Only run a task if its input or output has changed since the 
 previous run Inputs —> Task —> Outputs Define inputs and outputs on your custom tasks.

  19. 
 
 Execution Phase class ConversionTask extends DefaultTask { @InputFiles 
 def sourceFiles 
 @OutputDirectory 
 def targetDirectory 
 @TaskAction 
 def doSomeWork() { 
 // consume the sourceFiles and write the result 
 // to a file in the targetDirectory 
 } } task foo(type: MyTask) { 
 sourceFiles = files('input.txt'); 
 targetDirectory = file('build/result') 
 }

  20. Execution Phase • Continuous build feature .Keep the session running between build runs gradlew test -t

  21. 
 
 Execution Phase • Faster incremental builds 
 .Improvements to the management of File checksums 
 .Most notable for almost uptodate builds • Faster compilation for continuous builds 
 .Compiler daemon is kept alive for the entire ContB session Evolutionary improvements with each release!

Recommend


More recommend