Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: build/android/gyp/apk_install.py

Issue 1399273002: [Android] Add a configurable environment for devil/. (RELAND) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android_any -> android_host Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/devil_chromium.py ('k') | build/android/gyp/create_device_library_links.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2013 The Chromium Authors. All rights reserved. 3 # Copyright 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Installs an APK. 7 """Installs an APK.
8 8
9 """ 9 """
10 10
11 import optparse 11 import optparse
12 import os 12 import os
13 import re 13 import re
14 import sys 14 import sys
15 15
16 from util import build_device 16 from util import build_device
17 from util import build_utils 17 from util import build_utils
18 from util import md5_check 18 from util import md5_check
19 19
20 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..') 20 BUILD_ANDROID_DIR = os.path.abspath(
21 os.path.join(os.path.dirname(__file__), '..'))
21 sys.path.append(BUILD_ANDROID_DIR) 22 sys.path.append(BUILD_ANDROID_DIR)
22 23
24 import devil_chromium
23 from devil.android import apk_helper 25 from devil.android import apk_helper
24 from pylib import constants 26 from pylib import constants
25 27
26 28
27 def GetNewMetadata(device, apk_package): 29 def GetNewMetadata(device, apk_package):
28 """Gets the metadata on the device for the apk_package apk.""" 30 """Gets the metadata on the device for the apk_package apk."""
29 output = device.RunShellCommand('ls -l /data/app/') 31 output = device.RunShellCommand('ls -l /data/app/')
30 # Matches lines like: 32 # Matches lines like:
31 # -rw-r--r-- system system 7376582 2013-04-19 16:34 \ 33 # -rw-r--r-- system system 7376582 2013-04-19 16:34 \
32 # org.chromium.chrome.apk 34 # org.chromium.chrome.apk
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 help='Path to the Android SDK build tools folder. ' + 69 help='Path to the Android SDK build tools folder. ' +
68 'Required when using --split-apk-path.') 70 'Required when using --split-apk-path.')
69 parser.add_option('--install-record', 71 parser.add_option('--install-record',
70 help='Path to install record (touched only when APK is installed).') 72 help='Path to install record (touched only when APK is installed).')
71 parser.add_option('--build-device-configuration', 73 parser.add_option('--build-device-configuration',
72 help='Path to build device configuration.') 74 help='Path to build device configuration.')
73 parser.add_option('--stamp', 75 parser.add_option('--stamp',
74 help='Path to touch on success.') 76 help='Path to touch on success.')
75 parser.add_option('--configuration-name', 77 parser.add_option('--configuration-name',
76 help='The build CONFIGURATION_NAME') 78 help='The build CONFIGURATION_NAME')
79 parser.add_option('--output-directory',
80 help='The output directory.')
77 options, _ = parser.parse_args() 81 options, _ = parser.parse_args()
78 82
83 constants.SetBuildType(options.configuration_name)
84
85 devil_chromium.Initialize(
86 output_directory=os.path.abspath(options.output_directory))
87
79 device = build_device.GetBuildDeviceFromPath( 88 device = build_device.GetBuildDeviceFromPath(
80 options.build_device_configuration) 89 options.build_device_configuration)
81 if not device: 90 if not device:
82 return 91 return
83 92
84 constants.SetBuildType(options.configuration_name)
85
86 serial_number = device.GetSerialNumber() 93 serial_number = device.GetSerialNumber()
87 apk_package = apk_helper.GetPackageName(options.apk_path) 94 apk_package = apk_helper.GetPackageName(options.apk_path)
88 95
89 metadata_path = '%s.%s.device.time.stamp' % (options.apk_path, serial_number) 96 metadata_path = '%s.%s.device.time.stamp' % (options.apk_path, serial_number)
90 97
91 # If the APK on the device does not match the one that was last installed by 98 # If the APK on the device does not match the one that was last installed by
92 # the build, then the APK has to be installed (regardless of the md5 record). 99 # the build, then the APK has to be installed (regardless of the md5 record).
93 force_install = HasInstallMetadataChanged(device, apk_package, metadata_path) 100 force_install = HasInstallMetadataChanged(device, apk_package, metadata_path)
94 101
95 102
(...skipping 13 matching lines...) Expand all
109 record_path=record_path, 116 record_path=record_path,
110 input_paths=[options.apk_path], 117 input_paths=[options.apk_path],
111 force=force_install) 118 force=force_install)
112 119
113 if options.stamp: 120 if options.stamp:
114 build_utils.Touch(options.stamp) 121 build_utils.Touch(options.stamp)
115 122
116 123
117 if __name__ == '__main__': 124 if __name__ == '__main__':
118 sys.exit(main()) 125 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/devil_chromium.py ('k') | build/android/gyp/create_device_library_links.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698