Commit Graph

9 Commits

Author SHA1 Message Date
Michael Spang
da057f7f3c pw_build: Remove instancing of pools across toolchains
The build system uses pools for mutual exclusion. Currently multiple
instances of these pools exist which defeats their purpose.

For example, it can cause concurrent instances of "pip install" which is
not safe.

Bug: 390
No-Docs-Update-Reason: bug fix
Change-Id: I114d2428d747a6d5a68a024a0177343ee82cad76
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/48520
Commit-Queue: Michael Spang <spang@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
2021-06-10 05:57:15 +00:00
Michael Spang
c8b939009b Remove absolute paths from build command lines
The GN convention is to specify paths in command lines relative to the
build directory. Unfortunately and contrary to pigweed's expectations
this is not what rebase_path(path) does; that outputs an absolute path.

Absolute paths are not desirable in most circumstances as they contain
sources of nondeterminism such as the developer's home directory. Using
them can for example reduce hit rate in build caches.

Replace rebase_path(path) with rebase_path(path, root_build_dir) which
is the correct idiom and matches GN's builtin behavior (e.g. for
sources, include_dirs, etc).

This also removes the --directory argument to python_action(). Changing
the directory during the build while using relative paths is likely to
result in confusion and should be discouraged.

There's a couple more things to do on top of this for identical
binaries between build directories / machines / developers:

- pass options to avoid embedding the working directory
- pass options to use relative paths for the vendored clang & libc++

See [1]-[2] for how to do that.

[1] https://source.chromium.org/chromium/chromium/src/+/main:build/config/compiler/BUILD.gn;l=1170-1239;drc=ab531c265c533cba1c2f6d8240cc0bf7679f605a
[2] https://cs.opensource.google/fuchsia/fuchsia/+/main:build/config/BUILD.gn;l=145-216;drc=f6d705f0937c778d5d5f807a4580113612b02f5a

Change-Id: I17708102c03d6488d68c8571b6e9343191fd47de
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/47461
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Michael Spang <spang@google.com>
2021-06-09 19:15:51 +00:00
Alexei Frolov
6ea2df4087 pw_build: Disable CGo on MacOS
This tells the Go compiler to build without the C standard library on
MacOS due to issues with include paths in certain environments.

Change-Id: I33cba8abeb32350af58347afc7c768cc18a31a3d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/45443
Pigweed-Auto-Submit: Alexei Frolov <frolv@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Joe Ethier <jethier@google.com>
2021-05-14 22:30:19 +00:00
Rob Mohr
bf3a3aff81 pw_env_setup: Update go version to 1.16.3
Change-Id: I534aa2eed35c6ab64c2966e19fafca12623ac277
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/43581
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
Reviewed-by: Joe Ethier <jethier@google.com>
2021-05-04 21:18:14 +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
Rob Mohr
a0ba54f648 Roll GN to 239533d
This caused gn format to flag many things which were also fixed.

Change-Id: Ie1d9081a1b08047bec52c60f54d2a94366be1ba6
2020-02-28 01:33:18 +00:00
Alexei Frolov
ca9cf604dc Add pw_host_tool GN template
This change cerates a GN template called pw_host_tool which copies a
binary target to a common host_tools directory that can be added to a
user's PATH.

Change-Id: I9eb38ab4ff9d11a4a87e6be2547d5224370e3412
2019-12-26 21:58:46 +00: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
def1471ede Add Go support to GN
This change defines GN templates that allow building Go code as part of
Pigweed's build system. Go is also added as a supported language for the
proto_library template.

Change-Id: I3e639a12e6a8ba0a7a928c5d653c623cff58eb86
2019-12-26 18:37:34 +00:00