pw_log: enable require_link_deps Enables require_link_deps for the pw_log facade. Migrates the upstream log backends to use the .impl targets. Deprecates the pw_log_tokenized:log_backend target as pw_log_tokenized can now be directly used thanks to pw_build_LINK_DEPS. Change-Id: I1a0ba11f4974f070ba7863a8007503f6cc628c7a Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/45000 Reviewed-by: Wyatt Hepler <hepler@google.com> Commit-Queue: Ewout van Bekkum <ewout@google.com>
diff --git a/pw_log/BUILD.gn b/pw_log/BUILD.gn index d94926b..52082bc 100644 --- a/pw_log/BUILD.gn +++ b/pw_log/BUILD.gn
@@ -35,8 +35,7 @@ "public/pw_log/shorter.h", ] - # TODO(pwbug/372): Update projects to properly list pw_log:impl. - # require_link_deps = [ ":impl" ] + require_link_deps = [ ":impl" ] } # pw_log is low-level and ubiquitous. Because of this, it can often cause
diff --git a/pw_log_basic/BUILD.gn b/pw_log_basic/BUILD.gn index a82331f..a478ea2 100644 --- a/pw_log_basic/BUILD.gn +++ b/pw_log_basic/BUILD.gn
@@ -45,8 +45,14 @@ "public_overrides/pw_log_backend/log_backend.h", ] public_deps = [ dir_pw_preprocessor ] +} +# The log backend deps that might cause circular dependencies, since +# pw_log is so ubiquitous. These deps are kept separate so they can be +# depended on from elsewhere. +pw_source_set("pw_log_basic.impl") { deps = [ + ":pw_log_basic", "$dir_pw_log:facade", dir_pw_string, dir_pw_sys_io, @@ -66,13 +72,6 @@ ] } -# TODO(ewout): Fill this out once all users are using link deps. -# The log backend deps that might cause circular dependencies, since -# pw_log is so ubiquitous. These deps are kept separate so they can be -# depended on from elsewhere. -pw_source_set("pw_log_basic.impl") { -} - pw_doc_group("docs") { sources = [ "docs.rst" ] }
diff --git a/pw_log_tokenized/BUILD.gn b/pw_log_tokenized/BUILD.gn index 0d3831b..a89054d 100644 --- a/pw_log_tokenized/BUILD.gn +++ b/pw_log_tokenized/BUILD.gn
@@ -28,7 +28,7 @@ pw_log_tokenized_CONFIG = pw_build_DEFAULT_MODULE_CONFIG } -config("public_includes") { +config("public_include_path") { include_dirs = [ "public" ] visibility = [ ":*" ] } @@ -41,8 +41,8 @@ # This target provides the backend for pw_log. pw_source_set("pw_log_tokenized") { public_configs = [ - ":public_includes", ":backend_config", + ":public_include_path", ] public_deps = [ "$dir_pw_log:facade", @@ -53,35 +53,24 @@ public = [ "public/pw_log_tokenized/config.h", "public/pw_log_tokenized/log_tokenized.h", + "public_overrides/pw_log_backend/log_backend.h", ] } -# TODO(ewout): remove this once all users are migrated off this target, using -# link deps for the log impl instead. -pw_source_set("log_backend") { - public_configs = [ ":backend_config" ] - public_deps = [ ":pw_log_tokenized" ] - public = [ "public_overrides/pw_log_backend/log_backend.h" ] - deps = [ "$dir_pw_tokenizer:global_handler_with_payload" ] -} - -# TODO(ewout): remove this once all users are migrated off this target, using -# pw_log_tokenized and its pw_log_tokenized.impl instead. -pw_source_set("log_backend.impl") { -} - -# TODO(ewout): Fill this out once all users are using link deps. # The log backend deps that might cause circular dependencies, since # pw_log is so ubiquitous. These deps are kept separate so they can be # depended on from elsewhere. pw_source_set("pw_log_tokenized.impl") { - public_deps = [ ":log_backend" ] + deps = [ + ":pw_log_tokenized", + "$dir_pw_tokenizer:global_handler_with_payload", + ] } # This target provides a backend for pw_tokenizer that encodes tokenized logs as # Base64, encodes them into HDLC frames, and writes them over sys_io. pw_source_set("base64_over_hdlc") { - public_configs = [ ":public_includes" ] + public_configs = [ ":public_include_path" ] public = [ "public/pw_log_tokenized/base64_over_hdlc.h" ] sources = [ "base64_over_hdlc.cc" ] deps = [