third_party.pigweed.src/pw_build/error.gni

53 lines
1.6 KiB
Plaintext
Raw Normal View History

# Copyright 2020 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
import("python_action.gni")
pw_build: Update pw_error template - 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>
2021-03-09 16:37:19 +00:00
# Prints an error message and exits the build unsuccessfully. Either 'message'
# or 'message_lines' must be specified, but not both.
#
# Args:
pw_build: Update pw_error template - 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>
2021-03-09 16:37:19 +00:00
# message: The message to print. Use \n for newlines.
# message_lines: List of lines to use for the message.
#
template("pw_error") {
pw_build: Update pw_error template - 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>
2021-03-09 16:37:19 +00:00
assert(
defined(invoker.message) != defined(invoker.message_lines),
"pw_error requires either a 'message' string or a 'message_lines' list")
pw_build: Update pw_error template - 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>
2021-03-09 16:37:19 +00:00
if (defined(invoker.message_lines)) {
_message = string_join("\n", invoker.message_lines)
} else {
_message = invoker.message
}
assert(_message != "", "The message cannot be empty")
action(target_name) {
script = "$dir_pw_build/py/pw_build/error.py"
args = [
"--target",
pw_build: Update pw_error template - 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>
2021-03-09 16:37:19 +00:00
get_label_info(":$target_name", "label_with_toolchain"),
"--message",
pw_build: Update pw_error template - 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>
2021-03-09 16:37:19 +00:00
_message,
"--root",
rebase_path("//"),
"--out",
rebase_path(root_build_dir),
]
pw_build: Update pw_error template - 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>
2021-03-09 16:37:19 +00:00
# This output file is never created.
outputs = [ "$target_gen_dir/$target_name.build_error" ]
}
}