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

Issue 674250 link

Starred by 4 users

Issue metadata

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

Blocking:
issue 749239



Sign in to add a comment

Generate wrapper scripts for android_apk targets

Project Member Reported by agrieve@chromium.org, Dec 14 2016

Issue description

Right now we generate scripts that run tests, and scripts for installing incremental apks, and I think they have been quite nice to work with! Here's an idea for generating wrapper scripts for android_apk targets:

ninja chrome_public_apk would generate out/Debug/bin/chrome_public_apk.

Here's what it can do:

Use --incremental flag to force selecting an incremental apk. Otherwise, select the one which was changed more recently.

out/Debug/bin/chrome_public_apk
* Shows help message

out/Debug/bin/chrome_public_apk install
* Installs on one or more devices.
* If both incremental and non-incremental apks exist, use --incremental or --non-incremental to select one.
* If multiple devices attached, show error with list of devices (like install_chrome_public_apk_incremental does)
  * But allow --all to install to all devices.

out/Debug/bin/chrome_public_apk launch <url> [--args="--a --b"]
* Does not trigger an install
* When --args is omitted, clears any existing command-line args file on the device(s)
* When --args is present, sets command-line args
* Runs on one or more devices (same as build/android/adb_run_chrome_public)
* If multiple devices attached, show error with list of devices (like install_chrome_public_apk_incremental does)
  * But allow --all to install to all devices.

out/Debug/bin/chrome_public_apk run <url> [--args=]
* Installs and then launches

out/Debug/bin/chrome_public_apk stop
* Stops / kills chrome on all devices (or just those from -d flag)

out/Debug/bin/chrome_public_apk clear-data
* Clear states of the apk package.

out/Debug/bin/chrome_public_apk argv
* Prints current command-line flags
* Same as //build/android/adb_chrome_public_command_line
* Although launch sets this, it's still useful when starting chrome with your finger (you know, by actually touching the device)

out/Debug/bin/chrome_public_apk argv --args=""
* Clears command-line flags

out/Debug/bin/chrome_public_apk argv --args="--a --b"
* Sets command-line flags

out/Debug/bin/chrome_public_apk gdb --args="--a --b"
* Calls //build/android/adb_gdb with correct flags
* Requires --device if multiple devices are present.

out/Debug/bin/chrome_public_apk logcat
* Runs logcat with filter that shows only processes matching the package ID ?
* Requires --device if multiple devices are present.



The device location of the command-line-flags file would need to be set on GN targets. If no command_line_flags_file is set for a target, then have any attempts to set flags fail the scripts with "Target does not support setting command-line flags.")

The packageId and launch activity should be retrievable from the .apk (or AndroidManifest.xml).
 

Comment 1 by wnwen@chromium.org, Dec 14 2016

Owner: wnwen@chromium.org
Status: Assigned (was: Available)
If no one else is doing this, I'll take it.

Comment 2 by wnwen@chromium.org, Dec 14 2016

Cc: -wnwen@chromium.org
This is a really cool idea.
(and it'd let us get rid of a bunch of the shell scripts in //build/android)

Comment 5 by wnwen@chromium.org, Dec 20 2016

Cc: wnwen@chromium.org
Owner: ----
Status: Available (was: Assigned)
Might be a good intern project, waiting until Q1 2017.
Owner: yipengw@chromium.org
Status: Assigned (was: Available)
Description: Show this description
Description: Show this description
Description: Show this description
Description: Show this description
Description: Show this description
Project Member

Comment 12 by bugdroid1@chromium.org, Jul 17 2017

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

commit 1cbf27ea1030f2ace21939aafb19e19629f798b0
Author: Yipeng Wang <yipengw@chromium.org>
Date: Mon Jul 17 15:30:03 2017

Generate wrapper scripts for android_apk targets

Bug:  674250 
Change-Id: I2c8c38e680da2357abe39146571937fc369c4778
Reviewed-on: https://chromium-review.googlesource.com/558206
Commit-Queue: Yipeng Wang <yipengw@chromium.org>
Reviewed-by: Luke Halliwell <halliwell@chromium.org>
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Richard Coles <torne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487083}
[modify] https://crrev.com/1cbf27ea1030f2ace21939aafb19e19629f798b0/android_webview/test/BUILD.gn
[add] https://crrev.com/1cbf27ea1030f2ace21939aafb19e19629f798b0/build/android/apk_operations.py
[delete] https://crrev.com/39a4e54d06758898966637d4c5e1a0ec701306ef/build/android/gyp/apk_install.py
[add] https://crrev.com/1cbf27ea1030f2ace21939aafb19e19629f798b0/build/android/gyp/create_apk_operations_script.py
[modify] https://crrev.com/1cbf27ea1030f2ace21939aafb19e19629f798b0/build/config/android/rules.gni
[modify] https://crrev.com/1cbf27ea1030f2ace21939aafb19e19629f798b0/chrome/android/chrome_public_apk_tmpl.gni
[modify] https://crrev.com/1cbf27ea1030f2ace21939aafb19e19629f798b0/chromecast/BUILD.gn
[modify] https://crrev.com/1cbf27ea1030f2ace21939aafb19e19629f798b0/content/shell/android/BUILD.gn

