Remove rtc_base_approved_objc and introduce rtc_base:logging_mac.
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 <kthelgason@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25085}
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index 140d2ff..22a3507 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -85,9 +85,6 @@
":thread_checker",
":timeutils",
]
- if (is_mac && !build_with_chromium) {
- public_deps += [ ":rtc_base_approved_objc" ]
- }
}
rtc_source_set("macromagic") {
@@ -220,6 +217,10 @@
]
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 @@
}
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 5c47c7f..4292971 100644
--- a/rtc_base/logging.h
+++ b/rtc_base/logging.h
@@ -51,16 +51,16 @@
#include <string>
#include <utility>
-#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
-#include <CoreServices/CoreServices.h>
-#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 0000000..e65db56
--- /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 <CoreServices/CoreServices.h>
+
+#include <string>
+
+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 378cfbf..bd5f2b9 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 <Foundation/Foundation.h>
-
namespace rtc {
std::string DescriptionFromOSStatus(OSStatus err) {
NSError* error =
[NSError errorWithDomain:NSOSStatusErrorDomain code:err userInfo:nil];
return error.description.UTF8String;
}
+
} // namespace rtc