OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # This file is meant to be included into a target to provide a rule | 5 # This file is meant to be included into a target to provide a rule |
6 # to build Android APKs in a consistent manner. | 6 # to build Android APKs in a consistent manner. |
7 # | 7 # |
8 # To use this, create a gyp target with the following form: | 8 # To use this, create a gyp target with the following form: |
9 # { | 9 # { |
10 # 'target_name': 'my_package_apk', | 10 # 'target_name': 'my_package_apk', |
(...skipping 30 matching lines...) Expand all Loading... |
41 # and included in the output of this target. | 41 # and included in the output of this target. |
42 # asset_location - The directory where assets are located (default: | 42 # asset_location - The directory where assets are located (default: |
43 # <PRODUCT_DIR>/<package_name>/assets). | 43 # <PRODUCT_DIR>/<package_name>/assets). |
44 # generated_src_dirs - Same as additional_src_dirs except used for .java files | 44 # generated_src_dirs - Same as additional_src_dirs except used for .java files |
45 # that are generated at build time. This should be set automatically by a | 45 # that are generated at build time. This should be set automatically by a |
46 # target's dependencies. The .java files in these directories are not | 46 # target's dependencies. The .java files in these directories are not |
47 # included in the 'inputs' list (unlike additional_src_dirs). | 47 # included in the 'inputs' list (unlike additional_src_dirs). |
48 # input_jars_paths - The path to jars to be included in the classpath. This | 48 # input_jars_paths - The path to jars to be included in the classpath. This |
49 # should be filled automatically by depending on the appropriate targets. | 49 # should be filled automatically by depending on the appropriate targets. |
50 # native_libs_paths - The path to any native library to be included in this | 50 # native_libs_paths - The path to any native library to be included in this |
51 # target. | 51 # target. This should be a path in <(SHARED_LIB_DIR). A stripped copy of |
| 52 # the library will be included in the apk and symbolic links to the |
| 53 # unstripped copy will be added to <(android_product_out) to enable native |
| 54 # debugging. |
52 | 55 |
53 { | 56 { |
54 'variables': { | 57 'variables': { |
55 'asset_location%': '', | 58 'asset_location%': '', |
56 'additional_input_paths': [], | 59 'additional_input_paths': [], |
57 'input_jars_paths': [], | 60 'input_jars_paths': [], |
58 'native_libs_paths': [], | |
59 'additional_src_dirs': [], | 61 'additional_src_dirs': [], |
60 'generated_src_dirs': [], | 62 'generated_src_dirs': [], |
61 'app_manifest_version_name%': '<(android_app_version_name)', | 63 'app_manifest_version_name%': '<(android_app_version_name)', |
62 'app_manifest_version_code%': '<(android_app_version_code)', | 64 'app_manifest_version_code%': '<(android_app_version_code)', |
63 'proguard_enabled%': 'false', | 65 'proguard_enabled%': 'false', |
64 'proguard_flags%': '' | 66 'proguard_flags%': '', |
| 67 'native_libs_paths': [], |
| 68 'manifest_package_name%': 'unknown.package.name', |
65 }, | 69 }, |
| 70 'sources': [ |
| 71 '<@(native_libs_paths)' |
| 72 ], |
| 73 'rules': [ |
| 74 { |
| 75 'rule_name': 'copy_and_strip_native_libraries', |
| 76 'extension': 'so', |
| 77 'variables': { |
| 78 'stripped_library_path': '<(PRODUCT_DIR)/<(package_name)/libs/<(android_
app_abi)/<(RULE_INPUT_ROOT).so', |
| 79 'link_dir': '<(android_product_out)/symbols/data/data/<(manifest_package
_name)/lib/', |
| 80 }, |
| 81 'outputs': [ |
| 82 '<(stripped_library_path)', |
| 83 '<(link_dir)/<(RULE_INPUT_ROOT).so', |
| 84 ], |
| 85 # There is no way to do 2 actions for each source library in gyp. So to |
| 86 # both strip the library and create the link in <(link_dir) a separate |
| 87 # script is required. |
| 88 'action': [ |
| 89 '<(DEPTH)/build/android/prepare_library_for_apk', |
| 90 '<(android_strip)', |
| 91 '<(RULE_INPUT_PATH)', |
| 92 '<(stripped_library_path)', |
| 93 '<(link_dir)', |
| 94 ], |
| 95 }, |
| 96 ], |
66 'actions': [ | 97 'actions': [ |
67 { | 98 { |
68 'action_name': 'ant_<(package_name)_apk', | 99 'action_name': 'ant_<(package_name)_apk', |
69 'message': 'Building <(package_name) apk.', | 100 'message': 'Building <(package_name) apk.', |
70 'inputs': [ | 101 'inputs': [ |
71 '<(java_in_dir)/AndroidManifest.xml', | 102 '<(java_in_dir)/AndroidManifest.xml', |
72 '<(DEPTH)/build/android/ant/chromium-apk.xml', | 103 '<(DEPTH)/build/android/ant/chromium-apk.xml', |
73 '<(DEPTH)/build/android/ant/common.xml', | 104 '<(DEPTH)/build/android/ant/common.xml', |
74 '<(DEPTH)/build/android/ant/sdk-targets.xml', | 105 '<(DEPTH)/build/android/ant/sdk-targets.xml', |
75 # If there is a separate find for additonal_src_dirs, it will find the | 106 # If there is a separate find for additional_src_dirs, it will find the |
76 # wrong .java files when additional_src_dirs is empty. | 107 # wrong .java files when additional_src_dirs is empty. |
77 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', | 108 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', |
78 '<!@(find <(java_in_dir)/<(resource_dir) -name "*")', | 109 '<!@(find <(java_in_dir)/<(resource_dir) -name "*")', |
79 '>@(input_jars_paths)', | 110 '>@(input_jars_paths)', |
80 '>@(native_libs_paths)', | 111 '>@(native_libs_paths)', |
81 '>@(additional_input_paths)', | 112 '>@(additional_input_paths)', |
82 ], | 113 ], |
83 'outputs': [ | 114 'outputs': [ |
84 # TODO(cjhopman): Apks are built with a -debug suffix even when they are | 115 # TODO(cjhopman): Apks are built with a -debug suffix even when they are |
85 # built in release. This should be fixed. | 116 # built in release. This should be fixed. |
(...skipping 28 matching lines...) Expand all Loading... |
114 '-buildfile', | 145 '-buildfile', |
115 '<(DEPTH)/build/android/ant/chromium-apk.xml', | 146 '<(DEPTH)/build/android/ant/chromium-apk.xml', |
116 | 147 |
117 # Specify CONFIGURATION_NAME as the target for ant to build. The | 148 # Specify CONFIGURATION_NAME as the target for ant to build. The |
118 # buildfile will then build the appropriate SDK tools target. | 149 # buildfile will then build the appropriate SDK tools target. |
119 '<(CONFIGURATION_NAME)', | 150 '<(CONFIGURATION_NAME)', |
120 ] | 151 ] |
121 }, | 152 }, |
122 ], | 153 ], |
123 } | 154 } |
OLD | NEW |