From c6247d2d63d9becda4d92b705b140ed50a6d008b Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Tue, 19 Mar 2019 13:15:36 +0800 Subject: [PATCH] Using pch for the internal macros, to avoid each implementation files import this macro --- Configs/App-Shared.xcconfig | 5 ++++- Configs/Module-Shared.xcconfig | 3 +++ SDWebImage.podspec | 1 + SDWebImage/Private/SDImageAssetManager.m | 1 - SDWebImage/Private/metamacros.h | 2 +- SDWebImage/SDAnimatedImageView.m | 1 - SDWebImage/SDImageCachesManager.m | 1 - SDWebImage/SDImageCodersManager.m | 1 - SDWebImage/SDImageLoadersManager.m | 1 - SDWebImage/SDMemoryCache.m | 1 - SDWebImage/SDWebImageDownloader.m | 1 - SDWebImage/SDWebImageDownloaderOperation.m | 1 - SDWebImage/SDWebImageManager.m | 1 - SDWebImage/UIView+WebCache.m | 1 - WebImage/SDWebImage.pch | 10 ++++++++++ 15 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 WebImage/SDWebImage.pch diff --git a/Configs/App-Shared.xcconfig b/Configs/App-Shared.xcconfig index 351625b0..57760e6c 100644 --- a/Configs/App-Shared.xcconfig +++ b/Configs/App-Shared.xcconfig @@ -7,4 +7,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon // The compiler to use for C, C++, and Objective-C. -GCC_VERSION = \ No newline at end of file +GCC_VERSION = + +// Implicitly include the named header. The path given should either be a project relative path or an absolute path. +GCC_PREFIX_HEADER = diff --git a/Configs/Module-Shared.xcconfig b/Configs/Module-Shared.xcconfig index 9bacfd5d..f2ba5f80 100644 --- a/Configs/Module-Shared.xcconfig +++ b/Configs/Module-Shared.xcconfig @@ -228,3 +228,6 @@ VERSIONING_SYSTEM = apple-generic // Code will load on this and later versions of watchOS. 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. WATCHOS_DEPLOYMENT_TARGET = 2.0 + +// Implicitly include the named header. The path given should either be a project relative path or an absolute path. +GCC_PREFIX_HEADER = WebImage/SDWebImage.pch diff --git a/SDWebImage.podspec b/SDWebImage.podspec index 8f282506..8b376bba 100644 --- a/SDWebImage.podspec +++ b/SDWebImage.podspec @@ -31,6 +31,7 @@ Pod::Spec.new do |s| core.source_files = 'SDWebImage/*.{h,m}', 'WebImage/SDWebImage.h', 'SDWebImage/Private/*.{h,m}' core.exclude_files = 'SDWebImage/MapKit/*.{h,m}' core.private_header_files = 'SDWebImage/Private/*.h' + core.prefix_header_contents = '#import "SDInternalMacros.h"' end s.subspec 'MapKit' do |mk| diff --git a/SDWebImage/Private/SDImageAssetManager.m b/SDWebImage/Private/SDImageAssetManager.m index fa92e74f..1dc5503c 100644 --- a/SDWebImage/Private/SDImageAssetManager.m +++ b/SDWebImage/Private/SDImageAssetManager.m @@ -7,7 +7,6 @@ */ #import "SDImageAssetManager.h" -#import "SDInternalMacros.h" static NSArray *SDBundlePreferredScales() { static NSArray *scales; diff --git a/SDWebImage/Private/metamacros.h b/SDWebImage/Private/metamacros.h index 579756c6..dd90d99b 100644 --- a/SDWebImage/Private/metamacros.h +++ b/SDWebImage/Private/metamacros.h @@ -664,4 +664,4 @@ metamacro_if_eq(0, 1)(true)(false) #define metamacro_drop19(...) metamacro_drop18(metamacro_tail(__VA_ARGS__)) #define metamacro_drop20(...) metamacro_drop19(metamacro_tail(__VA_ARGS__)) -#endif \ No newline at end of file +#endif diff --git a/SDWebImage/SDAnimatedImageView.m b/SDWebImage/SDAnimatedImageView.m index bf4dac83..42c731d2 100644 --- a/SDWebImage/SDAnimatedImageView.m +++ b/SDWebImage/SDAnimatedImageView.m @@ -13,7 +13,6 @@ #import "UIImage+Metadata.h" #import "NSImage+Compatibility.h" #import "SDWeakProxy.h" -#import "SDInternalMacros.h" #import #import diff --git a/SDWebImage/SDImageCachesManager.m b/SDWebImage/SDImageCachesManager.m index 4c890423..fd31cd9f 100644 --- a/SDWebImage/SDImageCachesManager.m +++ b/SDWebImage/SDImageCachesManager.m @@ -8,7 +8,6 @@ #import "SDImageCachesManager.h" #import "SDImageCachesManagerOperation.h" -#import "SDInternalMacros.h" @implementation SDImageCachesManager diff --git a/SDWebImage/SDImageCodersManager.m b/SDWebImage/SDImageCodersManager.m index 8ad7e7b5..77522cd4 100644 --- a/SDWebImage/SDImageCodersManager.m +++ b/SDWebImage/SDImageCodersManager.m @@ -10,7 +10,6 @@ #import "SDImageIOCoder.h" #import "SDImageGIFCoder.h" #import "SDImageAPNGCoder.h" -#import "SDInternalMacros.h" @interface SDImageCodersManager () diff --git a/SDWebImage/SDImageLoadersManager.m b/SDWebImage/SDImageLoadersManager.m index 406a3628..84461fce 100644 --- a/SDWebImage/SDImageLoadersManager.m +++ b/SDWebImage/SDImageLoadersManager.m @@ -8,7 +8,6 @@ #import "SDImageLoadersManager.h" #import "SDWebImageDownloader.h" -#import "SDInternalMacros.h" @interface SDImageLoadersManager () diff --git a/SDWebImage/SDMemoryCache.m b/SDWebImage/SDMemoryCache.m index c331fce3..8a03f117 100644 --- a/SDWebImage/SDMemoryCache.m +++ b/SDWebImage/SDMemoryCache.m @@ -9,7 +9,6 @@ #import "SDMemoryCache.h" #import "SDImageCacheConfig.h" #import "UIImage+MemoryCacheCost.h" -#import "SDInternalMacros.h" static void * SDMemoryCacheContext = &SDMemoryCacheContext; diff --git a/SDWebImage/SDWebImageDownloader.m b/SDWebImage/SDWebImageDownloader.m index b7c16861..358b0d28 100644 --- a/SDWebImage/SDWebImageDownloader.m +++ b/SDWebImage/SDWebImageDownloader.m @@ -10,7 +10,6 @@ #import "SDWebImageDownloaderConfig.h" #import "SDWebImageDownloaderOperation.h" #import "SDWebImageError.h" -#import "SDInternalMacros.h" static void * SDWebImageDownloaderContext = &SDWebImageDownloaderContext; diff --git a/SDWebImage/SDWebImageDownloaderOperation.m b/SDWebImage/SDWebImageDownloaderOperation.m index 923919f7..39aad9cd 100644 --- a/SDWebImage/SDWebImageDownloaderOperation.m +++ b/SDWebImage/SDWebImageDownloaderOperation.m @@ -8,7 +8,6 @@ #import "SDWebImageDownloaderOperation.h" #import "SDWebImageError.h" -#import "SDInternalMacros.h" // iOS 8 Foundation.framework extern these symbol but the define is in CFNetwork.framework. We just fix this without import CFNetwork.framework #if (__IPHONE_OS_VERSION_MIN_REQUIRED && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0) diff --git a/SDWebImage/SDWebImageManager.m b/SDWebImage/SDWebImageManager.m index e5428dd4..35baa08c 100644 --- a/SDWebImage/SDWebImageManager.m +++ b/SDWebImage/SDWebImageManager.m @@ -11,7 +11,6 @@ #import "SDWebImageDownloader.h" #import "UIImage+Metadata.h" #import "SDWebImageError.h" -#import "SDInternalMacros.h" static id _defaultImageCache; static id _defaultImageLoader; diff --git a/SDWebImage/UIView+WebCache.m b/SDWebImage/UIView+WebCache.m index 38b9ac55..289c90e3 100644 --- a/SDWebImage/UIView+WebCache.m +++ b/SDWebImage/UIView+WebCache.m @@ -10,7 +10,6 @@ #import "objc/runtime.h" #import "UIView+WebCacheOperation.h" #import "SDWebImageError.h" -#import "SDInternalMacros.h" const int64_t SDWebImageProgressUnitCountUnknown = 1LL; diff --git a/WebImage/SDWebImage.pch b/WebImage/SDWebImage.pch new file mode 100644 index 00000000..62e1726a --- /dev/null +++ b/WebImage/SDWebImage.pch @@ -0,0 +1,10 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * (c) Florent Vilmart + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDInternalMacros.h"