New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 862525 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jul 25
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Feature

Blocking:
issue 820459



Sign in to add a comment

Android: Provide App Bundle wrapper scripts

Project Member Reported by digit@google.com, Jul 11

Issue description

It is now possible to generate Android app bundles with the Chrome build system, but the result still requires manual steps for installation / launching / debugging etc.

A wrapper script, similar to out/Release/bin/chrome_public_apk should be provided to operate on bundles, i.e. something like: out/Release/bin/chrome_public_bundle.

chrome_public_apk is a small wrapper that invokes the apk_operations.py Python script, which provides many useful features related to APKs.

Similarly, we need a bundle_operations.py generic Python script that can provide useful features for bundles, or modify apk_operations.py to support bundles as well (which seems slightly more difficult though).

 
Project Member

Comment 1 by bugdroid1@chromium.org, Jul 25

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2cfbe6abffd14ee30a2b726ea5cbc6fe17df9d15

commit 2cfbe6abffd14ee30a2b726ea5cbc6fe17df9d15
Author: David 'Digit' Turner <digit@google.com>
Date: Wed Jul 25 11:40:54 2018

android: Create app bundle wrapper script for bundle targets.

This ensure that the GN android_app_bundle() template will also
generate a wrapper script to manage bundles easily from the local
machine during development and testing.

For example, $OUT/bin/chrome_public_bundle is generated for the
'chrome_public_bundle' target.

The script is very similar to the wrapper script for APKs, it
also uses apk_operations.py, which has been lightly modified
to support bundles.

A few important notes about this CL:

- The 'generate_apks' variable of android_app_bundle() is now
  a no-op, i.e. .apks archives are no longer generated by the
  build itself. Instead, the wrapper script will generate the
  .apks archive on demand.

  This simplifies the build, and allows to locally test any
  bundle if needed easily.

  The variable still exists to avoid breaking the clank/ build.

- The generation of .apks archives from bundles is implemented
  by using 'bundletool build-apks', which is called from the
  new helper script app_bundle_utils.py

  This is performed lazily through a small closure function
  generated by the bundle wrapper script, which is passed
  to the new apk_operations.RunForBundle() function.

  This scheme is used to considerably reduce the amount of
  modifications required in apk_operations.py, since this
  avoids the need to pass 6 more command-line flags down to
  the internal _Command class.

- The new 'build-bundle-apks' command can be used to build
  said .apks archive on demand, and optionally copy it to a
  different location.

  Generation is also triggered in case of 'install'.

  MD5 checks are used to ensure the .apks archive is only
  rebuild if strictly necessary, since this is a slow
  process (e.g. around 40s for chrome_public_bundle on my
  machine).

- Installation currently uses 'bundletool install-apks'
  directly and avoids using devil, since the latter doesn't
  have a good way to support bundle installation.

  Proper support for app bundles in devil will be added
  in a future CL, after which apk_operations.py may be
  updated to use it.

What was tested and works:

  'devices', 'install', 'uninstall', 'launch' (without a URL),
  'stop', 'clear-data', 'logcat', 'ps', 'disk-usage', 'run'

Tested but does not work:

  'launch <URL>' (but see TODO inside apk_operations.py)

Not tested yet:

  'argv', 'gdb', 'mem-usage', 'shell', 'compile-dex',
  'profile'

BUG= 862525 
R=agrieve@chromium.org, benmason@chromium.org, jbudorick@chromium.org

Change-Id: Ic1074a723b0a705f1f53ff484a19a1ca1041e7d7
Reviewed-on: https://chromium-review.googlesource.com/1146811
Commit-Queue: David Turner <digit@chromium.org>
Reviewed-by: agrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577842}
[modify] https://crrev.com/2cfbe6abffd14ee30a2b726ea5cbc6fe17df9d15/build/android/apk_operations.py
[add] https://crrev.com/2cfbe6abffd14ee30a2b726ea5cbc6fe17df9d15/build/android/gyp/create_bundle_wrapper_script.py
[add] https://crrev.com/2cfbe6abffd14ee30a2b726ea5cbc6fe17df9d15/build/android/pylib/utils/app_bundle_utils.py
[modify] https://crrev.com/2cfbe6abffd14ee30a2b726ea5cbc6fe17df9d15/build/config/android/rules.gni
[modify] https://crrev.com/2cfbe6abffd14ee30a2b726ea5cbc6fe17df9d15/chrome/android/BUILD.gn

Status: Fixed (was: Assigned)
Project Member

Comment 3 by bugdroid1@chromium.org, Jul 25

The following revision refers to this bug:
  https://chrome-internal.googlesource.com/clank/internal/apps/+/75d5eccf8963ed5e4ad7546874e9c00d06778743

commit 75d5eccf8963ed5e4ad7546874e9c00d06778743
Author: David 'Digit' Turner <digit@google.com>
Date: Wed Jul 25 13:49:47 2018

Sign in to add a comment