mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 03:09:56 +00:00
Split framework dependencies into separate subspecs to reduce binary size and dynamic linking time when they're not needed (#1028)
This commit is contained in:
parent
0dc97fbb2f
commit
5cad23b925
@ -2609,6 +2609,9 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
"AS_USE_ASSETS_LIBRARY=1",
|
||||
"AS_USE_MAPKIT=1",
|
||||
"AS_USE_PHOTOS=1",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
- Fix misleading/scary stack trace shown when an assertion occurs during node measurement [Huy Nguyen](https://github.com/nguyenhuy) [#1022](https://github.com/TextureGroup/Texture/pull/1022)
|
||||
- Fix build on 32-bit simulator in Xcode 9.3 and later, caused by `Thread-local storage is not supported on this architecture.` [Adlai Holler](https://github.com/Adlai-Holler)
|
||||
- Enable locking assertions (and add some more) to improve and enforce locking safety within the framework [Huy Nguyen](https://github.com/nguyenhuy) [#1024](https://github.com/TextureGroup/Texture/pull/1024)
|
||||
- Split MapKit, Photos, and AssetsLibrary dependent code into separate subspecs to improve binary size and start time when they're not needed. The default subspec includes all three for backwards compatibility, but this **will change in 3.0**. When using non-Cocoapods build environments, define `AS_USE_PHOTOS, AS_USE_MAPKIT, AS_USE_ASSETS_LIBRARY` to 1 respectively to signal their use. [Adlai Holler](https://github.com/Adlai-Holler)
|
||||
|
||||
## 2.7
|
||||
- Fix pager node for interface coalescing. [Max Wang](https://github.com/wsdwsd0829) [#877](https://github.com/TextureGroup/Texture/pull/877)
|
||||
|
||||
@ -15,8 +15,11 @@
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AsyncDisplayKit/ASAvailability.h>
|
||||
|
||||
#if TARGET_OS_IOS && AS_USE_MAPKIT
|
||||
#import <AsyncDisplayKit/ASImageNode.h>
|
||||
#if TARGET_OS_IOS
|
||||
#import <MapKit/MapKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@ -15,11 +15,10 @@
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
#import <AsyncDisplayKit/ASMapNode.h>
|
||||
|
||||
#if TARGET_OS_IOS && AS_USE_MAPKIT
|
||||
|
||||
#import <tgmath.h>
|
||||
|
||||
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>
|
||||
@ -448,4 +447,4 @@
|
||||
}
|
||||
|
||||
@end
|
||||
#endif
|
||||
#endif // TARGET_OS_IOS && AS_USE_MAPKIT
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
#import <AsyncDisplayKit/ASMultiplexImageNode.h>
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
#if TARGET_OS_IOS && AS_USE_ASSETS_LIBRARY
|
||||
#import <AssetsLibrary/AssetsLibrary.h>
|
||||
#endif
|
||||
|
||||
@ -25,12 +25,15 @@
|
||||
#import <AsyncDisplayKit/ASDisplayNodeExtras.h>
|
||||
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>
|
||||
#import <AsyncDisplayKit/ASDisplayNode+FrameworkPrivate.h>
|
||||
#import <AsyncDisplayKit/ASPhotosFrameworkImageRequest.h>
|
||||
#import <AsyncDisplayKit/ASEqualityHelpers.h>
|
||||
#import <AsyncDisplayKit/ASInternalHelpers.h>
|
||||
#import <AsyncDisplayKit/ASLog.h>
|
||||
#import <AsyncDisplayKit/ASThread.h>
|
||||
|
||||
#if AS_USE_PHOTOS
|
||||
#import <AsyncDisplayKit/ASPhotosFrameworkImageRequest.h>
|
||||
#endif
|
||||
|
||||
#if AS_PIN_REMOTE_IMAGE
|
||||
#import <AsyncDisplayKit/ASPINRemoteImageDownloader.h>
|
||||
#else
|
||||
@ -39,7 +42,9 @@
|
||||
|
||||
NSString *const ASMultiplexImageNodeErrorDomain = @"ASMultiplexImageNodeErrorDomain";
|
||||
|
||||
#if AS_USE_ASSETS_LIBRARY
|
||||
static NSString *const kAssetsLibraryURLScheme = @"assets-library";
|
||||
#endif
|
||||
|
||||
static const CGSize kMinReleaseImageOnBackgroundSize = {20.0, 20.0};
|
||||
|
||||
@ -133,7 +138,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
||||
*/
|
||||
- (void)_fetchImageWithIdentifierFromCache:(id)imageIdentifier URL:(NSURL *)imageURL completion:(void (^)(UIImage *image))completionBlock;
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
#if TARGET_OS_IOS && AS_USE_ASSETS_LIBRARY
|
||||
/**
|
||||
@abstract Loads the image corresponding to the given assetURL from the device's Assets Library.
|
||||
@param imageIdentifier The identifier for the image to be loaded. May not be nil.
|
||||
@ -143,6 +148,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
||||
- (void)_loadALAssetWithIdentifier:(id)imageIdentifier URL:(NSURL *)assetURL completion:(void (^)(UIImage *image, NSError *error))completionBlock;
|
||||
#endif
|
||||
|
||||
#if AS_USE_PHOTOS
|
||||
/**
|
||||
@abstract Loads the image corresponding to the given image request from the Photos framework.
|
||||
@param imageIdentifier The identifier for the image to be loaded. May not be nil.
|
||||
@ -150,6 +156,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
||||
@param completionBlock The block to be performed when the image has been loaded, if possible. May not be nil.
|
||||
*/
|
||||
- (void)_loadPHAssetWithRequest:(ASPhotosFrameworkImageRequest *)request identifier:(id)imageIdentifier completion:(void (^)(UIImage *image, NSError *error))completionBlock API_AVAILABLE(ios(8.0), tvos(10.0));
|
||||
#endif
|
||||
|
||||
/**
|
||||
@abstract Downloads the image corresponding to the given imageIdentifier from the given URL.
|
||||
@ -620,7 +627,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
||||
return;
|
||||
}
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
#if TARGET_OS_IOS && AS_USE_ASSETS_LIBRARY
|
||||
// If it's an assets-library URL, we need to fetch it from the assets library.
|
||||
if ([[nextImageURL scheme] isEqualToString:kAssetsLibraryURLScheme]) {
|
||||
// Load the asset.
|
||||
@ -633,6 +640,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
||||
}
|
||||
#endif
|
||||
|
||||
#if AS_USE_PHOTOS
|
||||
if (AS_AVAILABLE_IOS_TVOS(9, 10)) {
|
||||
// Likewise, if it's a Photos asset, we need to fetch it accordingly.
|
||||
if (ASPhotosFrameworkImageRequest *request = [ASPhotosFrameworkImageRequest requestWithURL:nextImageURL]) {
|
||||
@ -644,6 +652,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Otherwise, it's a web URL that we can download.
|
||||
// First, check the cache.
|
||||
@ -677,7 +686,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
||||
}];
|
||||
}];
|
||||
}
|
||||
#if TARGET_OS_IOS
|
||||
#if TARGET_OS_IOS && AS_USE_ASSETS_LIBRARY
|
||||
- (void)_loadALAssetWithIdentifier:(id)imageIdentifier URL:(NSURL *)assetURL completion:(void (^)(UIImage *image, NSError *error))completionBlock
|
||||
{
|
||||
ASDisplayNodeAssertNotNil(imageIdentifier, @"imageIdentifier is required");
|
||||
@ -702,6 +711,8 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
#endif
|
||||
|
||||
#if AS_USE_PHOTOS
|
||||
- (void)_loadPHAssetWithRequest:(ASPhotosFrameworkImageRequest *)request identifier:(id)imageIdentifier completion:(void (^)(UIImage *image, NSError *error))completionBlock
|
||||
{
|
||||
ASDisplayNodeAssertNotNil(imageIdentifier, @"imageIdentifier is required");
|
||||
@ -789,6 +800,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
||||
_phImageRequestOperation = newImageRequestOp;
|
||||
[phImageRequestQueue addOperation:newImageRequestOp];
|
||||
}
|
||||
#endif
|
||||
|
||||
- (void)_fetchImageWithIdentifierFromCache:(id)imageIdentifier URL:(NSURL *)imageURL completion:(void (^)(UIImage *image))completionBlock
|
||||
{
|
||||
@ -892,6 +904,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
||||
|
||||
@end
|
||||
|
||||
#if AS_USE_PHOTOS
|
||||
@implementation NSURL (ASPhotosFrameworkURLs)
|
||||
|
||||
+ (NSURL *)URLWithAssetLocalIdentifier:(NSString *)assetLocalIdentifier targetSize:(CGSize)targetSize contentMode:(PHImageContentMode)contentMode options:(PHImageRequestOptions *)options NS_RETURNS_RETAINED
|
||||
@ -904,3 +917,4 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
||||
}
|
||||
|
||||
@end
|
||||
#endif
|
||||
|
||||
@ -25,6 +25,18 @@
|
||||
#define AS_TLS_AVAILABLE 1
|
||||
#endif
|
||||
|
||||
#ifndef AS_USE_PHOTOS
|
||||
# define AS_USE_PHOTOS 0
|
||||
#endif
|
||||
|
||||
#ifndef AS_USE_MAPKIT
|
||||
# define AS_USE_MAPKIT 0
|
||||
#endif
|
||||
|
||||
#ifndef AS_USE_ASSETS_LIBRARY
|
||||
# define AS_USE_ASSETS_LIBRARY 0
|
||||
#endif
|
||||
|
||||
#ifndef kCFCoreFoundationVersionNumber_iOS_10_0
|
||||
#define kCFCoreFoundationVersionNumber_iOS_10_0 1348.00
|
||||
#endif
|
||||
|
||||
@ -15,6 +15,10 @@
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#import <AsyncDisplayKit/ASAvailability.h>
|
||||
|
||||
#if AS_USE_PHOTOS
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <Photos/Photos.h>
|
||||
#import <AsyncDisplayKit/ASBaseDefines.h>
|
||||
@ -73,3 +77,5 @@ API_AVAILABLE(ios(8.0), tvos(10.0))
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
#endif // AS_USE_PHOTOS
|
||||
|
||||
@ -16,6 +16,9 @@
|
||||
//
|
||||
|
||||
#import <AsyncDisplayKit/ASPhotosFrameworkImageRequest.h>
|
||||
|
||||
#if AS_USE_PHOTOS
|
||||
|
||||
#import <AsyncDisplayKit/ASBaseDefines.h>
|
||||
|
||||
NSString *const ASPhotosURLScheme = @"ph";
|
||||
@ -160,3 +163,5 @@ static NSString *const _ASPhotosURLQueryKeyCropHeight = @"crop_h";
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif // AS_USE_PHOTOS
|
||||
|
||||
@ -11,55 +11,71 @@ Pod::Spec.new do |spec|
|
||||
|
||||
spec.documentation_url = 'http://texturegroup.org/appledoc/'
|
||||
|
||||
spec.ios.weak_frameworks = 'AssetsLibrary'
|
||||
spec.weak_frameworks = 'Photos','MapKit'
|
||||
|
||||
spec.ios.deployment_target = '9.0'
|
||||
spec.tvos.deployment_target = '9.0'
|
||||
|
||||
# Subspecs
|
||||
spec.subspec 'Core' do |core|
|
||||
core.public_header_files = [
|
||||
'Source/*.h',
|
||||
'Source/Details/**/*.h',
|
||||
'Source/Layout/**/*.h',
|
||||
'Source/Base/*.h',
|
||||
'Source/Debug/**/*.h',
|
||||
'Source/TextKit/ASTextNodeTypes.h',
|
||||
'Source/TextKit/ASTextKitComponents.h'
|
||||
'Source/*.h',
|
||||
'Source/Details/**/*.h',
|
||||
'Source/Layout/**/*.h',
|
||||
'Source/Base/*.h',
|
||||
'Source/Debug/**/*.h',
|
||||
'Source/TextKit/ASTextNodeTypes.h',
|
||||
'Source/TextKit/ASTextKitComponents.h'
|
||||
]
|
||||
|
||||
core.source_files = [
|
||||
'Source/**/*.{h,m,mm}',
|
||||
'Base/*.{h,m}',
|
||||
'Source/**/*.{h,m,mm}',
|
||||
'Base/*.{h,m}',
|
||||
|
||||
# Most TextKit components are not public because the C++ content
|
||||
# in the headers will cause build errors when using
|
||||
# `use_frameworks!` on 0.39.0 & Swift 2.1.
|
||||
# See https://github.com/facebook/AsyncDisplayKit/issues/1153
|
||||
'Source/TextKit/*.h',
|
||||
# Most TextKit components are not public because the C++ content
|
||||
# in the headers will cause build errors when using
|
||||
# `use_frameworks!` on 0.39.0 & Swift 2.1.
|
||||
# See https://github.com/facebook/AsyncDisplayKit/issues/1153
|
||||
'Source/TextKit/*.h',
|
||||
]
|
||||
end
|
||||
|
||||
spec.subspec 'PINRemoteImage' do |pin|
|
||||
pin.dependency 'PINRemoteImage/iOS', '= 3.0.0-beta.13'
|
||||
pin.dependency 'PINRemoteImage/PINCache'
|
||||
pin.dependency 'Texture/Core'
|
||||
pin.dependency 'PINRemoteImage/iOS', '= 3.0.0-beta.13'
|
||||
pin.dependency 'PINRemoteImage/PINCache'
|
||||
pin.dependency 'Texture/Core'
|
||||
end
|
||||
|
||||
spec.subspec 'IGListKit' do |igl|
|
||||
igl.dependency 'IGListKit', '~> 3.0'
|
||||
igl.dependency 'Texture/Core'
|
||||
igl.dependency 'IGListKit', '~> 3.0'
|
||||
igl.dependency 'Texture/Core'
|
||||
end
|
||||
|
||||
spec.subspec 'Yoga' do |yoga|
|
||||
yoga.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) YOGA=1' }
|
||||
yoga.dependency 'Yoga', '1.6.0'
|
||||
yoga.dependency 'Texture/Core'
|
||||
yoga.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) YOGA=1' }
|
||||
yoga.dependency 'Yoga', '1.6.0'
|
||||
yoga.dependency 'Texture/Core'
|
||||
end
|
||||
|
||||
# Include optional PINRemoteImage module
|
||||
spec.default_subspec = 'PINRemoteImage'
|
||||
spec.subspec 'MapKit' do |map|
|
||||
map.frameworks = 'MapKit'
|
||||
map.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) AS_USE_MAPKIT=1' }
|
||||
map.dependency 'Texture/Core'
|
||||
end
|
||||
|
||||
spec.subspec 'Photos' do |photos|
|
||||
photos.frameworks = 'Photos'
|
||||
photos.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) AS_USE_PHOTOS=1' }
|
||||
photos.dependency 'Texture/Core'
|
||||
end
|
||||
|
||||
spec.subspec 'AssetsLibrary' do |assetslib|
|
||||
assetslib.frameworks = 'AssetsLibrary'
|
||||
assetslib.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) AS_USE_ASSETS_LIBRARY=1' }
|
||||
assetslib.dependency 'Texture/Core'
|
||||
end
|
||||
|
||||
# Include these by default for backwards compatibility.
|
||||
# This will change in 3.0.
|
||||
spec.default_subspecs = 'PINRemoteImage', 'MapKit', 'AssetsLibrary', 'Photos'
|
||||
|
||||
spec.social_media_url = 'https://twitter.com/TextureiOS'
|
||||
spec.library = 'c++'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user