Project Member

Comment 13 by bugdroid1@chromium.org, Jul 18 2017

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

commit f53799fbb6b413665e90da634c98d6bd8d0744fb
Author: Andrew Grieve <agrieve@chromium.org>
Date: Tue Jul 18 00:07:37 2017

Fix --incremental install for apk_operations.py

It was forgetting to pass in dex_files.
Also adds in explicit calls to pFinish(), which according to the docs
should be necessary (although they don't seem to be).

BUG= 674250 

Change-Id: Iefab37b1ef77413f54d2b6e036700cdbb8bf361d
Reviewed-on: https://chromium-review.googlesource.com/575329
Reviewed-by: Eric Stevenson <estevenson@chromium.org>
Commit-Queue: Eric Stevenson <estevenson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487301}
[modify] https://crrev.com/f53799fbb6b413665e90da634c98d6bd8d0744fb/build/android/apk_operations.py
[modify] https://crrev.com/f53799fbb6b413665e90da634c98d6bd8d0744fb/build/android/incremental_install/installer.py

Project Member

Comment 14 by bugdroid1@chromium.org, Jul 19 2017

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

commit f6573ee91b73b63d89fe1c195fda413ee5ee38ff
Author: Yipeng Wang <yipengw@chromium.org>
Date: Wed Jul 19 16:56:52 2017

apk_operations.py: Various refinements

1. Use apk_operations.py as a python module rather than
   executing it so that stack traces & argparse errors
   refer to the generated script as the main script.
2. Don't force --incremental selection for commands where
   it makes no difference.
3. Log the adb_gdb command & forward the --verbose flag.

Bug:  674250 
Change-Id: I1260f282c79eed7acf9e27343f8c4e3d74566e6c
Reviewed-on: https://chromium-review.googlesource.com/576769
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Yipeng Wang <yipengw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487890}
[modify] https://crrev.com/f6573ee91b73b63d89fe1c195fda413ee5ee38ff/build/android/apk_operations.py
[modify] https://crrev.com/f6573ee91b73b63d89fe1c195fda413ee5ee38ff/build/android/gyp/create_apk_operations_script.py

Description: Show this description
Status: Fixed (was: Assigned)
Project Member

Comment 17 by bugdroid1@chromium.org, Jul 26 2017

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

commit c81af4a6734134c1e12ec1bd35b38a8ff65fd4e9
Author: Andrew Grieve <agrieve@chromium.org>
Date: Wed Jul 26 18:02:13 2017

Android: Update docs to use generated apk wrapper scripts

BUG= 674250 

Change-Id: I336a67f3d528c52ec1d92dd18efd33f4efca84a7
Reviewed-on: https://chromium-review.googlesource.com/586471
Reviewed-by: Tommy Nyquist <nyquist@chromium.org>
Commit-Queue: Tommy Nyquist <nyquist@chromium.org>
Cr-Commit-Position: refs/heads/master@{#489692}
[modify] https://crrev.com/c81af4a6734134c1e12ec1bd35b38a8ff65fd4e9/docs/android_build_instructions.md
[modify] https://crrev.com/c81af4a6734134c1e12ec1bd35b38a8ff65fd4e9/docs/android_cast_build_instructions.md
[modify] https://crrev.com/c81af4a6734134c1e12ec1bd35b38a8ff65fd4e9/docs/android_debugging_instructions.md

Blocking: 749239

Sign in to add a comment