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 15 matching lines...) Expand all Loading... |
26 # content/shell/android/java/content_shell_apk.xml | 26 # content/shell/android/java/content_shell_apk.xml |
27 # content/shell/android/java/src/chromium/base/Foo.java | 27 # content/shell/android/java/src/chromium/base/Foo.java |
28 # content/shell/android/java/src/chromium/base/Bar.java | 28 # content/shell/android/java/src/chromium/base/Bar.java |
29 # | 29 # |
30 # Required variables: | 30 # Required variables: |
31 # package_name - Used to name the intermediate output directory and in the | 31 # package_name - Used to name the intermediate output directory and in the |
32 # names of some output files. | 32 # names of some output files. |
33 # apk_name - The final apk will be named <apk_name>-debug.apk (or -release) | 33 # apk_name - The final apk will be named <apk_name>-debug.apk (or -release) |
34 # java_in_dir - The top-level java directory. The src should be in | 34 # java_in_dir - The top-level java directory. The src should be in |
35 # <java_in_dir>/src. | 35 # <java_in_dir>/src. |
36 # resource_dir - The directory for resources. | |
37 # Optional/automatic variables: | 36 # Optional/automatic variables: |
38 # additional_input_paths - These paths will be included in the 'inputs' list to | 37 # additional_input_paths - These paths will be included in the 'inputs' list to |
39 # ensure that this target is rebuilt when one of these paths changes. | 38 # ensure that this target is rebuilt when one of these paths changes. |
40 # additional_src_dirs - Additional directories with .java files to be compiled | 39 # additional_src_dirs - Additional directories with .java files to be compiled |
41 # and included in the output of this target. | 40 # and included in the output of this target. |
42 # asset_location - The directory where assets are located (default: | 41 # asset_location - The directory where assets are located (default: |
43 # <PRODUCT_DIR>/<package_name>/assets). | 42 # <PRODUCT_DIR>/<package_name>/assets). |
44 # generated_src_dirs - Same as additional_src_dirs except used for .java files | 43 # 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 | 44 # 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 | 45 # target's dependencies. The .java files in these directories are not |
47 # included in the 'inputs' list (unlike additional_src_dirs). | 46 # included in the 'inputs' list (unlike additional_src_dirs). |
48 # input_jars_paths - The path to jars to be included in the classpath. This | 47 # 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. | 48 # 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 | 49 # native_libs_paths - The path to any native library to be included in this |
51 # target. This should be a path in <(SHARED_LIB_DIR). A stripped copy of | 50 # 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 | 51 # 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 | 52 # unstripped copy will be added to <(android_product_out) to enable native |
54 # debugging. | 53 # debugging. |
| 54 # resource_dir - The directory for resources. |
55 | 55 |
56 { | 56 { |
57 'variables': { | 57 'variables': { |
58 'asset_location%': '', | 58 'asset_location%': '', |
59 'additional_input_paths': [], | 59 'additional_input_paths': [], |
60 'input_jars_paths': [], | 60 'input_jars_paths': [], |
61 'additional_src_dirs': [], | 61 'additional_src_dirs': [], |
62 'generated_src_dirs': [], | 62 'generated_src_dirs': [], |
63 'app_manifest_version_name%': '<(android_app_version_name)', | 63 'app_manifest_version_name%': '<(android_app_version_name)', |
64 'app_manifest_version_code%': '<(android_app_version_code)', | 64 'app_manifest_version_code%': '<(android_app_version_code)', |
65 'proguard_enabled%': 'false', | 65 'proguard_enabled%': 'false', |
66 'proguard_flags%': '', | 66 'proguard_flags%': '', |
67 'native_libs_paths': [], | 67 'native_libs_paths': [], |
68 'manifest_package_name%': 'unknown.package.name', | 68 'manifest_package_name%': 'unknown.package.name', |
| 69 'resource_dir%':'', |
69 }, | 70 }, |
70 'sources': [ | 71 'sources': [ |
71 '<@(native_libs_paths)' | 72 '<@(native_libs_paths)' |
72 ], | 73 ], |
73 'rules': [ | 74 'rules': [ |
74 { | 75 { |
75 'rule_name': 'copy_and_strip_native_libraries', | 76 'rule_name': 'copy_and_strip_native_libraries', |
76 'extension': 'so', | 77 'extension': 'so', |
77 'variables': { | 78 'variables': { |
78 'stripped_library_path': '<(PRODUCT_DIR)/<(package_name)/libs/<(android_
app_abi)/<(RULE_INPUT_ROOT).so', | 79 'stripped_library_path': '<(PRODUCT_DIR)/<(package_name)/libs/<(android_
app_abi)/<(RULE_INPUT_ROOT).so', |
(...skipping 20 matching lines...) Expand all Loading... |
99 'action_name': 'ant_<(package_name)_apk', | 100 'action_name': 'ant_<(package_name)_apk', |
100 'message': 'Building <(package_name) apk.', | 101 'message': 'Building <(package_name) apk.', |
101 'inputs': [ | 102 'inputs': [ |
102 '<(java_in_dir)/AndroidManifest.xml', | 103 '<(java_in_dir)/AndroidManifest.xml', |
103 '<(DEPTH)/build/android/ant/chromium-apk.xml', | 104 '<(DEPTH)/build/android/ant/chromium-apk.xml', |
104 '<(DEPTH)/build/android/ant/common.xml', | 105 '<(DEPTH)/build/android/ant/common.xml', |
105 '<(DEPTH)/build/android/ant/sdk-targets.xml', | 106 '<(DEPTH)/build/android/ant/sdk-targets.xml', |
106 # If there is a separate find for additional_src_dirs, it will find the | 107 # If there is a separate find for additional_src_dirs, it will find the |
107 # wrong .java files when additional_src_dirs is empty. | 108 # wrong .java files when additional_src_dirs is empty. |
108 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', | 109 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', |
109 '<!@(find <(java_in_dir)/<(resource_dir) -name "*")', | |
110 '>@(input_jars_paths)', | 110 '>@(input_jars_paths)', |
111 '>@(native_libs_paths)', | 111 '>@(native_libs_paths)', |
112 '>@(additional_input_paths)', | 112 '>@(additional_input_paths)', |
113 ], | 113 ], |
| 114 'conditions': [ |
| 115 ['resource_dir!=""', { |
| 116 'inputs': ['<!@(find <(java_in_dir)/<(resource_dir) -name "*")'] |
| 117 }], |
| 118 ], |
114 'outputs': [ | 119 'outputs': [ |
115 # TODO(cjhopman): Apks are built with a -debug suffix even when they are | 120 # TODO(cjhopman): Apks are built with a -debug suffix even when they are |
116 # built in release. This should be fixed. | 121 # built in release. This should be fixed. |
117 '<(PRODUCT_DIR)/apks/<(apk_name)-debug.apk', | 122 '<(PRODUCT_DIR)/apks/<(apk_name)-debug.apk', |
118 ], | 123 ], |
119 'action': [ | 124 'action': [ |
120 'ant', | 125 'ant', |
121 '-DAPP_ABI=<(android_app_abi)', | 126 '-DAPP_ABI=<(android_app_abi)', |
122 '-DANDROID_GDBSERVER=<(android_gdbserver)', | 127 '-DANDROID_GDBSERVER=<(android_gdbserver)', |
123 '-DANDROID_SDK=<(android_sdk)', | 128 '-DANDROID_SDK=<(android_sdk)', |
(...skipping 21 matching lines...) Expand all Loading... |
145 '-buildfile', | 150 '-buildfile', |
146 '<(DEPTH)/build/android/ant/chromium-apk.xml', | 151 '<(DEPTH)/build/android/ant/chromium-apk.xml', |
147 | 152 |
148 # Specify CONFIGURATION_NAME as the target for ant to build. The | 153 # Specify CONFIGURATION_NAME as the target for ant to build. The |
149 # buildfile will then build the appropriate SDK tools target. | 154 # buildfile will then build the appropriate SDK tools target. |
150 '<(CONFIGURATION_NAME)', | 155 '<(CONFIGURATION_NAME)', |
151 ] | 156 ] |
152 }, | 157 }, |
153 ], | 158 ], |
154 } | 159 } |
OLD | NEW |