- Display full target names, including the toolchain, for build errors.
- Print the dependency path that caused the error using gn path.
- Add message_lines argument to simplify multi-line messages.
- Replace null_backend.py with pw_error.
- Ensure that pw_error works without the Pigweed Python packages
installed.
Example error if pw_log_BACKEND is unset:
9:28:27 ERR
9:28:27 ERR Build error for //pw_log:pw_log.NO_BACKEND_SET(//targets/host:host_clang_debug):
9:28:27 ERR
9:28:27 ERR Attempted to build the //pw_log:pw_log facade with no backend.
9:28:27 ERR
9:28:27 ERR If you are using this facade, ensure you have configured a backend
9:28:27 ERR properly. The build arg for the facade must be set to a valid
9:28:27 ERR backend in the toolchain. For example, you may need to add a line
9:28:27 ERR like the following to the toolchain's .gni file:
9:28:27 ERR
9:28:27 ERR pw_log_BACKEND = "//path/to/the:backend"
9:28:27 ERR
9:28:27 ERR If you are NOT using this facade, this error may have been triggered
9:28:27 ERR by trying to build all targets.
9:28:27 ERR
9:28:28 ERR Dependency path to this target:
9:28:28 ERR
9:28:28 ERR gn path out //:default "//pw_log:pw_log.NO_BACKEND_SET(//targets/host:host_clang_debug)"
//:default --[private]-->
//:host --[private]-->
//:pigweed_default(//targets/host:host_clang_debug) --[private]-->
//pw_trace:trace_example_basic(//targets/host:host_clang_debug) --[private]-->
//pw_log:pw_log(//targets/host:host_clang_debug) --[public]-->
//pw_log:pw_log.NO_BACKEND_SET(//targets/host:host_clang_debug)
Showing one of 75 "interesting" non-data paths. 0 of them are public.
Use --all to print all paths.
Fixed: 336
Change-Id: Ida252e1ae9956822ec0efbbfc82bad60f58de5e8
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/36240
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Throughout the GN build, a common pattern that occurs is:
if (condition) {
my_real_target(target_name) {
# ...
}
} else {
# Print an error indicating that the user must configure condition.
pw_python_action(target_name) {
script = "condition_not_met.py"
}
}
This typically requires writing a custom error-printing script for each
error message. While some error messages have custom logic, many only
need to print a simple string.
This change adds a pw_error GN template which prints out a specified
error message and the target in which it occurred.
Change-Id: Ia93787d9353bac190bf6e1e567e09f9a07d9703f
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22720
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Alexei Frolov <frolv@google.com>