Commit Graph

8 Commits

Author SHA1 Message Date
Wyatt Hepler
c8e05a4be9 pw_build: Rename pw_python_script to pw_python_action
- Rename pw_python_script to pw_python_action, which more clearly
  describes the intent of the template (wrapper around action) and
  avoids confusion with the new pw_python_package template.
- Make pw_python_script as an alias for pw_python_action.
- Update the documentation and comments, and do some minor cleanup.
- Create python_script.gni file for backwards compatibility.

Change-Id: I98ab99021c57b1357c18ec23b50c59272c61c7b9
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22001
Reviewed-by: Alexei Frolov <frolv@google.com>
2020-10-20 23:15:05 +00:00
Wyatt Hepler
51ded74bb5 pw_build: Rename python_script.gni to python_action.gni
Rename the python_script.gni file to python_action.gni to prepare to
rename the pw_python_script template.

An alias .gni file is created in separate change so that Git tracks this
as a file move rather than an update.

Change-Id: I812cf3bd73909593c5369c7437da16529e1a375a
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22000
Reviewed-by: Alexei Frolov <frolv@google.com>
2020-10-20 23:15:05 +00:00
Wyatt Hepler
8224a64762 pw_build: Update path and target resolution
- Don't implicitly convert paths and labels in python_runner.py.
- To enable finding target outputs, support explicit resolution with
  the <TARGET_FILE($target)> expression.
- Use the standard GN rebase_path approach to resolve GN paths to
  filesystem paths for scripts. Remove workarounds that are no longer
  necessary.
- Update build files to use rebase_path and <TARGET_FILE(target)>.
- Add tests for python_runner.py.

Bug: 110
Change-Id: Iae262820bb265c648c270c2b78d058f20e1d3d1f
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/14801
Reviewed-by: Alexei Frolov <frolv@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
2020-07-29 21:40:28 +00:00
Wyatt Hepler
27f69f0624 pw_build: Restructure as Python package
Change-Id: I2c0d2412f4ae6cd350591ad563931f9493bde6bd
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/14720
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
2020-07-27 21:10:44 +00:00
Alexei Frolov
32d8b4dfbc
Hide output of pw_exec programs by default
This change updates the pw_exec GN template and wrapper script to hide
the output of the program unless it exits unsuccessfully.

Sample output:

20200103 13:40:06 ERR
20200103 13:40:06 ERR Command failed with exit code 2 in GN build.
20200103 13:40:06 ERR
20200103 13:40:06 ERR Build target:
20200103 13:40:06 ERR
20200103 13:40:06 ERR   pw_target_runner_client_pw_go_get
20200103 13:40:06 ERR
20200103 13:40:06 ERR Full command:
20200103 13:40:06 ERR
20200103 13:40:06 ERR   go got github.com/golang/protobuf/proto google.golang.org/grpc
20200103 13:40:06 ERR
20200103 13:40:06 ERR Process output:

go got: unknown command
Run 'go help' for usage.

20200103 13:40:06 ERR

Bug: 34
Change-Id: I7e7b2a6d359ecf1eeff6918d56defb909141cbfd
2020-01-03 14:15:39 -08:00
Alexei Frolov
c15a98852f
Download external Go dependencies in build
This change updates the Go GN integration to download external
dependencies for Go packages before running "go build". These
dependencies are listed in the pw_go_package template using build
metadata and collected to a "go get" invocation.

To support this, the pw_exec template is expanded to allow setting
positional arguments from a file.

Change-Id: If4f6c71f037b35bb041984da9982a1629d1d36b0
2019-12-26 10:39:48 -08:00
Alexei Frolov
d74ae4820c
Support environment variables in pw_exec template
This change adds support for defining environment variables in processes
run through pw_exec. Environment variables can either be specified
directly in the GN template or through a file (which could be generated
from build metadata).

Change-Id: Ic941b3f907143a648707a44de01da8332021270e
2019-12-19 16:40:34 -08:00
Alexei Frolov
293b09bbdf pw_exec GN template
This change adds a GN template which executes a non-Python program to
avoid having to write custom Python wrappers every time.

Change-Id: I36aa607dc99072d26ea7242f6ce110f2b43f71db
2019-12-17 22:07:59 +00:00