Index: build/config/android/rules.gni |
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni |
index 14896fcdafc251a01d29007383eaba9398e1b221..ed631725016b2f6a132c2c202b1a2fade18a61e2 100644 |
--- a/build/config/android/rules.gni |
+++ b/build/config/android/rules.gni |
@@ -2234,7 +2234,7 @@ template("android_aidl") { |
# dist_dir: Directory for the exe and libraries. Everything in this directory |
# will be deleted before copying in the exe and libraries. |
# binary: Path to (stripped) executable. |
-# include_main_binary: Whether |binary| should be copied to |dist_dir|. |
+# extra_files: List of extra files to copy in (optional). |
# |
# Example |
# create_native_executable_dist("foo_dist") { |
@@ -2243,34 +2243,27 @@ template("android_aidl") { |
# deps = [ ":the_thing_that_makes_foo" ] |
# } |
template("create_native_executable_dist") { |
- set_sources_assignment_filter([]) |
forward_variables_from(invoker, [ "testonly" ]) |
- dist_dir = invoker.dist_dir |
- binary = invoker.binary |
- template_name = target_name |
- |
- libraries_list = |
- "${target_gen_dir}/${template_name}_library_dependencies.list" |
+ _libraries_list = "${target_gen_dir}/${target_name}_library_dependencies.list" |
- find_deps_target_name = "${template_name}__find_library_dependencies" |
- copy_target_name = "${template_name}__copy_libraries_and_exe" |
+ _find_deps_target_name = "${target_name}__find_library_dependencies" |
- action(find_deps_target_name) { |
+ # TODO(agrieve): Extract dependent libs from GN rather than readelf. |
+ 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 = [ |
- binary, |
+ invoker.binary, |
android_readelf, |
] |
outputs = [ |
depfile, |
- libraries_list, |
+ _libraries_list, |
] |
- rebased_binaries = rebase_path([ binary ], root_build_dir) |
+ rebased_binaries = rebase_path([ invoker.binary ], root_build_dir) |
args = [ |
"--depfile", |
rebase_path(depfile, root_build_dir), |
@@ -2278,47 +2271,40 @@ template("create_native_executable_dist") { |
"--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(copy_target_name) { |
- visibility = [ ":$template_name" ] |
- |
+ copy_ex(target_name) { |
clear_dir = true |
inputs = [ |
- libraries_list, |
+ _libraries_list, |
+ invoker.binary, |
] |
- if (defined(invoker.include_main_binary) && invoker.include_main_binary) { |
- inputs += [ binary ] |
- } |
- dest = dist_dir |
+ dest = invoker.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([ binary ], root_build_dir) |
- args += [ "--files=$rebased_binaries_list" ] |
+ _rebased_libraries_list = rebase_path(_libraries_list, root_build_dir) |
+ _rebased_binaries_list = rebase_path([ invoker.binary ], root_build_dir) |
+ args = [ |
+ "--files=@FileArg($_rebased_libraries_list:lib_paths)", |
+ "--files=$_rebased_binaries_list", |
+ ] |
+ if (defined(invoker.extra_files)) { |
+ _rebased_extra_files = rebase_path(invoker.extra_files, root_build_dir) |
+ args += [ "--files=$_rebased_extra_files" ] |
} |
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", |
- ] |
- } |
} |
# Compile a protocol buffer to java. |