Переглянути джерело

Merge pull request #1224 from CocoaLumberjack/bugfix/correctly_deprecate_tag_field

Re-introduce _tag field and deprecate it
Florian Friedrich 5 роки тому
батько
коміт
e518eb6e36

+ 8 - 1
CHANGELOG.md

@@ -1,4 +1,4 @@
-## [3.7.2 - Xcode 12.? on ??, 2021](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.7.2)
+## [3.7.3 - Xcode 12.? on ??, 2021](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.7.3)
 
 ### Public
 
@@ -9,6 +9,13 @@
 - _REPLACE ME_
 
 
+## [3.7.2 - Xcode 12.4 on Apr 9th, 2021](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.7.2)
+
+### Public
+
+- Re-introduce (and deprecate) `_tag` field to fix breakage in 3.7.1 (#1224)
+
+
 ## [3.7.1 - Xcode 12.4 on Apr 7th, 2021](https://github.com/CocoaLumberjack/CocoaLumberjack/releases/tag/3.7.1)
 
 ### Public

+ 1 - 1
CocoaLumberjack.podspec

@@ -1,7 +1,7 @@
 Pod::Spec.new do |s|
 
   s.name     = 'CocoaLumberjack'
-  s.version  = '3.7.1'
+  s.version  = '3.7.2'
   s.license  = 'BSD'
   s.summary  = 'A fast & simple, yet powerful & flexible logging framework for macOS, iOS, tvOS and watchOS.'
   s.homepage = 'https://github.com/CocoaLumberjack/CocoaLumberjack'

+ 1 - 1
Configs/Module-Shared.xcconfig

@@ -200,7 +200,7 @@ LIBRARY_SEARCH_PATHS = $(inherited)
 // Code will load on this and later versions of macOS. Framework APIs that are unavailable in earlier versions will be weak-linked; your code should check for null function pointers or specific system versions before calling newer APIs.
 MACOSX_DEPLOYMENT_TARGET = 10.10
 
-MARKETING_VERSION = 3.7.1
+MARKETING_VERSION = 3.7.2
 
 OTHER_C_FLAGS = -Wextra
 

+ 13 - 1
Sources/CocoaLumberjack/DDLog.m

@@ -999,6 +999,12 @@ NSString * __nullable DDExtractFileNameWithoutExtension(const char *filePath, BO
 
         _line         = line;
         _representedObject = tag;
+#if DD_LEGACY_MESSAGE_TAG
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+        _tag = tag;
+#pragma clang diagnostic pop
+#endif
         _options      = options;
         _timestamp    = timestamp ?: [NSDate new];
 
@@ -1079,6 +1085,12 @@ NSString * __nullable DDExtractFileNameWithoutExtension(const char *filePath, BO
     newMessage->_function = _function;
     newMessage->_line = _line;
     newMessage->_representedObject = _representedObject;
+#if DD_LEGACY_MESSAGE_TAG
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+    newMessage->_tag = _tag;
+#pragma clang diagnostic pop
+#endif
     newMessage->_options = _options;
     newMessage->_timestamp = _timestamp;
     newMessage->_threadID = _threadID;
@@ -1089,7 +1101,7 @@ NSString * __nullable DDExtractFileNameWithoutExtension(const char *filePath, BO
     return newMessage;
 }
 
-// ensure compatibility even when build with DD_LEGACY_MESSAGE_TAG to 0.
+// ensure compatibility even when built with DD_LEGACY_MESSAGE_TAG to 0.
 - (id)tag {
     return _representedObject;
 }

+ 3 - 0
Sources/CocoaLumberjack/include/CocoaLumberjack/DDLog.h

@@ -782,6 +782,9 @@ typedef NS_OPTIONS(NSInteger, DDLogMessageOptions){
     NSString *_fileName;
     NSString *_function;
     NSUInteger _line;
+    #if DD_LEGACY_MESSAGE_TAG
+    id _tag __attribute__((deprecated("Use _representedObject instead", "_representedObject")));;
+    #endif
     id _representedObject;
     DDLogMessageOptions _options;
     NSDate * _timestamp;