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

Side by Side Diff: build/config/android/internal_rules.gni

Issue 386473002: Add dexing for libraries and apks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-apk-first
Patch Set: 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/write_build_config.py ('k') | build/config/android/rules.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 import("//build/config/android/config.gni") 5 import("//build/config/android/config.gni")
6 6
7 assert(is_android) 7 assert(is_android)
8 8
9 9
10 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) 10 rebased_android_sdk = rebase_path(android_sdk, root_build_dir)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 args = [ 55 args = [
56 "--type", type, 56 "--type", type,
57 "--depfile", rebase_path(depfile, root_build_dir), 57 "--depfile", rebase_path(depfile, root_build_dir),
58 "--possible-deps-configs=$rebase_possible_deps_configs", 58 "--possible-deps-configs=$rebase_possible_deps_configs",
59 "--build-config", rebase_path(build_config, root_build_dir), 59 "--build-config", rebase_path(build_config, root_build_dir),
60 ] 60 ]
61 61
62 if (type == "android_library" || type == "android_apk") { 62 if (type == "android_library" || type == "android_apk") {
63 args += [ 63 args += [
64 "--jar-path", rebase_path(invoker.jar_path, root_build_dir), 64 "--jar-path", rebase_path(invoker.jar_path, root_build_dir),
65 "--dex-path", rebase_path(invoker.dex_path, root_build_dir),
65 ] 66 ]
66 } 67 }
67 68
68 if (type == "android_resources" || type == "android_apk") { 69 if (type == "android_resources" || type == "android_apk") {
69 assert(defined(invoker.resources_zip)) 70 assert(defined(invoker.resources_zip))
70 args += [ 71 args += [
71 "--resources-zip", rebase_path(invoker.resources_zip, root_build_dir), 72 "--resources-zip", rebase_path(invoker.resources_zip, root_build_dir),
72 ] 73 ]
73 } 74 }
74 75
(...skipping 28 matching lines...) Expand all
103 "--output=$rebase_output", 104 "--output=$rebase_output",
104 ] 105 ]
105 if (defined(invoker.base_dir)) { 106 if (defined(invoker.base_dir)) {
106 args += [ 107 args += [
107 "--base-dir", rebase_path(invoker.base_dir, root_build_dir) 108 "--base-dir", rebase_path(invoker.base_dir, root_build_dir)
108 ] 109 ]
109 } 110 }
110 } 111 }
111 } 112 }
112 113
114 template("dex") {
115 assert(defined(invoker.sources))
116 assert(defined(invoker.output))
117 action(target_name) {
118 script = "//build/android/gyp/dex.py"
119 depfile = "$target_gen_dir/$target_name.d"
120 sources = invoker.sources
121 outputs = [depfile, invoker.output]
122 if (defined(invoker.inputs)) {
123 inputs = invoker.inputs
124 }
125
126 rebased_output = rebase_path(invoker.output, root_build_dir)
127
128 args = [
129 "--depfile", rebase_path(depfile, root_build_dir),
130 "--android-sdk-tools", rebased_android_sdk_build_tools,
131 "--dex-path", rebased_output,
132 ]
133
134 if (defined(invoker.no_locals) && invoker.no_locals) {
135 args += [
136 "--no-locals=1"
137 ]
138 }
139
140 if (defined(invoker.args)) {
141 args += invoker.args
142 }
143
144 args += rebase_path(invoker.sources, root_build_dir)
145 }
146 }
147
113 # Compiles and jars a set of java files. 148 # Compiles and jars a set of java files.
114 # 149 #
115 # Outputs: 150 # Outputs:
116 # $jar_path.jar 151 # $jar_path.jar
117 # $jar_path.jar.TOC 152 # $jar_path.jar.TOC
118 # 153 #
119 # Variables 154 # Variables
120 # java_files: List of .java files to compile. 155 # java_files: List of .java files to compile.
121 # java_deps: List of java dependencies. These should all have a .jar output 156 # java_deps: List of java dependencies. These should all have a .jar output
122 # at "${target_gen_dir}/${target_name}.jar. 157 # at "${target_gen_dir}/${target_name}.jar.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 258
224 259
225 # This adds Android-specific parts to the java_library template. 260 # This adds Android-specific parts to the java_library template.
226 # 261 #
227 # Runs Android lint against the compiled java files. 262 # Runs Android lint against the compiled java files.
228 # Dexes the output jar for inclusion in an APK. 263 # Dexes the output jar for inclusion in an APK.
229 template("android_java_library") { 264 template("android_java_library") {
230 assert(defined(invoker.java_files)) 265 assert(defined(invoker.java_files))
231 assert(defined(invoker.build_config)) 266 assert(defined(invoker.build_config))
232 assert(defined(invoker.jar_path)) 267 assert(defined(invoker.jar_path))
268 assert(defined(invoker.dex_path))
233 269
234 _jar_path = invoker.jar_path 270 _jar_path = invoker.jar_path
271 _dex_path = invoker.dex_path
235 272
236 java_library("${target_name}__java_library") { 273 java_library("${target_name}__java_library") {
237 jar_path = _jar_path 274 jar_path = _jar_path
238 if (defined(invoker.jar_excluded_patterns)) { 275 if (defined(invoker.jar_excluded_patterns)) {
239 jar_excluded_patterns = invoker.jar_excluded_patterns 276 jar_excluded_patterns = invoker.jar_excluded_patterns
240 } 277 }
241 build_config = invoker.build_config 278 build_config = invoker.build_config
242 java_files = invoker.java_files 279 java_files = invoker.java_files
243 280
244 if (defined(invoker.srcjar_deps)) { 281 if (defined(invoker.srcjar_deps)) {
245 srcjar_deps = invoker.srcjar_deps 282 srcjar_deps = invoker.srcjar_deps
246 } 283 }
247 } 284 }
248 285
249 # TODO(cjhopman): lint 286 # TODO(cjhopman): lint
250 # TODO(cjhopman): dex 287
288
289 dex("${target_name}__dex") {
290 sources = [_jar_path]
291 output = _dex_path
292 }
251 293
252 group(target_name) { 294 group(target_name) {
253 deps = [ 295 deps = [
254 ":${target_name}__java_library" 296 ":${target_name}__java_library",
297 ":${target_name}__dex",
255 ] 298 ]
256 } 299 }
257 } 300 }
258 301
259 302
260 # Runs process_resources.py 303 # Runs process_resources.py
261 template("process_resources") { 304 template("process_resources") {
262 zip_path = invoker.zip_path 305 zip_path = invoker.zip_path
263 srcjar_path = invoker.srcjar_path 306 srcjar_path = invoker.srcjar_path
264 build_config = invoker.build_config 307 build_config = invoker.build_config
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 args += [ 370 args += [
328 "--all-resources-zip-out", rebase_path(all_resources_zip, root_build_dir ) 371 "--all-resources-zip-out", rebase_path(all_resources_zip, root_build_dir )
329 ] 372 ]
330 } 373 }
331 374
332 if (defined(invoker.args)) { 375 if (defined(invoker.args)) {
333 args += invoker.args 376 args += invoker.args
334 } 377 }
335 } 378 }
336 } 379 }
OLDNEW
« no previous file with comments | « build/android/gyp/write_build_config.py ('k') | build/config/android/rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698