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

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

Issue 456493002: Add native libraries to gn apks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 4 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/gyp/copy_ex.py ('k') | build/android/gyp/create_native_libraries_header.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 """Creates symlinks to native libraries for an APK. 7 """Creates symlinks to native libraries for an APK.
8 8
9 The native libraries should have previously been pushed to the device (in 9 The native libraries should have previously been pushed to the device (in
10 options.target_dir). This script then creates links in an apk's lib/ folder to 10 options.target_dir). This script then creates links in an apk's lib/ folder to
(...skipping 16 matching lines...) Expand all
27 def RunShellCommand(device, cmd): 27 def RunShellCommand(device, cmd):
28 output = device.RunShellCommand(cmd) 28 output = device.RunShellCommand(cmd)
29 29
30 if output: 30 if output:
31 raise Exception( 31 raise Exception(
32 'Unexpected output running command: ' + cmd + '\n' + 32 'Unexpected output running command: ' + cmd + '\n' +
33 '\n'.join(output)) 33 '\n'.join(output))
34 34
35 35
36 def CreateSymlinkScript(options): 36 def CreateSymlinkScript(options):
37 libraries = build_utils.ReadJson(options.libraries_json) 37 libraries = build_utils.ParseGypList(options.libraries)
38 38
39 link_cmd = ( 39 link_cmd = (
40 'rm $APK_LIBRARIES_DIR/%(lib_basename)s > /dev/null 2>&1 \n' 40 'rm $APK_LIBRARIES_DIR/%(lib_basename)s > /dev/null 2>&1 \n'
41 'ln -s $STRIPPED_LIBRARIES_DIR/%(lib_basename)s ' 41 'ln -s $STRIPPED_LIBRARIES_DIR/%(lib_basename)s '
42 '$APK_LIBRARIES_DIR/%(lib_basename)s \n' 42 '$APK_LIBRARIES_DIR/%(lib_basename)s \n'
43 ) 43 )
44 44
45 script = '#!/bin/sh \n' 45 script = '#!/bin/sh \n'
46 46
47 for lib in libraries: 47 for lib in libraries:
(...skipping 23 matching lines...) Expand all
71 'STRIPPED_LIBRARIES_DIR=%(target_dir)s; ' 71 'STRIPPED_LIBRARIES_DIR=%(target_dir)s; '
72 '. %(script_device_path)s' 72 '. %(script_device_path)s'
73 ) % { 73 ) % {
74 'apk_libraries_dir': apk_libraries_dir, 74 'apk_libraries_dir': apk_libraries_dir,
75 'target_dir': options.target_dir, 75 'target_dir': options.target_dir,
76 'script_device_path': options.script_device_path 76 'script_device_path': options.script_device_path
77 } 77 }
78 RunShellCommand(device, trigger_cmd) 78 RunShellCommand(device, trigger_cmd)
79 79
80 80
81 def main(): 81 def main(args):
82 args = build_utils.ExpandFileArgs(args)
82 parser = optparse.OptionParser() 83 parser = optparse.OptionParser()
83 parser.add_option('--apk', help='Path to the apk.') 84 parser.add_option('--apk', help='Path to the apk.')
84 parser.add_option('--script-host-path', 85 parser.add_option('--script-host-path',
85 help='Path on the host for the symlink script.') 86 help='Path on the host for the symlink script.')
86 parser.add_option('--script-device-path', 87 parser.add_option('--script-device-path',
87 help='Path on the device to push the created symlink script.') 88 help='Path on the device to push the created symlink script.')
88 parser.add_option('--libraries-json', 89 parser.add_option('--libraries',
89 help='Path to the json list of native libraries.') 90 help='List of native libraries.')
90 parser.add_option('--target-dir', 91 parser.add_option('--target-dir',
91 help='Device directory that contains the target libraries for symlinks.') 92 help='Device directory that contains the target libraries for symlinks.')
92 parser.add_option('--stamp', help='Path to touch on success.') 93 parser.add_option('--stamp', help='Path to touch on success.')
93 parser.add_option('--build-device-configuration', 94 parser.add_option('--build-device-configuration',
94 help='Path to build device configuration.') 95 help='Path to build device configuration.')
95 parser.add_option('--configuration-name', 96 parser.add_option('--configuration-name',
96 help='The build CONFIGURATION_NAME') 97 help='The build CONFIGURATION_NAME')
97 options, _ = parser.parse_args() 98 options, _ = parser.parse_args(args)
98 99
99 required_options = ['apk', 'libraries_json', 'script_host_path', 100 required_options = ['apk', 'libraries', 'script_host_path',
100 'script_device_path', 'target_dir', 'configuration_name'] 101 'script_device_path', 'target_dir', 'configuration_name']
101 build_utils.CheckOptions(options, parser, required=required_options) 102 build_utils.CheckOptions(options, parser, required=required_options)
102 constants.SetBuildType(options.configuration_name) 103 constants.SetBuildType(options.configuration_name)
103 104
104 CreateSymlinkScript(options) 105 CreateSymlinkScript(options)
105 TriggerSymlinkScript(options) 106 TriggerSymlinkScript(options)
106 107
107 if options.stamp: 108 if options.stamp:
108 build_utils.Touch(options.stamp) 109 build_utils.Touch(options.stamp)
109 110
110 111
111 if __name__ == '__main__': 112 if __name__ == '__main__':
112 sys.exit(main()) 113 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « build/android/gyp/copy_ex.py ('k') | build/android/gyp/create_native_libraries_header.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698