From e7edf7bc9df07f7cf483b64d850de569b43270c2 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Mon, 12 Aug 2019 20:50:11 +0800 Subject: [PATCH 01/14] Update the xcconfig of UIKit for macOS config --- Configs/Module-Shared.xcconfig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Configs/Module-Shared.xcconfig b/Configs/Module-Shared.xcconfig index 2f31af0b..27844bed 100644 --- a/Configs/Module-Shared.xcconfig +++ b/Configs/Module-Shared.xcconfig @@ -223,3 +223,9 @@ 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 + +// macOS Catalyst support +SUPPORTS_MACCATALYST = YES + +// macOS Catalyst support +DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = NO From 1b7b377c60ba67dc72df457a1267bd33f31af03d Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Mon, 12 Aug 2019 20:51:01 +0800 Subject: [PATCH 02/14] Update the podspec for xcconfig --- SDWebImage.podspec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SDWebImage.podspec b/SDWebImage.podspec index 7eff2d58..94754f59 100644 --- a/SDWebImage.podspec +++ b/SDWebImage.podspec @@ -30,6 +30,10 @@ Pod::Spec.new do |s| core.source_files = 'SDWebImage/Core/*.{h,m}', 'WebImage/SDWebImage.h', 'SDWebImage/Private/*.{h,m}' core.exclude_files = 'SDWebImage/MapKit/*.{h,m}' core.private_header_files = 'SDWebImage/Private/*.h' + core.pod_target_xcconfig = { + 'SUPPORTS_MACCATALYST' => 'YES', + 'DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER' => 'NO' + } end s.subspec 'MapKit' do |mk| From 77e54697c5152818a11676871965571786a6beef Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Mon, 12 Aug 2019 20:52:46 +0800 Subject: [PATCH 03/14] Update the demo of UIKit for macOS, which should not contains the WatchKit Extension --- .../SDWebImage Demo.xcodeproj/project.pbxproj | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/Examples/SDWebImage Demo.xcodeproj/project.pbxproj b/Examples/SDWebImage Demo.xcodeproj/project.pbxproj index 65a6846d..4aa31d1e 100644 --- a/Examples/SDWebImage Demo.xcodeproj/project.pbxproj +++ b/Examples/SDWebImage Demo.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */ @@ -27,7 +27,7 @@ 43A62A061D0E07600089D7DD /* ExtensionDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 43A62A051D0E07600089D7DD /* ExtensionDelegate.m */; }; 43A62A091D0E07600089D7DD /* NotificationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 43A62A081D0E07600089D7DD /* NotificationController.m */; }; 43A62A0B1D0E07600089D7DD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 43A62A0A1D0E07600089D7DD /* Assets.xcassets */; }; - 43A62A0F1D0E07600089D7DD /* SDWebImage Watch Demo.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = 43A629EE1D0E07600089D7DD /* SDWebImage Watch Demo.app */; }; + 43A62A0F1D0E07600089D7DD /* SDWebImage Watch Demo.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = 43A629EE1D0E07600089D7DD /* SDWebImage Watch Demo.app */; platformFilter = ios; }; 531041C1157EAC8F00BBABC3 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 537612E6155ABA44005750A4 /* ImageIO.framework */; }; 5376129A155AB74D005750A4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53761299155AB74D005750A4 /* UIKit.framework */; }; 5376129C155AB74D005750A4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5376129B155AB74D005750A4 /* Foundation.framework */; }; @@ -842,6 +842,7 @@ }; 43A62A0E1D0E07600089D7DD /* PBXTargetDependency */ = { isa = PBXTargetDependency; + platformFilter = ios; target = 43A629ED1D0E07600089D7DD /* SDWebImage Watch Demo */; targetProxy = 43A62A0D1D0E07600089D7DD /* PBXContainerItemProxy */; }; @@ -925,7 +926,10 @@ buildSettings = { COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = "SDWebImage OSX Demo/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); SDKROOT = ""; SUPPORTED_PLATFORMS = macosx; TARGETED_DEVICE_FAMILY = ""; @@ -938,7 +942,10 @@ buildSettings = { COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = "SDWebImage OSX Demo/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); SDKROOT = ""; SUPPORTED_PLATFORMS = macosx; TARGETED_DEVICE_FAMILY = ""; @@ -951,7 +958,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = ""; INFOPLIST_FILE = "SDWebImage Watch Demo Extension/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = "com.dailymotion.SDWebImage-iOS-Demo.watchkitapp.watchkitextension"; SDKROOT = watchos; SUPPORTED_PLATFORMS = "watchsimulator watchos"; @@ -965,7 +976,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = ""; INFOPLIST_FILE = "SDWebImage Watch Demo Extension/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = "com.dailymotion.SDWebImage-iOS-Demo.watchkitapp.watchkitextension"; SDKROOT = watchos; SUPPORTED_PLATFORMS = "watchsimulator watchos"; From 054c5186b87ef44c51d5652766e9a99ea68846a0 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Mon, 12 Aug 2019 20:55:07 +0800 Subject: [PATCH 04/14] Use UIImage.class for conformsToSelector detect, which fix the current Xcode 11 Beta5 's runtime behavior of UIKit for macOS --- SDWebImage/Core/SDAnimatedImageView.m | 8 +++++--- SDWebImage/Core/SDImageCacheDefine.m | 2 +- SDWebImage/Core/SDImageLoader.m | 4 ++-- Tests/Tests/SDAnimatedImageTest.m | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/SDWebImage/Core/SDAnimatedImageView.m b/SDWebImage/Core/SDAnimatedImageView.m index 69ea61ef..9c4dddd0 100644 --- a/SDWebImage/Core/SDAnimatedImageView.m +++ b/SDWebImage/Core/SDAnimatedImageView.m @@ -203,7 +203,7 @@ static NSUInteger SDDeviceFreeMemory() { // We need call super method to keep function. This will impliedly call `setNeedsDisplay`. But we have no way to avoid this when using animated image. So we call `setNeedsDisplay` again at the end. super.image = image; - if ([image conformsToProtocol:@protocol(SDAnimatedImage)]) { + if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)]) { NSUInteger animatedImageFrameCount = ((UIImage *)image).animatedImageFrameCount; // Check the frame count if (animatedImageFrameCount <= 1) { @@ -536,9 +536,11 @@ static NSUInteger SDDeviceFreeMemory() { // Early return return; } - if ([image conformsToProtocol:@protocol(SDAnimatedImage)] && image.sd_isIncremental) { + // We must use `image.class conformsToProtocol:` instead of `image conformsToProtocol:` here + // Because UIKit on macOS, using internal hard-coded override method, which returns NO + if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)] && image.sd_isIncremental) { UIImage *previousImage = self.image; - if ([previousImage conformsToProtocol:@protocol(SDAnimatedImage)] && previousImage.sd_isIncremental) { + if ([previousImage.class conformsToProtocol:@protocol(SDAnimatedImage)] && previousImage.sd_isIncremental) { NSData *previousData = [((UIImage *)previousImage) animatedImageData]; NSData *currentData = [((UIImage *)image) animatedImageData]; // Check whether to use progressive rendering or not diff --git a/SDWebImage/Core/SDImageCacheDefine.m b/SDWebImage/Core/SDImageCacheDefine.m index 435c0edf..0efa1c4d 100644 --- a/SDWebImage/Core/SDImageCacheDefine.m +++ b/SDWebImage/Core/SDImageCacheDefine.m @@ -47,7 +47,7 @@ UIImage * _Nullable SDImageCacheDecodeImageData(NSData * _Nonnull imageData, NSS } if (image) { BOOL shouldDecode = (options & SDWebImageAvoidDecodeImage) == 0; - if ([image conformsToProtocol:@protocol(SDAnimatedImage)]) { + if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)]) { // `SDAnimatedImage` do not decode shouldDecode = NO; } else if (image.sd_isAnimated) { diff --git a/SDWebImage/Core/SDImageLoader.m b/SDWebImage/Core/SDImageLoader.m index 9cd5a1d9..ffe22354 100644 --- a/SDWebImage/Core/SDImageLoader.m +++ b/SDWebImage/Core/SDImageLoader.m @@ -61,7 +61,7 @@ UIImage * _Nullable SDImageLoaderDecodeImageData(NSData * _Nonnull imageData, NS } if (image) { BOOL shouldDecode = (options & SDWebImageAvoidDecodeImage) == 0; - if ([image conformsToProtocol:@protocol(SDAnimatedImage)]) { + if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)]) { // `SDAnimatedImage` do not decode shouldDecode = NO; } else if (image.sd_isAnimated) { @@ -143,7 +143,7 @@ UIImage * _Nullable SDImageLoaderDecodeProgressiveImageData(NSData * _Nonnull im } if (image) { BOOL shouldDecode = (options & SDWebImageAvoidDecodeImage) == 0; - if ([image conformsToProtocol:@protocol(SDAnimatedImage)]) { + if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)]) { // `SDAnimatedImage` do not decode shouldDecode = NO; } else if (image.sd_isAnimated) { diff --git a/Tests/Tests/SDAnimatedImageTest.m b/Tests/Tests/SDAnimatedImageTest.m index 94f8d240..580422f5 100644 --- a/Tests/Tests/SDAnimatedImageTest.m +++ b/Tests/Tests/SDAnimatedImageTest.m @@ -264,7 +264,7 @@ static const NSUInteger kTestGIFFrameCount = 5; // local TestImage.gif loop coun // Progressive image may be nil when download data is not enough if (image) { expect(image.sd_isIncremental).beTruthy(); - expect([image conformsToProtocol:@protocol(SDAnimatedImage)]).beTruthy(); + expect([image.class conformsToProtocol:@protocol(SDAnimatedImage)]).beTruthy(); BOOL isProgressive = imageView.isProgressive; expect(isProgressive).equal(YES); } From 3f248552b344dd0c684beb296ccb1dd4fae5c936 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Tue, 13 Aug 2019 13:22:10 +0800 Subject: [PATCH 05/14] Update the test case for catalyst --- Tests/Tests/SDAnimatedImageTest.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Tests/Tests/SDAnimatedImageTest.m b/Tests/Tests/SDAnimatedImageTest.m index 580422f5..573bd5b3 100644 --- a/Tests/Tests/SDAnimatedImageTest.m +++ b/Tests/Tests/SDAnimatedImageTest.m @@ -151,9 +151,13 @@ static const NSUInteger kTestGIFFrameCount = 5; // local TestImage.gif loop coun imageView.image = image; #if SD_MAC expect(imageView.wantsUpdateLayer).beTruthy(); +#else +#if TARGET_OS_MACCATALYST + // macOS's UIImageView seems does not setup layer.contents until render on screen #else expect(imageView.layer.contents).notTo.beNil(); #endif +#endif } - (void)test13AnimatedImageViewInitWithImage { From cb2baac522714f17684b4e774e96991da6f6db38 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Tue, 13 Aug 2019 13:23:13 +0800 Subject: [PATCH 06/14] Update Podspec for MapKit supports catalyst --- SDWebImage.podspec | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SDWebImage.podspec b/SDWebImage.podspec index 94754f59..a5b31561 100644 --- a/SDWebImage.podspec +++ b/SDWebImage.podspec @@ -26,14 +26,15 @@ Pod::Spec.new do |s| s.default_subspec = 'Core' + s.pod_target_xcconfig = { + 'SUPPORTS_MACCATALYST' => 'YES', + 'DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER' => 'NO' + } + s.subspec 'Core' do |core| core.source_files = 'SDWebImage/Core/*.{h,m}', 'WebImage/SDWebImage.h', 'SDWebImage/Private/*.{h,m}' core.exclude_files = 'SDWebImage/MapKit/*.{h,m}' core.private_header_files = 'SDWebImage/Private/*.h' - core.pod_target_xcconfig = { - 'SUPPORTS_MACCATALYST' => 'YES', - 'DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER' => 'NO' - } end s.subspec 'MapKit' do |mk| From 940c09ff801e9e92bea1f17a5dd9f0ca86b159c6 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Tue, 13 Aug 2019 19:34:23 +0800 Subject: [PATCH 07/14] Remove `SDWebImage.xcodeproj` from the workspace, try to solve the Xcode New Build System issue of implicit dependency for `SDWebImage.framework` (Both CocoaPosd and SDWebImage.xcodeproj can produce this framework), which cause build issue --- SDWebImage.xcworkspace/contents.xcworkspacedata | 3 --- 1 file changed, 3 deletions(-) diff --git a/SDWebImage.xcworkspace/contents.xcworkspacedata b/SDWebImage.xcworkspace/contents.xcworkspacedata index 12b8a8a6..ffee24dc 100644 --- a/SDWebImage.xcworkspace/contents.xcworkspacedata +++ b/SDWebImage.xcworkspace/contents.xcworkspacedata @@ -1,9 +1,6 @@ - - From 2aa0b8bae6866e6d9bc7cd97aaffd87135002e6e Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Tue, 13 Aug 2019 19:36:27 +0800 Subject: [PATCH 08/14] Update the travis ci script --- .travis.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 381791dc..d2fa7206 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: objective-c -osx_image: xcode10.2 +osx_image: xcode11 env: global: @@ -40,20 +40,20 @@ script: - rm -rf ~/.build - echo Build as static library - - xcodebuild build -workspace SDWebImage.xcworkspace -scheme 'SDWebImage static' -sdk iphonesimulator PLATFORM_NAME=iphonesimulator -configuration Debug | xcpretty -c - - xcodebuild build -workspace SDWebImage.xcworkspace -scheme 'SDWebImage static' -sdk watchsimulator -configuration Debug | xcpretty -c + - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImage static' -sdk iphonesimulator PLATFORM_NAME=iphonesimulator -configuration Debug | xcpretty -c + - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImage static' -sdk watchsimulator -configuration Debug | xcpretty -c - echo Clean DerivedData - rm -rf ~/Library/Developer/Xcode/DerivedData/ - echo Build as dynamic frameworks - - xcodebuild build -workspace SDWebImage.xcworkspace -scheme 'SDWebImage' -sdk macosx -configuration Debug | xcpretty -c - - xcodebuild build -workspace SDWebImage.xcworkspace -scheme 'SDWebImage' -sdk iphonesimulator PLATFORM_NAME=iphonesimulator -configuration Debug | xcpretty -c - - xcodebuild build -workspace SDWebImage.xcworkspace -scheme 'SDWebImage' -sdk appletvsimulator -configuration Debug | xcpretty -c - - xcodebuild build -workspace SDWebImage.xcworkspace -scheme 'SDWebImage' -sdk watchsimulator -configuration Debug | xcpretty -c - - xcodebuild build -workspace SDWebImage.xcworkspace -scheme 'SDWebImageMapKit' -sdk macosx -configuration Debug | xcpretty -c - - xcodebuild build -workspace SDWebImage.xcworkspace -scheme 'SDWebImageMapKit' -sdk iphonesimulator PLATFORM_NAME=iphonesimulator -configuration Debug | xcpretty -c - - xcodebuild build -workspace SDWebImage.xcworkspace -scheme 'SDWebImageMapKit' -sdk appletvsimulator -configuration Debug | xcpretty -c + - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImage' -sdk macosx -configuration Debug | xcpretty -c + - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImage' -sdk iphonesimulator PLATFORM_NAME=iphonesimulator -configuration Debug | xcpretty -c + - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImage' -sdk appletvsimulator -configuration Debug | xcpretty -c + - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImage' -sdk watchsimulator -configuration Debug | xcpretty -c + - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImageMapKit' -sdk macosx -configuration Debug | xcpretty -c + - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImageMapKit' -sdk iphonesimulator PLATFORM_NAME=iphonesimulator -configuration Debug | xcpretty -c + - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImageMapKit' -sdk appletvsimulator -configuration Debug | xcpretty -c - echo Clean DerivedData - rm -rf ~/Library/Developer/Xcode/DerivedData/ From e0b9b9cde4dfe5340cfdb0f027b1847350975517 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Thu, 15 Aug 2019 17:32:27 +0800 Subject: [PATCH 09/14] Update the XCFramework script for macOS catalyst --- SDWebImage.xcodeproj/project.pbxproj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SDWebImage.xcodeproj/project.pbxproj b/SDWebImage.xcodeproj/project.pbxproj index 39b13361..d41d6731 100644 --- a/SDWebImage.xcodeproj/project.pbxproj +++ b/SDWebImage.xcodeproj/project.pbxproj @@ -989,10 +989,11 @@ "$(SRCROOT)/build/appletvsimulator/SDWebImage.framework", "$(SRCROOT)/build/watchos/SDWebImage.framework", "$(SRCROOT)/build/watchsimulator/SDWebImage.framework", + "$(SRCROOT)/build/maccatalyst/SDWebImage.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "mkdir -p $(SRCROOT)/build\ndeclare -a PLATFORMS=(\"iphoneos\" \"iphonesimulator\" \"macosx\" \"appletvos\" \"appletvsimulator\" \"watchos\" \"watchsimulator\")\nfor CURRENT_PLATFORM in \"${PLATFORMS[@]}\"\ndo\nCONFIGURATION=\"Release\"\nif [[ $CURRENT_PLATFORM == *\"simulator\" ]]; then\nCONFIGURATION=\"Debug\"\nfi\nxcodebuild -sdk \"${CURRENT_PLATFORM}\" -scheme SDWebImage -configuration $CONFIGURATION CONFIGURATION_BUILD_DIR=\"${SRCROOT}/build/${CURRENT_PLATFORM}/\" SKIP_INSTALL=NO\ndone\n"; + shellScript = "mkdir -p $(SRCROOT)/build\ndeclare -a PLATFORMS=(\"iphoneos\" \"iphonesimulator\" \"macosx\" \"appletvos\" \"appletvsimulator\" \"watchos\" \"watchsimulator\")\nfor CURRENT_PLATFORM in \"${PLATFORMS[@]}\"\ndo\nif [[ $CURRENT_PLATFORM == *\"simulator\" ]]; then\nxcodebuild -project \"SDWebImage.xcodeproj\" -sdk \"${CURRENT_PLATFORM}\" -scheme \"SDWebImage\" -configuration \"Debug\" CONFIGURATION_BUILD_DIR=\"${SRCROOT}/build/${CURRENT_PLATFORM}/\"\nfi\nxcodebuild archive -project \"SDWebImage.xcodeproj\" -sdk \"${CURRENT_PLATFORM}\" -scheme \"SDWebImage\" -configuration \"Release\" -archivePath \"${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive\" SKIP_INSTALL=NO\nmv \"${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive/Products/Library/Frameworks/SDWebImage.framework\" \"${SRCROOT}/build/${CURRENT_PLATFORM}/\"\nmv \"${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive/dSYMs/SDWebImage.framework.dSYM\" \"${SRCROOT}/build/${CURRENT_PLATFORM}/\"\nrm -rf \"${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive/\"\ndone\n\n# macOS Catalyst\nXCODE_VERSION=$(xcodebuild -version | head -n 1| awk -F ' ' '{print $2}')\nXCODE_VERSION_MAJOR=$(echo $XCODE_VERSION | awk -F '.' '{print $1}')\nif [ $XCODE_VERSION_MAJOR -lt 11 ]\nthen\necho \"Xcode 10 does not support macOS Catalyst (UIKit for macOS)\"\nexit 0\nfi\nxcodebuild archive -project \"SDWebImage.xcodeproj\" -scheme \"SDWebImage\" -configuration \"Release\" -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' -archivePath \"${SRCROOT}/build/maccatalyst/SDWebImage.xcarchive\" SKIP_INSTALL=NO\nmv \"${SRCROOT}/build/maccatalyst/SDWebImage.xcarchive/Products/Library/Frameworks/SDWebImage.framework\" \"${SRCROOT}/build/maccatalyst/\"\nmv \"${SRCROOT}/build/maccatalyst/SDWebImage.xcarchive/dSYMs/SDWebImage.framework.dSYM\" \"${SRCROOT}/build/maccatalyst/\"\nrm -rf \"${SRCROOT}/build/maccatalyst/SDWebImage.xcarchive/\"\n"; }; 326CA51422BA25F70033A92F /* Create XCFramework */ = { isa = PBXShellScriptBuildPhase; @@ -1009,6 +1010,7 @@ "$(SRCROOT)/build/appletvsimulator/SDWebImage.framework", "$(SRCROOT)/build/watchos/SDWebImage.framework", "$(SRCROOT)/build/watchsimulator/SDWebImage.framework", + "$(SRCROOT)/build/maccatalyst/SDWebImage.framework", ); name = "Create XCFramework"; outputFileListPaths = ( @@ -1018,7 +1020,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "XCODE_VERSION=$(xcodebuild -version | head -n 1| awk -F ' ' '{print $2}')\nXCODE_VERSION_MAJOR=$(echo $XCODE_VERSION | awk -F '.' '{print $1}')\nif [ $XCODE_VERSION_MAJOR -lt 11 ]\nthen\necho \"Xcode 10 does not support xcframework. You can still use the individual framework for each platform.\"\nopen -a Finder \"${SRCROOT}/build/\"\nexit 0\nfi\ndeclare -a PLATFORMS=(\"iphoneos\" \"iphonesimulator\" \"macosx\" \"appletvos\" \"appletvsimulator\" \"watchos\" \"watchsimulator\")\nCOMMAND_ARGS=\"\"\nfor CURRENT_PLATFORM in \"${PLATFORMS[@]}\"\ndo\nCOMMAND_ARGS=\"${COMMAND_ARGS} -framework ${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.framework\"\ndone\nxcodebuild -create-xcframework $COMMAND_ARGS -output \"${SRCROOT}/build/SDWebImage.xcframework\"\nopen -a Finder \"${SRCROOT}/build/SDWebImage.xcframework\"\n"; + shellScript = "XCODE_VERSION=$(xcodebuild -version | head -n 1| awk -F ' ' '{print $2}')\nXCODE_VERSION_MAJOR=$(echo $XCODE_VERSION | awk -F '.' '{print $1}')\nif [ $XCODE_VERSION_MAJOR -lt 11 ]\nthen\necho \"Xcode 10 does not support xcframework. You can still use the individual framework for each platform.\"\nopen -a Finder \"${SRCROOT}/build/\"\nexit 0\nfi\ndeclare -a PLATFORMS=(\"iphoneos\" \"iphonesimulator\" \"macosx\" \"appletvos\" \"appletvsimulator\" \"watchos\" \"watchsimulator\" \"maccatalyst\")\nCOMMAND_ARGS=\"\"\nfor CURRENT_PLATFORM in \"${PLATFORMS[@]}\"\ndo\nCOMMAND_ARGS=\"${COMMAND_ARGS} -framework ${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.framework\"\ndone\nxcodebuild -create-xcframework $COMMAND_ARGS -output \"${SRCROOT}/build/SDWebImage.xcframework\"\nopen -a Finder \"${SRCROOT}/build/SDWebImage.xcframework\"\n"; }; /* End PBXShellScriptBuildPhase section */ From 3e8c55e87b0b6decec52bf15eed29473486e2fc6 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Thu, 15 Aug 2019 17:37:23 +0800 Subject: [PATCH 10/14] Update the travis-CI script for the macOS catalyst --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index d2fa7206..bb6dbd51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,9 +51,11 @@ script: - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImage' -sdk iphonesimulator PLATFORM_NAME=iphonesimulator -configuration Debug | xcpretty -c - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImage' -sdk appletvsimulator -configuration Debug | xcpretty -c - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImage' -sdk watchsimulator -configuration Debug | xcpretty -c + - xcodebuild archive -project SDWebImage.xcodeproj -scheme 'SDWebImage' -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' -configuration Debug | xcpretty -c - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImageMapKit' -sdk macosx -configuration Debug | xcpretty -c - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImageMapKit' -sdk iphonesimulator PLATFORM_NAME=iphonesimulator -configuration Debug | xcpretty -c - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImageMapKit' -sdk appletvsimulator -configuration Debug | xcpretty -c + - xcodebuild archive -project SDWebImage.xcodeproj -scheme 'SDWebImageMapKit' -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' -configuration Debug | xcpretty -c - echo Clean DerivedData - rm -rf ~/Library/Developer/Xcode/DerivedData/ @@ -64,6 +66,7 @@ script: - xcodebuild build -workspace SDWebImage.xcworkspace -scheme 'SDWebImage iOS Demo' -destination 'platform=iOS Simulator,name=iPhone XS' -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c - xcodebuild build -workspace SDWebImage.xcworkspace -scheme 'SDWebImage TV Demo' -destination 'platform=tvOS Simulator,name=Apple TV 4K' -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c - xcodebuild build -workspace SDWebImage.xcworkspace -scheme 'SDWebImage Watch Demo' -destination 'platform=iOS Simulator,name=iPhone XS' -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c + - xcodebuild build -workspace SDWebImage.xcworkspace -scheme 'SDWebImage iOS Demo' -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c - echo Clean DerivedData - rm -rf ~/Library/Developer/Xcode/DerivedData/ From 0635a7cd59bac33b2095cc9cdb57d43daa1ef39d Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Thu, 15 Aug 2019 17:57:28 +0800 Subject: [PATCH 11/14] Temporary comment the macOS catalyst build on Travis-CI, since it does not have macOS 10.15 env yet. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index bb6dbd51..d47bdd0b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,11 +51,11 @@ script: - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImage' -sdk iphonesimulator PLATFORM_NAME=iphonesimulator -configuration Debug | xcpretty -c - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImage' -sdk appletvsimulator -configuration Debug | xcpretty -c - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImage' -sdk watchsimulator -configuration Debug | xcpretty -c - - xcodebuild archive -project SDWebImage.xcodeproj -scheme 'SDWebImage' -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' -configuration Debug | xcpretty -c + # - xcodebuild archive -project SDWebImage.xcodeproj -scheme 'SDWebImage' -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' -configuration Debug | xcpretty -c - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImageMapKit' -sdk macosx -configuration Debug | xcpretty -c - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImageMapKit' -sdk iphonesimulator PLATFORM_NAME=iphonesimulator -configuration Debug | xcpretty -c - xcodebuild build -project SDWebImage.xcodeproj -scheme 'SDWebImageMapKit' -sdk appletvsimulator -configuration Debug | xcpretty -c - - xcodebuild archive -project SDWebImage.xcodeproj -scheme 'SDWebImageMapKit' -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' -configuration Debug | xcpretty -c + # - xcodebuild archive -project SDWebImage.xcodeproj -scheme 'SDWebImageMapKit' -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' -configuration Debug | xcpretty -c - echo Clean DerivedData - rm -rf ~/Library/Developer/Xcode/DerivedData/ @@ -66,7 +66,7 @@ script: - xcodebuild build -workspace SDWebImage.xcworkspace -scheme 'SDWebImage iOS Demo' -destination 'platform=iOS Simulator,name=iPhone XS' -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c - xcodebuild build -workspace SDWebImage.xcworkspace -scheme 'SDWebImage TV Demo' -destination 'platform=tvOS Simulator,name=Apple TV 4K' -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c - xcodebuild build -workspace SDWebImage.xcworkspace -scheme 'SDWebImage Watch Demo' -destination 'platform=iOS Simulator,name=iPhone XS' -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c - - xcodebuild build -workspace SDWebImage.xcworkspace -scheme 'SDWebImage iOS Demo' -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c + # - xcodebuild build -workspace SDWebImage.xcworkspace -scheme 'SDWebImage iOS Demo' -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c - echo Clean DerivedData - rm -rf ~/Library/Developer/Xcode/DerivedData/ From 6185bcd7888bc8a942129113ea734ceffc644808 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Thu, 15 Aug 2019 18:04:27 +0800 Subject: [PATCH 12/14] Change the Travis-CI env to Xcode 10.3 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d47bdd0b..a14f80f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: objective-c -osx_image: xcode11 +osx_image: xcode10.3 env: global: From 0f276171520338fb6685c07adef45a701b3d4f13 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Fri, 16 Aug 2019 17:26:13 +0800 Subject: [PATCH 13/14] Try to fix the Xcode 10 compatible --- Examples/SDWebImage Demo.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/SDWebImage Demo.xcodeproj/project.pbxproj b/Examples/SDWebImage Demo.xcodeproj/project.pbxproj index 4aa31d1e..8def2879 100644 --- a/Examples/SDWebImage Demo.xcodeproj/project.pbxproj +++ b/Examples/SDWebImage Demo.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 52; + objectVersion = 46; objects = { /* Begin PBXBuildFile section */ From 1775374feb621a80f1ab6806cda131ea9e329dc2 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Fri, 16 Aug 2019 19:32:21 +0800 Subject: [PATCH 14/14] Update the XCFramework build script, fix the DerivedData path issue (avoid Xcode's default path conflict) and cleanup the code structure --- SDWebImage.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SDWebImage.xcodeproj/project.pbxproj b/SDWebImage.xcodeproj/project.pbxproj index d41d6731..9e2424f8 100644 --- a/SDWebImage.xcodeproj/project.pbxproj +++ b/SDWebImage.xcodeproj/project.pbxproj @@ -993,7 +993,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "mkdir -p $(SRCROOT)/build\ndeclare -a PLATFORMS=(\"iphoneos\" \"iphonesimulator\" \"macosx\" \"appletvos\" \"appletvsimulator\" \"watchos\" \"watchsimulator\")\nfor CURRENT_PLATFORM in \"${PLATFORMS[@]}\"\ndo\nif [[ $CURRENT_PLATFORM == *\"simulator\" ]]; then\nxcodebuild -project \"SDWebImage.xcodeproj\" -sdk \"${CURRENT_PLATFORM}\" -scheme \"SDWebImage\" -configuration \"Debug\" CONFIGURATION_BUILD_DIR=\"${SRCROOT}/build/${CURRENT_PLATFORM}/\"\nfi\nxcodebuild archive -project \"SDWebImage.xcodeproj\" -sdk \"${CURRENT_PLATFORM}\" -scheme \"SDWebImage\" -configuration \"Release\" -archivePath \"${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive\" SKIP_INSTALL=NO\nmv \"${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive/Products/Library/Frameworks/SDWebImage.framework\" \"${SRCROOT}/build/${CURRENT_PLATFORM}/\"\nmv \"${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive/dSYMs/SDWebImage.framework.dSYM\" \"${SRCROOT}/build/${CURRENT_PLATFORM}/\"\nrm -rf \"${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive/\"\ndone\n\n# macOS Catalyst\nXCODE_VERSION=$(xcodebuild -version | head -n 1| awk -F ' ' '{print $2}')\nXCODE_VERSION_MAJOR=$(echo $XCODE_VERSION | awk -F '.' '{print $1}')\nif [ $XCODE_VERSION_MAJOR -lt 11 ]\nthen\necho \"Xcode 10 does not support macOS Catalyst (UIKit for macOS)\"\nexit 0\nfi\nxcodebuild archive -project \"SDWebImage.xcodeproj\" -scheme \"SDWebImage\" -configuration \"Release\" -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' -archivePath \"${SRCROOT}/build/maccatalyst/SDWebImage.xcarchive\" SKIP_INSTALL=NO\nmv \"${SRCROOT}/build/maccatalyst/SDWebImage.xcarchive/Products/Library/Frameworks/SDWebImage.framework\" \"${SRCROOT}/build/maccatalyst/\"\nmv \"${SRCROOT}/build/maccatalyst/SDWebImage.xcarchive/dSYMs/SDWebImage.framework.dSYM\" \"${SRCROOT}/build/maccatalyst/\"\nrm -rf \"${SRCROOT}/build/maccatalyst/SDWebImage.xcarchive/\"\n"; + shellScript = "XCODE_VERSION=$(xcodebuild -version | head -n 1| awk -F ' ' '{print $2}')\nXCODE_VERSION_MAJOR=$(echo $XCODE_VERSION | awk -F '.' '{print $1}')\n\nmkdir -p $(SRCROOT)/build\ndeclare -a PLATFORMS=(\"iphoneos\" \"iphonesimulator\" \"macosx\" \"appletvos\" \"appletvsimulator\" \"watchos\" \"watchsimulator\" \"maccatalyst\")\nfor CURRENT_PLATFORM in \"${PLATFORMS[@]}\"\ndo\n if [[ $CURRENT_PLATFORM == *\"simulator\" ]]; then\n xcodebuild build -project \"SDWebImage.xcodeproj\" -sdk \"${CURRENT_PLATFORM}\" -scheme \"SDWebImage\" -configuration \"Debug\" -derivedDataPath \"${SRCROOT}/build/DerivedData\" CONFIGURATION_BUILD_DIR=\"${SRCROOT}/build/${CURRENT_PLATFORM}/\"\n else\n # macOS Catalyst\n if [[ $CURRENT_PLATFORM == \"maccatalyst\" ]]; then\n if [[ $XCODE_VERSION_MAJOR -lt 11 ]]; then\n # Xcode 10 does not support macOS Catalyst\n continue\n else\n xcodebuild archive -project \"SDWebImage.xcodeproj\" -scheme \"SDWebImage\" -configuration \"Release\" -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' -archivePath \"${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive\" -derivedDataPath \"${SRCROOT}/build/DerivedData\" SKIP_INSTALL=NO\n fi\n else\n xcodebuild archive -project \"SDWebImage.xcodeproj\" -sdk \"${CURRENT_PLATFORM}\" -scheme \"SDWebImage\" -configuration \"Release\" -archivePath \"${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive\" SKIP_INSTALL=NO\n fi\n mv \"${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive/Products/Library/Frameworks/SDWebImage.framework\" \"${SRCROOT}/build/${CURRENT_PLATFORM}/\"\n mv \"${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive/dSYMs/SDWebImage.framework.dSYM\" \"${SRCROOT}/build/${CURRENT_PLATFORM}/\"\n rm -rf \"${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive/\"\n fi\ndone\n"; }; 326CA51422BA25F70033A92F /* Create XCFramework */ = { isa = PBXShellScriptBuildPhase; @@ -1020,7 +1020,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "XCODE_VERSION=$(xcodebuild -version | head -n 1| awk -F ' ' '{print $2}')\nXCODE_VERSION_MAJOR=$(echo $XCODE_VERSION | awk -F '.' '{print $1}')\nif [ $XCODE_VERSION_MAJOR -lt 11 ]\nthen\necho \"Xcode 10 does not support xcframework. You can still use the individual framework for each platform.\"\nopen -a Finder \"${SRCROOT}/build/\"\nexit 0\nfi\ndeclare -a PLATFORMS=(\"iphoneos\" \"iphonesimulator\" \"macosx\" \"appletvos\" \"appletvsimulator\" \"watchos\" \"watchsimulator\" \"maccatalyst\")\nCOMMAND_ARGS=\"\"\nfor CURRENT_PLATFORM in \"${PLATFORMS[@]}\"\ndo\nCOMMAND_ARGS=\"${COMMAND_ARGS} -framework ${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.framework\"\ndone\nxcodebuild -create-xcframework $COMMAND_ARGS -output \"${SRCROOT}/build/SDWebImage.xcframework\"\nopen -a Finder \"${SRCROOT}/build/SDWebImage.xcframework\"\n"; + shellScript = "XCODE_VERSION=$(xcodebuild -version | head -n 1| awk -F ' ' '{print $2}')\nXCODE_VERSION_MAJOR=$(echo $XCODE_VERSION | awk -F '.' '{print $1}')\n\nif [ $XCODE_VERSION_MAJOR -lt 11 ]\nthen\n echo \"Xcode 10 does not support xcframework. You can still use the individual framework for each platform.\"\n open -a Finder \"${SRCROOT}/build/\"\n exit 0\nfi\n\ndeclare -a PLATFORMS=(\"iphoneos\" \"iphonesimulator\" \"macosx\" \"appletvos\" \"appletvsimulator\" \"watchos\" \"watchsimulator\" \"maccatalyst\")\nCOMMAND_ARGS=\"\"\nfor CURRENT_PLATFORM in \"${PLATFORMS[@]}\"\ndo\n COMMAND_ARGS=\"${COMMAND_ARGS} -framework ${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.framework\"\ndone\n\n# Combine XCFramework\nxcodebuild -create-xcframework $COMMAND_ARGS -output \"${SRCROOT}/build/SDWebImage.xcframework\"\nopen -a Finder \"${SRCROOT}/build/SDWebImage.xcframework\"\n"; }; /* End PBXShellScriptBuildPhase section */