Commit a4b37d6a authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

Android: Minor no-op tweaks to action_with_pydeps

* Add example in docs
* Don't store previous sources value (there is none)

Change-Id: I5b876905d4117a7f9d1966a70ce7134aef3110b8
Reviewed-on: https://chromium-review.googlesource.com/c/1455340
Commit-Queue: David Turner <digit@chromium.org>
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarDavid Turner <digit@chromium.org>
Cr-Commit-Position: refs/heads/master@{#629580}
parent 38a9d29f
...@@ -72,6 +72,11 @@ template("python_library") { ...@@ -72,6 +72,11 @@ template("python_library") {
# #
# build/print_python_deps.py --inplace build/android/gyp/foo.py # build/print_python_deps.py --inplace build/android/gyp/foo.py
# #
# Example
# action_with_pydeps("create_foo") {
# script = "myscript.py"
# args = [...]
# }
template("action_with_pydeps") { template("action_with_pydeps") {
# Read the .pydeps file now. Note that this is done everytime this # Read the .pydeps file now. Note that this is done everytime this
# template is called, but benchmarking doesn't show any impact on overall # template is called, but benchmarking doesn't show any impact on overall
...@@ -80,16 +85,10 @@ template("action_with_pydeps") { ...@@ -80,16 +85,10 @@ template("action_with_pydeps") {
_pydeps_raw = read_file(_pydeps_file, "list lines") _pydeps_raw = read_file(_pydeps_file, "list lines")
# Filter out comments. # Filter out comments.
# This is a bit convoluted to preserve the value of sources if defined.
_old_sources = []
if (defined(sources)) {
_old_sources = sources
}
set_sources_assignment_filter([ "#*" ]) set_sources_assignment_filter([ "#*" ])
sources = _pydeps_raw sources = _pydeps_raw
_pydeps = sources _pydeps = sources
set_sources_assignment_filter([]) sources = []
sources = _old_sources
action(target_name) { action(target_name) {
# Forward all variables. Ensure that testonly and visibility are forwarded # Forward all variables. Ensure that testonly and visibility are forwarded
...@@ -115,7 +114,7 @@ template("action_with_pydeps") { ...@@ -115,7 +114,7 @@ template("action_with_pydeps") {
# Dependencies are listed relative to the script directory, but inputs # Dependencies are listed relative to the script directory, but inputs
# expects paths that are relative to the current BUILD.gn # expects paths that are relative to the current BUILD.gn
_script_dir = get_path_info(script, "dir") _script_dir = get_path_info(_pydeps_file, "dir")
inputs += rebase_path(_pydeps, ".", _script_dir) inputs += rebase_path(_pydeps, ".", _script_dir)
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment