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

Side by Side Diff: build/java_apk.gypi

Issue 11308030: Use _target_name instead of package_name for java*.gypi (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@apk_jar
Patch Set: Created 8 years, 1 month 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
OLDNEW
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',
11 # 'type': 'none', 11 # 'type': 'none',
12 # 'variables': { 12 # 'variables': {
13 # 'package_name': 'my_package',
14 # 'apk_name': 'MyPackage', 13 # 'apk_name': 'MyPackage',
15 # 'java_in_dir': 'path/to/package/root', 14 # 'java_in_dir': 'path/to/package/root',
16 # 'resource_dir': 'res', 15 # 'resource_dir': 'res',
17 # }, 16 # },
18 # 'includes': ['path/to/this/gypi/file'], 17 # 'includes': ['path/to/this/gypi/file'],
19 # } 18 # }
20 # 19 #
21 # Note that this assumes that there's an ant buildfile <package_name>_apk.xml in
22 # java_in_dir. So, if you have package_name="content_shell" and
23 # java_in_dir="content/shell/android/java" you should have a directory structure
24 # like:
25 #
26 # content/shell/android/java/content_shell_apk.xml
27 # content/shell/android/java/src/chromium/base/Foo.java
28 # content/shell/android/java/src/chromium/base/Bar.java
29 #
30 # Required variables: 20 # Required variables:
31 # package_name - Used to name the intermediate output directory and in the
32 # names of some output files.
33 # apk_name - The final apk will be named <apk_name>.apk 21 # apk_name - The final apk will be named <apk_name>.apk
34 # java_in_dir - The top-level java directory. The src should be in 22 # java_in_dir - The top-level java directory. The src should be in
35 # <java_in_dir>/src. 23 # <java_in_dir>/src.
36 # Optional/automatic variables: 24 # Optional/automatic variables:
37 # additional_input_paths - These paths will be included in the 'inputs' list to 25 # additional_input_paths - These paths will be included in the 'inputs' list to
38 # ensure that this target is rebuilt when one of these paths changes. 26 # ensure that this target is rebuilt when one of these paths changes.
39 # additional_src_dirs - Additional directories with .java files to be compiled 27 # additional_src_dirs - Additional directories with .java files to be compiled
40 # and included in the output of this target. 28 # and included in the output of this target.
41 # asset_location - The directory where assets are located (default: 29 # asset_location - The directory where assets are located (default:
42 # <PRODUCT_DIR>/<package_name>/assets). 30 # <PRODUCT_DIR>/<(_target_name)/assets).
43 # generated_src_dirs - Same as additional_src_dirs except used for .java files 31 # generated_src_dirs - Same as additional_src_dirs except used for .java files
44 # that are generated at build time. This should be set automatically by a 32 # that are generated at build time. This should be set automatically by a
45 # target's dependencies. The .java files in these directories are not 33 # target's dependencies. The .java files in these directories are not
46 # included in the 'inputs' list (unlike additional_src_dirs). 34 # included in the 'inputs' list (unlike additional_src_dirs).
47 # input_jars_paths - The path to jars to be included in the classpath. This 35 # input_jars_paths - The path to jars to be included in the classpath. This
48 # should be filled automatically by depending on the appropriate targets. 36 # should be filled automatically by depending on the appropriate targets.
49 # native_libs_paths - The path to any native library to be included in this 37 # native_libs_paths - The path to any native library to be included in this
50 # target. This should be a path in <(SHARED_LIB_DIR). A stripped copy of 38 # target. This should be a path in <(SHARED_LIB_DIR). A stripped copy of
51 # the library will be included in the apk and symbolic links to the 39 # the library will be included in the apk and symbolic links to the
52 # unstripped copy will be added to <(android_product_out) to enable native 40 # unstripped copy will be added to <(android_product_out) to enable native
53 # debugging. 41 # debugging.
54 # resource_dir - The directory for resources. 42 # resource_dir - The directory for resources.
55 43
56 { 44 {
57 'variables': { 45 'variables': {
58 'asset_location%': '', 46 'asset_location%': '',
59 'additional_input_paths': [], 47 'additional_input_paths': [],
60 'input_jars_paths': [], 48 'input_jars_paths': [],
61 'additional_src_dirs': [], 49 'additional_src_dirs': [],
62 'generated_src_dirs': [], 50 'generated_src_dirs': [],
63 'app_manifest_version_name%': '<(android_app_version_name)', 51 'app_manifest_version_name%': '<(android_app_version_name)',
64 'app_manifest_version_code%': '<(android_app_version_code)', 52 'app_manifest_version_code%': '<(android_app_version_code)',
65 'proguard_enabled%': 'false', 53 'proguard_enabled%': 'false',
66 'proguard_flags%': '', 54 'proguard_flags%': '',
67 'native_libs_paths': [], 55 'native_libs_paths': [],
68 'manifest_package_name%': 'unknown.package.name', 56 'manifest_package_name%': 'unknown.package.name',
69 'resource_dir%':'', 57 'resource_dir%':'',
70 'jar_name%': 'chromium_apk_<(package_name).jar', 58 'jar_name%': 'chromium_apk_<(_target_name).jar',
71 }, 59 },
72 'sources': [ 60 'sources': [
73 '<@(native_libs_paths)' 61 '<@(native_libs_paths)'
74 ], 62 ],
75 # Pass the jar path to the apk's "fake" jar target. This would be better as 63 # Pass the jar path to the apk's "fake" jar target. This would be better as
76 # direct_dependent_settings, but a variable set by a direct_dependent_settings 64 # direct_dependent_settings, but a variable set by a direct_dependent_settings
77 # cannot be lifted in a dependent to all_dependent_settings. 65 # cannot be lifted in a dependent to all_dependent_settings.
78 'all_dependent_settings': { 66 'all_dependent_settings': {
79 'variables': { 67 'variables': {
80 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', 68 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)',
81 }, 69 },
82 }, 70 },
83 'rules': [ 71 'rules': [
84 { 72 {
85 'rule_name': 'copy_and_strip_native_libraries', 73 'rule_name': 'copy_and_strip_native_libraries',
86 'extension': 'so', 74 'extension': 'so',
87 'variables': { 75 'variables': {
88 'stripped_library_path': '<(PRODUCT_DIR)/<(package_name)/libs/<(android_ app_abi)/<(RULE_INPUT_ROOT).so', 76 'stripped_library_path': '<(PRODUCT_DIR)/<(_target_name)/libs/<(android_ app_abi)/<(RULE_INPUT_ROOT).so',
89 'link_dir': '<(android_product_out)/symbols/data/data/<(manifest_package _name)/lib/', 77 'link_dir': '<(android_product_out)/symbols/data/data/<(manifest_package _name)/lib/',
90 }, 78 },
91 'outputs': [ 79 'outputs': [
92 '<(stripped_library_path)', 80 '<(stripped_library_path)',
93 '<(link_dir)/<(RULE_INPUT_ROOT).so', 81 '<(link_dir)/<(RULE_INPUT_ROOT).so',
94 ], 82 ],
95 # There is no way to do 2 actions for each source library in gyp. So to 83 # There is no way to do 2 actions for each source library in gyp. So to
96 # both strip the library and create the link in <(link_dir) a separate 84 # both strip the library and create the link in <(link_dir) a separate
97 # script is required. 85 # script is required.
98 'action': [ 86 'action': [
99 '<(DEPTH)/build/android/prepare_library_for_apk', 87 '<(DEPTH)/build/android/prepare_library_for_apk',
100 '<(android_strip)', 88 '<(android_strip)',
101 '<(RULE_INPUT_PATH)', 89 '<(RULE_INPUT_PATH)',
102 '<(stripped_library_path)', 90 '<(stripped_library_path)',
103 '<(link_dir)', 91 '<(link_dir)',
104 ], 92 ],
105 }, 93 },
106 ], 94 ],
107 'actions': [ 95 'actions': [
108 { 96 {
109 'action_name': 'ant_<(package_name)_apk', 97 'action_name': 'ant_<(_target_name)',
110 'message': 'Building <(package_name) apk.', 98 'message': 'Building <(_target_name).',
111 'inputs': [ 99 'inputs': [
112 '<(java_in_dir)/AndroidManifest.xml', 100 '<(java_in_dir)/AndroidManifest.xml',
113 '<(DEPTH)/build/android/ant/chromium-apk.xml', 101 '<(DEPTH)/build/android/ant/chromium-apk.xml',
114 '<(DEPTH)/build/android/ant/common.xml', 102 '<(DEPTH)/build/android/ant/common.xml',
115 '<(DEPTH)/build/android/ant/sdk-targets.xml', 103 '<(DEPTH)/build/android/ant/sdk-targets.xml',
116 # If there is a separate find for additional_src_dirs, it will find the 104 # If there is a separate find for additional_src_dirs, it will find the
117 # wrong .java files when additional_src_dirs is empty. 105 # wrong .java files when additional_src_dirs is empty.
118 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', 106 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")',
119 '>@(input_jars_paths)', 107 '>@(input_jars_paths)',
120 '>@(native_libs_paths)', 108 '>@(native_libs_paths)',
(...skipping 19 matching lines...) Expand all
140 '-DCHROMIUM_SRC=<(ant_build_out)/../..', 128 '-DCHROMIUM_SRC=<(ant_build_out)/../..',
141 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', 129 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)',
142 '-DPRODUCT_DIR=<(ant_build_out)', 130 '-DPRODUCT_DIR=<(ant_build_out)',
143 131
144 '-DAPK_NAME=<(apk_name)', 132 '-DAPK_NAME=<(apk_name)',
145 '-DASSET_DIR=<(asset_location)', 133 '-DASSET_DIR=<(asset_location)',
146 '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)', 134 '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)',
147 '-DGENERATED_SRC_DIRS=>(generated_src_dirs)', 135 '-DGENERATED_SRC_DIRS=>(generated_src_dirs)',
148 '-DINPUT_JARS_PATHS=>(input_jars_paths)', 136 '-DINPUT_JARS_PATHS=>(input_jars_paths)',
149 '-DJAR_NAME=<(jar_name)', 137 '-DJAR_NAME=<(jar_name)',
150 '-DPACKAGE_NAME=<(package_name)', 138 '-DOUT_DIR=<(PRODUCT_DIR)/<(_target_name)',
151 '-DRESOURCE_DIR=<(resource_dir)', 139 '-DRESOURCE_DIR=<(resource_dir)',
152 '-DAPP_MANIFEST_VERSION_NAME=<(app_manifest_version_name)', 140 '-DAPP_MANIFEST_VERSION_NAME=<(app_manifest_version_name)',
153 '-DAPP_MANIFEST_VERSION_CODE=<(app_manifest_version_code)', 141 '-DAPP_MANIFEST_VERSION_CODE=<(app_manifest_version_code)',
154 '-DPROGUARD_FLAGS=>(proguard_flags)', 142 '-DPROGUARD_FLAGS=>(proguard_flags)',
155 '-DPROGUARD_ENABLED=>(proguard_enabled)', 143 '-DPROGUARD_ENABLED=>(proguard_enabled)',
156 144
157 '-Dbasedir=<(java_in_dir)', 145 '-Dbasedir=<(java_in_dir)',
158 '-buildfile', 146 '-buildfile',
159 '<(DEPTH)/build/android/ant/chromium-apk.xml', 147 '<(DEPTH)/build/android/ant/chromium-apk.xml',
160 148
161 # Specify CONFIGURATION_NAME as the target for ant to build. The 149 # Specify CONFIGURATION_NAME as the target for ant to build. The
162 # buildfile will then build the appropriate SDK tools target. 150 # buildfile will then build the appropriate SDK tools target.
163 '<(CONFIGURATION_NAME)', 151 '<(CONFIGURATION_NAME)',
164 ] 152 ]
165 }, 153 },
166 ], 154 ],
167 } 155 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698