From 99a70a2d785c0353c3e0eddb463cf75941b6ffd7 Mon Sep 17 00:00:00 2001 From: Mirko Bonadei Date: Tue, 9 Oct 2018 16:45:14 +0200 Subject: [PATCH] Remove rtc_base_approved_objc and introduce rtc_base:logging_mac. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL removes the need of having rtc_base:rtc_base_approved_generic and rtc_base:rtc_base_approved_objc since it removes the _objc build target by moving the declaration of rtc::DescriptionFromOSStatus into rtc_base/logging_mac.h in order to have a new target rtc_base:logging_mac on which rtc_base:logging can depend on. The target rtc_base:rtc_base_approved_generic will be removed in a follow up CL. Bug: webrtc:9838 Change-Id: Id93ac7bced213128e7d654694ff15337c26dab62 Reviewed-on: https://webrtc-review.googlesource.com/c/104802 Reviewed-by: Kári Helgason Reviewed-by: Karl Wiberg Commit-Queue: Mirko Bonadei Cr-Commit-Position: refs/heads/master@{#25085} --- rtc_base/BUILD.gn | 22 ++++++++-------------- rtc_base/logging.h | 13 ++++--------- rtc_base/logging_mac.h | 28 ++++++++++++++++++++++++++++ rtc_base/logging_mac.mm | 4 ++-- 4 files changed, 42 insertions(+), 25 deletions(-) create mode 100644 rtc_base/logging_mac.h diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn index 140d2ffc2c..22a35078ed 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -85,9 +85,6 @@ rtc_source_set("rtc_base_approved") { ":thread_checker", ":timeutils", ] - if (is_mac && !build_with_chromium) { - public_deps += [ ":rtc_base_approved_objc" ] - } } rtc_source_set("macromagic") { @@ -220,6 +217,10 @@ rtc_source_set("logging") { ] deps += [ "system:inline" ] + if (is_mac) { + deps += [ ":logging_mac" ] + } + # logging.h needs the deprecation header while downstream projects are # removing code that depends on logging implementation details. deps += [ ":deprecation" ] @@ -488,20 +489,13 @@ rtc_source_set("rtc_base_approved_generic") { } if (is_mac && !build_with_chromium) { - config("rtc_base_approved_objc_all_dependent_config") { - visibility = [ ":rtc_base_approved_objc" ] - libs = [ "Foundation.framework" ] # needed for logging_mac.mm - } - - rtc_source_set("rtc_base_approved_objc") { - visibility = [ ":rtc_base_approved" ] - all_dependent_configs = [ ":rtc_base_approved_objc_all_dependent_config" ] + rtc_source_set("logging_mac") { + visibility = [ ":logging" ] + libs = [ "Foundation.framework" ] sources = [ + "logging_mac.h", "logging_mac.mm", ] - deps = [ - ":logging", - ] } } diff --git a/rtc_base/logging.h b/rtc_base/logging.h index 5c47c7f7cb..42929715e2 100644 --- a/rtc_base/logging.h +++ b/rtc_base/logging.h @@ -51,16 +51,16 @@ #include #include -#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) -#include -#endif - #include "absl/strings/string_view.h" #include "rtc_base/constructormagic.h" #include "rtc_base/deprecation.h" #include "rtc_base/strings/string_builder.h" #include "rtc_base/system/inline.h" +#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) +#include "rtc_base/logging_mac.h" +#endif // WEBRTC_MAC + #if !defined(NDEBUG) || defined(DLOG_ALWAYS_ON) #define RTC_DLOG_IS_ON 1 #else @@ -69,11 +69,6 @@ namespace rtc { -#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) -// Returns a UTF8 description from an OS X Status error. -std::string DescriptionFromOSStatus(OSStatus err); -#endif - ////////////////////////////////////////////////////////////////////// // Note that the non-standard LoggingSeverity aliases exist because they are diff --git a/rtc_base/logging_mac.h b/rtc_base/logging_mac.h new file mode 100644 index 0000000000..e65db560c1 --- /dev/null +++ b/rtc_base/logging_mac.h @@ -0,0 +1,28 @@ +/* + * Copyright 2018 The WebRTC Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ +#ifndef RTC_BASE_LOGGING_MAC_H_ +#define RTC_BASE_LOGGING_MAC_H_ + +#if !defined(WEBRTC_MAC) || defined(WEBRTC_IOS) +#error "Only include this header in macOS builds" +#endif + +#include + +#include + +namespace rtc { + +// Returns a UTF8 description from an OS X Status error. +std::string DescriptionFromOSStatus(OSStatus err); + +} // namespace rtc + +#endif // RTC_BASE_LOGGING_MAC_H_ diff --git a/rtc_base/logging_mac.mm b/rtc_base/logging_mac.mm index 378cfbfcb9..bd5f2b9d38 100644 --- a/rtc_base/logging_mac.mm +++ b/rtc_base/logging_mac.mm @@ -8,15 +8,15 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "rtc_base/logging.h" +#include "rtc_base/logging_mac.h" #import - namespace rtc { std::string DescriptionFromOSStatus(OSStatus err) { NSError* error = [NSError errorWithDomain:NSOSStatusErrorDomain code:err userInfo:nil]; return error.description.UTF8String; } + } // namespace rtc