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

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: s/inputs/sources, s/source_prereqs/inputs Created 6 years, 5 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
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 rebase_output = rebase_path(invoker.output, root_build_dir)
newt (away) 2014/07/18 21:19:18 s/rebase/rebased
cjhopman 2014/07/28 21:58:52 Done.
127
128 args = [
129 "--depfile", rebase_path(depfile, root_build_dir),
130 "--android-sdk-tools", rebased_android_sdk_build_tools,
131 "--dex-path", rebase_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 if (defined(invoker.jar_excluded_patterns)) { 274 if (defined(invoker.jar_excluded_patterns)) {
238 jar_excluded_patterns = invoker.jar_excluded_patterns 275 jar_excluded_patterns = invoker.jar_excluded_patterns
239 } 276 }
240 build_config = invoker.build_config 277 build_config = invoker.build_config
241 java_files = invoker.java_files 278 java_files = invoker.java_files
242 279
243 if (defined(invoker.srcjar_deps)) { 280 if (defined(invoker.srcjar_deps)) {
244 srcjar_deps = invoker.srcjar_deps 281 srcjar_deps = invoker.srcjar_deps
245 } 282 }
246 } 283 }
247 284
248 # TODO(cjhopman): lint 285 # TODO(cjhopman): lint
249 # TODO(cjhopman): dex 286
287
288 dex("${target_name}__dex") {
newt (away) 2014/07/18 21:19:18 I didn't realize we generated a dex file for each
cjhopman 2014/07/28 21:58:52 Dexing is slow. Doing it this way makes it so that
289 sources = [jar_path]
290 output = dex_path
291 }
250 292
251 group(target_name) { 293 group(target_name) {
252 deps = [ 294 deps = [
253 ":${target_name}__java_library" 295 ":${target_name}__java_library",
296 ":${target_name}__dex",
254 ] 297 ]
255 } 298 }
256 } 299 }
257 300
258 301
259 # Runs process_resources.py 302 # Runs process_resources.py
260 template("process_resources") { 303 template("process_resources") {
261 zip_path = invoker.zip_path 304 zip_path = invoker.zip_path
262 srcjar_path = invoker.srcjar_path 305 srcjar_path = invoker.srcjar_path
263 build_config = invoker.build_config 306 build_config = invoker.build_config
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 args += [ 369 args += [
327 "--all-resources-zip-out", rebase_path(all_resources_zip, root_build_dir ) 370 "--all-resources-zip-out", rebase_path(all_resources_zip, root_build_dir )
328 ] 371 ]
329 } 372 }
330 373
331 if (defined(invoker.args)) { 374 if (defined(invoker.args)) {
332 args += invoker.args 375 args += invoker.args
333 } 376 }
334 } 377 }
335 } 378 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698