Index: build/config/android/rules.gni |
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni |
index 9a24f4ac72029687a93b08d6c04eb6fa9b272888..b974baf1b73465cc55f157006927eaa754423565 100644 |
--- a/build/config/android/rules.gni |
+++ b/build/config/android/rules.gni |
@@ -2243,27 +2243,34 @@ |
# deps = [ ":the_thing_that_makes_foo" ] |
# } |
template("create_native_executable_dist") { |
+ set_sources_assignment_filter([]) |
forward_variables_from(invoker, [ "testonly" ]) |
- _libraries_list = "${target_gen_dir}/${target_name}_library_dependencies.list" |
- |
- _find_deps_target_name = "${target_name}__find_library_dependencies" |
- |
- # TODO(agrieve): Extract dependent libs from GN rather than readelf. |
- action(_find_deps_target_name) { |
+ dist_dir = invoker.dist_dir |
+ binary = invoker.binary |
+ template_name = target_name |
+ |
+ libraries_list = |
+ "${target_gen_dir}/${template_name}_library_dependencies.list" |
+ |
+ find_deps_target_name = "${template_name}__find_library_dependencies" |
+ copy_target_name = "${template_name}__copy_libraries_and_exe" |
+ |
+ action(find_deps_target_name) { |
forward_variables_from(invoker, [ "deps" ]) |
+ visibility = [ ":$copy_target_name" ] |
script = "//build/android/gyp/write_ordered_libraries.py" |
depfile = "$target_gen_dir/$target_name.d" |
inputs = [ |
- invoker.binary, |
+ binary, |
android_readelf, |
] |
outputs = [ |
depfile, |
- _libraries_list, |
- ] |
- rebased_binaries = rebase_path([ invoker.binary ], root_build_dir) |
+ libraries_list, |
+ ] |
+ rebased_binaries = rebase_path([ binary ], root_build_dir) |
args = [ |
"--depfile", |
rebase_path(depfile, root_build_dir), |
@@ -2271,37 +2278,46 @@ |
"--libraries-dir", |
rebase_path(root_shlib_dir, root_build_dir), |
"--output", |
- rebase_path(_libraries_list, root_build_dir), |
+ rebase_path(libraries_list, root_build_dir), |
"--readelf", |
rebase_path(android_readelf, root_build_dir), |
] |
} |
- copy_ex(target_name) { |
+ copy_ex(copy_target_name) { |
+ visibility = [ ":$template_name" ] |
+ |
clear_dir = true |
inputs = [ |
- _libraries_list, |
+ libraries_list, |
] |
if (defined(invoker.include_main_binary) && invoker.include_main_binary) { |
- inputs += [ invoker.binary ] |
- } |
- |
- dest = invoker.dist_dir |
- |
- rebased_libraries_list = rebase_path(_libraries_list, root_build_dir) |
+ inputs += [ binary ] |
+ } |
+ |
+ dest = dist_dir |
+ |
+ rebased_libraries_list = rebase_path(libraries_list, root_build_dir) |
args = [ "--files=@FileArg($rebased_libraries_list:lib_paths)" ] |
if (defined(invoker.include_main_binary) && invoker.include_main_binary) { |
- rebased_binaries_list = rebase_path([ invoker.binary ], root_build_dir) |
+ rebased_binaries_list = rebase_path([ binary ], root_build_dir) |
args += [ "--files=$rebased_binaries_list" ] |
} |
deps = [ |
- ":$_find_deps_target_name", |
+ ":$find_deps_target_name", |
] |
if (defined(invoker.deps)) { |
deps += invoker.deps |
} |
+ } |
+ |
+ group(template_name) { |
+ forward_variables_from(invoker, [ "visibility" ]) |
+ public_deps = [ |
+ ":$copy_target_name", |
+ ] |
} |
} |