OLD | NEW |
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("//base/android/linker/config.gni") | 5 import("//base/android/linker/config.gni") |
6 import("//build/config/android/config.gni") | 6 import("//build/config/android/config.gni") |
7 import("//build/config/android/internal_rules.gni") | 7 import("//build/config/android/internal_rules.gni") |
8 import("//build/config/sanitizers/sanitizers.gni") | 8 import("//build/config/sanitizers/sanitizers.gni") |
9 import("//build/toolchain/toolchain.gni") | 9 import("//build/toolchain/toolchain.gni") |
10 import("//third_party/android_platform/config.gni") | 10 import("//third_party/android_platform/config.gni") |
(...skipping 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2236 # binary: Path to (stripped) executable. | 2236 # binary: Path to (stripped) executable. |
2237 # include_main_binary: Whether |binary| should be copied to |dist_dir|. | 2237 # include_main_binary: Whether |binary| should be copied to |dist_dir|. |
2238 # | 2238 # |
2239 # Example | 2239 # Example |
2240 # create_native_executable_dist("foo_dist") { | 2240 # create_native_executable_dist("foo_dist") { |
2241 # dist_dir = "$root_build_dir/foo_dist" | 2241 # dist_dir = "$root_build_dir/foo_dist" |
2242 # binary = "$root_build_dir/foo" | 2242 # binary = "$root_build_dir/foo" |
2243 # deps = [ ":the_thing_that_makes_foo" ] | 2243 # deps = [ ":the_thing_that_makes_foo" ] |
2244 # } | 2244 # } |
2245 template("create_native_executable_dist") { | 2245 template("create_native_executable_dist") { |
| 2246 set_sources_assignment_filter([]) |
2246 forward_variables_from(invoker, [ "testonly" ]) | 2247 forward_variables_from(invoker, [ "testonly" ]) |
2247 | 2248 |
2248 _libraries_list = "${target_gen_dir}/${target_name}_library_dependencies.list" | 2249 dist_dir = invoker.dist_dir |
| 2250 binary = invoker.binary |
| 2251 template_name = target_name |
2249 | 2252 |
2250 _find_deps_target_name = "${target_name}__find_library_dependencies" | 2253 libraries_list = |
| 2254 "${target_gen_dir}/${template_name}_library_dependencies.list" |
2251 | 2255 |
2252 # TODO(agrieve): Extract dependent libs from GN rather than readelf. | 2256 find_deps_target_name = "${template_name}__find_library_dependencies" |
2253 action(_find_deps_target_name) { | 2257 copy_target_name = "${template_name}__copy_libraries_and_exe" |
| 2258 |
| 2259 action(find_deps_target_name) { |
2254 forward_variables_from(invoker, [ "deps" ]) | 2260 forward_variables_from(invoker, [ "deps" ]) |
| 2261 visibility = [ ":$copy_target_name" ] |
2255 | 2262 |
2256 script = "//build/android/gyp/write_ordered_libraries.py" | 2263 script = "//build/android/gyp/write_ordered_libraries.py" |
2257 depfile = "$target_gen_dir/$target_name.d" | 2264 depfile = "$target_gen_dir/$target_name.d" |
2258 inputs = [ | 2265 inputs = [ |
2259 invoker.binary, | 2266 binary, |
2260 android_readelf, | 2267 android_readelf, |
2261 ] | 2268 ] |
2262 outputs = [ | 2269 outputs = [ |
2263 depfile, | 2270 depfile, |
2264 _libraries_list, | 2271 libraries_list, |
2265 ] | 2272 ] |
2266 rebased_binaries = rebase_path([ invoker.binary ], root_build_dir) | 2273 rebased_binaries = rebase_path([ binary ], root_build_dir) |
2267 args = [ | 2274 args = [ |
2268 "--depfile", | 2275 "--depfile", |
2269 rebase_path(depfile, root_build_dir), | 2276 rebase_path(depfile, root_build_dir), |
2270 "--input-libraries=$rebased_binaries", | 2277 "--input-libraries=$rebased_binaries", |
2271 "--libraries-dir", | 2278 "--libraries-dir", |
2272 rebase_path(root_shlib_dir, root_build_dir), | 2279 rebase_path(root_shlib_dir, root_build_dir), |
2273 "--output", | 2280 "--output", |
2274 rebase_path(_libraries_list, root_build_dir), | 2281 rebase_path(libraries_list, root_build_dir), |
2275 "--readelf", | 2282 "--readelf", |
2276 rebase_path(android_readelf, root_build_dir), | 2283 rebase_path(android_readelf, root_build_dir), |
2277 ] | 2284 ] |
2278 } | 2285 } |
2279 | 2286 |
2280 copy_ex(target_name) { | 2287 copy_ex(copy_target_name) { |
| 2288 visibility = [ ":$template_name" ] |
| 2289 |
2281 clear_dir = true | 2290 clear_dir = true |
2282 | 2291 |
2283 inputs = [ | 2292 inputs = [ |
2284 _libraries_list, | 2293 libraries_list, |
2285 ] | 2294 ] |
2286 if (defined(invoker.include_main_binary) && invoker.include_main_binary) { | 2295 if (defined(invoker.include_main_binary) && invoker.include_main_binary) { |
2287 inputs += [ invoker.binary ] | 2296 inputs += [ binary ] |
2288 } | 2297 } |
2289 | 2298 |
2290 dest = invoker.dist_dir | 2299 dest = dist_dir |
2291 | 2300 |
2292 rebased_libraries_list = rebase_path(_libraries_list, root_build_dir) | 2301 rebased_libraries_list = rebase_path(libraries_list, root_build_dir) |
2293 args = [ "--files=@FileArg($rebased_libraries_list:lib_paths)" ] | 2302 args = [ "--files=@FileArg($rebased_libraries_list:lib_paths)" ] |
2294 if (defined(invoker.include_main_binary) && invoker.include_main_binary) { | 2303 if (defined(invoker.include_main_binary) && invoker.include_main_binary) { |
2295 rebased_binaries_list = rebase_path([ invoker.binary ], root_build_dir) | 2304 rebased_binaries_list = rebase_path([ binary ], root_build_dir) |
2296 args += [ "--files=$rebased_binaries_list" ] | 2305 args += [ "--files=$rebased_binaries_list" ] |
2297 } | 2306 } |
2298 | 2307 |
2299 deps = [ | 2308 deps = [ |
2300 ":$_find_deps_target_name", | 2309 ":$find_deps_target_name", |
2301 ] | 2310 ] |
2302 if (defined(invoker.deps)) { | 2311 if (defined(invoker.deps)) { |
2303 deps += invoker.deps | 2312 deps += invoker.deps |
2304 } | 2313 } |
2305 } | 2314 } |
| 2315 |
| 2316 group(template_name) { |
| 2317 forward_variables_from(invoker, [ "visibility" ]) |
| 2318 public_deps = [ |
| 2319 ":$copy_target_name", |
| 2320 ] |
| 2321 } |
2306 } | 2322 } |
2307 | 2323 |
2308 # Compile a protocol buffer to java. | 2324 # Compile a protocol buffer to java. |
2309 # | 2325 # |
2310 # This generates java files from protocol buffers and creates an Android library | 2326 # This generates java files from protocol buffers and creates an Android library |
2311 # containing the classes. | 2327 # containing the classes. |
2312 # | 2328 # |
2313 # Variables | 2329 # Variables |
2314 # sources: Paths to .proto files to compile. | 2330 # sources: Paths to .proto files to compile. |
2315 # proto_path: Root directory of .proto files. | 2331 # proto_path: Root directory of .proto files. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2401 "--target", | 2417 "--target", |
2402 rebase_path(invoker.target, root_build_dir), | 2418 rebase_path(invoker.target, root_build_dir), |
2403 "--output-directory", | 2419 "--output-directory", |
2404 rebase_path(root_out_dir, root_build_dir), | 2420 rebase_path(root_out_dir, root_build_dir), |
2405 ] | 2421 ] |
2406 if (defined(invoker.flag_name)) { | 2422 if (defined(invoker.flag_name)) { |
2407 args += [ "--flag-name=${invoker.flag_name}" ] | 2423 args += [ "--flag-name=${invoker.flag_name}" ] |
2408 } | 2424 } |
2409 } | 2425 } |
2410 } | 2426 } |
OLD | NEW |