Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B buck
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 201
    • Issues 201
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • buck
  • Merge requests
  • !2592

Android App Bundles - Add Play feature delivery support for dex and native features in Buck

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/uKetki/dynamic_feature_support into master Mar 02, 2021
  • Overview 5
  • Commits 6
  • Pipelines 0
  • Changes 25

Created by: uKetki

The complete implementation is divided into 5 commits with detailed description are as follows:

[1/n Dynamic Feature Support] Create Android Optimiser layer and segregate responsibility of AndroidBinaryBuildable and AndroidBinaryOptimizer

  • Created a light AndroidBinaryBuildable by extracting optimizer flow from buildable
  • Refactored Android Buildable layer and segregated responsibility of AndroidBinaryBuildable
  • Defined AndroidBinaryPathUtility class with all possible paths for aab and apk
  • Added BinaryType enum to segregate apk and aab flow

Looking at the buck code for generating apk and aab, it is evident that AndroidBinaryBuildable is bloated with a lot of responsibilities ranging from apk/aab generation, signing to optimization.

The overview of current buck architecture: Existing Binary generation logic

The suggestion is to refactor existing code and create two separate layers: Optimizers and Buildable which can re-use the common logic for binary generation and offload the specific implementation to the respective layers: BuildableOptimizer

This approach will later help to add changes needed to support dynamic feature delivery.

[2/n Dynamic Feature Support] Update documentation of android_bundle rule to include changes required for dynamic features

  • Updated documentation of android_bundle rule to include changes required for dynamic features. Creates the final dex for base and dynamic feature by utilizing the application_module_configs flag, which will internally create an APKModuleGraph for each feature and generate a respective zip file.

[3/n Dynamic Feature Support] Add new configuration flag useDynamicFeature to support dynamic features related attributes

  • Defined a new configuration flag useDynamicFeature to support backward compatibility of AndroidBundle and AndroidBinary rule. Later this flag is used to include any specific changes related to dynamic features.

[4/n Dynamic Feature Support] Define new configuration application_modules_with_manifest to decouple the manifest behavior from the resources

  • Introduced a new configuration application_modules_with_manifest to make base module Manifest aware of the feature's manifest.
  • Added manifest tags in BUCK file: manifest_skeleton, module_manifest_skeleton, and application_modules_with_manifest where AndroidManifestMerger tool will first merge all application_modules_with_manifest into module_manifest_skeleton, which is later merged into manifest_skeleton

[5/n Dynamic Feature Support] Enable buck to support dynamic features with native libraries

  • This change prevents buck from packaging native code in dynamic modules into lib.xzs files and therefore ensures the resultant aab file is exactly the same as if it was done by Gradle.

Resulted App Bundle overview (before changes in buck): Screenshot 2021-02-17 at 11 06 39 AM

  • All feature modules contain assets with compressed libs.xzs file irrespective of the state if the feature has any native library or not
  • Native libraries are copied for all possible APKModuleGraphs in the feature module. That's why you can see assets within initialInstall module has 4 sub-directories with libs.xzs copied across

Resulted App Bundle overview (after changes in buck): Screenshot 2021-02-17 at 11 23 29 AM


Closes #2586 (closed) | Tested feature by including custom buck pex file in PlayFeatureDelivery sample.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/uKetki/dynamic_feature_support