From 13fdc685f6717b4d2d4131622b8f915c75bb9163 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Wed, 19 Jun 2019 16:42:56 +0800 Subject: [PATCH 1/3] Provide a script target to directly build all SDWebImage framework and generate one XCFramework, all in on for manual installation user --- SDWebImage.xcodeproj/project.pbxproj | 99 +++++++++++++++++++ .../xcschemes/SDWebImage XCFramework.xcscheme | 67 +++++++++++++ .../xcschemes/SDWebImage.xcscheme | 4 - 3 files changed, 166 insertions(+), 4 deletions(-) create mode 100644 SDWebImage.xcodeproj/xcshareddata/xcschemes/SDWebImage XCFramework.xcscheme diff --git a/SDWebImage.xcodeproj/project.pbxproj b/SDWebImage.xcodeproj/project.pbxproj index f2e93bc1..481232e4 100644 --- a/SDWebImage.xcodeproj/project.pbxproj +++ b/SDWebImage.xcodeproj/project.pbxproj @@ -6,6 +6,21 @@ objectVersion = 46; objects = { +/* Begin PBXAggregateTarget section */ + 326CA50C22BA14EF0033A92F /* SDWebImage XCFramework */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 326CA50F22BA14EF0033A92F /* Build configuration list for PBXAggregateTarget "SDWebImage XCFramework" */; + buildPhases = ( + 326CA51322BA1A270033A92F /* Build Frameworks */, + 326CA51422BA25F70033A92F /* Create XCFramework */, + ); + dependencies = ( + ); + name = "SDWebImage XCFramework"; + productName = "SDWebImage XCFramework"; + }; +/* End PBXAggregateTarget section */ + /* Begin PBXBuildFile section */ 320CAE172086F50500CFFC80 /* SDWebImageError.h in Headers */ = {isa = PBXBuildFile; fileRef = 320CAE132086F50500CFFC80 /* SDWebImageError.h */; settings = {ATTRIBUTES = (Public, ); }; }; 320CAE1B2086F50500CFFC80 /* SDWebImageError.m in Sources */ = {isa = PBXBuildFile; fileRef = 320CAE142086F50500CFFC80 /* SDWebImageError.m */; }; @@ -906,6 +921,10 @@ LastUpgradeCheck = 0940; ORGANIZATIONNAME = Dailymotion; TargetAttributes = { + 326CA50C22BA14EF0033A92F = { + CreatedOnToolsVersion = 11.0; + ProvisioningStyle = Automatic; + }; 4A2CADFE1AB4BB5300B6BC39 = { CreatedOnToolsVersion = 6.3; }; @@ -927,6 +946,7 @@ 53761307155AD0D5005750A4 /* SDWebImage static */, 4A2CADFE1AB4BB5300B6BC39 /* SDWebImage */, 80B6DF862142B71600BCB334 /* SDWebImageMapKit */, + 326CA50C22BA14EF0033A92F /* SDWebImage XCFramework */, ); }; /* End PBXProject section */ @@ -948,6 +968,60 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 326CA51322BA1A270033A92F /* Build Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Build Frameworks"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(SRCROOT)/build/iphoneos/SDWebImage.xcarchive", + "$(SRCROOT)/build/iphonesimulator/SDWebImage.xcarchive", + "$(SRCROOT)/build/macosx/SDWebImage.xcarchive", + "$(SRCROOT)/build/appletvos/SDWebImage.xcarchive", + "$(SRCROOT)/build/appletvsimulator/SDWebImage.xcarchive", + "$(SRCROOT)/build/watchos/SDWebImage.xcarchive", + "$(SRCROOT)/build/watchsimulator/SDWebImage.xcarchive", + ); + 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\nxcodebuild archive -sdk \"${CURRENT_PLATFORM}\" -scheme SDWebImage -archivePath \"${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive\" SKIP_INSTALL=NO\ndone\n"; + }; + 326CA51422BA25F70033A92F /* Create XCFramework */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "$(SRCROOT)/build/iphoneos/SDWebImage.xcarchive", + "$(SRCROOT)/build/iphonesimulator/SDWebImage.xcarchive", + "$(SRCROOT)/build/macosx/SDWebImage.xcarchive", + "$(SRCROOT)/build/appletvos/SDWebImage.xcarchive", + "$(SRCROOT)/build/appletvsimulator/SDWebImage.xcarchive", + "$(SRCROOT)/build/watchos/SDWebImage.xcarchive", + "$(SRCROOT)/build/watchsimulator/SDWebImage.xcarchive", + ); + name = "Create XCFramework"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(SRCROOT)/build/SDWebImage.xcframework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "declare -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.xcarchive/Products/Library/Frameworks/SDWebImage.framework\"\ndone\nxcodebuild -create-xcframework $COMMAND_ARGS -output \"${SRCROOT}/build/SDWebImage.xcframework\"\nopen -a Finder \"${SRCROOT}/build/SDWebImage.xcframework\"\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 4A2CADFA1AB4BB5300B6BC39 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -1094,6 +1168,22 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 326CA50D22BA14EF0033A92F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 326CA50E22BA14EF0033A92F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; 4A2CAE131AB4BB5400B6BC39 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1163,6 +1253,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 326CA50F22BA14EF0033A92F /* Build configuration list for PBXAggregateTarget "SDWebImage XCFramework" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 326CA50D22BA14EF0033A92F /* Debug */, + 326CA50E22BA14EF0033A92F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 4A2CAE121AB4BB5400B6BC39 /* Build configuration list for PBXNativeTarget "SDWebImage" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/SDWebImage.xcodeproj/xcshareddata/xcschemes/SDWebImage XCFramework.xcscheme b/SDWebImage.xcodeproj/xcshareddata/xcschemes/SDWebImage XCFramework.xcscheme new file mode 100644 index 00000000..c8f654d9 --- /dev/null +++ b/SDWebImage.xcodeproj/xcshareddata/xcschemes/SDWebImage XCFramework.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SDWebImage.xcodeproj/xcshareddata/xcschemes/SDWebImage.xcscheme b/SDWebImage.xcodeproj/xcshareddata/xcschemes/SDWebImage.xcscheme index 0593868e..038cdd36 100644 --- a/SDWebImage.xcodeproj/xcshareddata/xcschemes/SDWebImage.xcscheme +++ b/SDWebImage.xcodeproj/xcshareddata/xcschemes/SDWebImage.xcscheme @@ -29,8 +29,6 @@ shouldUseLaunchSchemeArgsEnv = "YES"> - - - - Date: Wed, 26 Jun 2019 16:38:36 +0800 Subject: [PATCH 2/3] Update the build script to support Xcode 10 without xcframework. Also change to build simulator platform using Debug configuration instead of Release configuration --- SDWebImage.xcodeproj/project.pbxproj | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/SDWebImage.xcodeproj/project.pbxproj b/SDWebImage.xcodeproj/project.pbxproj index 481232e4..cdf8671a 100644 --- a/SDWebImage.xcodeproj/project.pbxproj +++ b/SDWebImage.xcodeproj/project.pbxproj @@ -982,17 +982,17 @@ outputFileListPaths = ( ); outputPaths = ( - "$(SRCROOT)/build/iphoneos/SDWebImage.xcarchive", - "$(SRCROOT)/build/iphonesimulator/SDWebImage.xcarchive", - "$(SRCROOT)/build/macosx/SDWebImage.xcarchive", - "$(SRCROOT)/build/appletvos/SDWebImage.xcarchive", - "$(SRCROOT)/build/appletvsimulator/SDWebImage.xcarchive", - "$(SRCROOT)/build/watchos/SDWebImage.xcarchive", - "$(SRCROOT)/build/watchsimulator/SDWebImage.xcarchive", + "$(SRCROOT)/build/iphoneos/SDWebImage.framework", + "$(SRCROOT)/build/iphonesimulator/SDWebImage.framework", + "$(SRCROOT)/build/macosx/SDWebImage.framework", + "$(SRCROOT)/build/appletvos/SDWebImage.framework", + "$(SRCROOT)/build/appletvsimulator/SDWebImage.framework", + "$(SRCROOT)/build/watchos/SDWebImage.framework", + "$(SRCROOT)/build/watchsimulator/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\nxcodebuild archive -sdk \"${CURRENT_PLATFORM}\" -scheme SDWebImage -archivePath \"${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive\" 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\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"; }; 326CA51422BA25F70033A92F /* Create XCFramework */ = { isa = PBXShellScriptBuildPhase; @@ -1002,13 +1002,13 @@ inputFileListPaths = ( ); inputPaths = ( - "$(SRCROOT)/build/iphoneos/SDWebImage.xcarchive", - "$(SRCROOT)/build/iphonesimulator/SDWebImage.xcarchive", - "$(SRCROOT)/build/macosx/SDWebImage.xcarchive", - "$(SRCROOT)/build/appletvos/SDWebImage.xcarchive", - "$(SRCROOT)/build/appletvsimulator/SDWebImage.xcarchive", - "$(SRCROOT)/build/watchos/SDWebImage.xcarchive", - "$(SRCROOT)/build/watchsimulator/SDWebImage.xcarchive", + "$(SRCROOT)/build/iphoneos/SDWebImage.framework", + "$(SRCROOT)/build/iphonesimulator/SDWebImage.framework", + "$(SRCROOT)/build/macosx/SDWebImage.framework", + "$(SRCROOT)/build/appletvos/SDWebImage.framework", + "$(SRCROOT)/build/appletvsimulator/SDWebImage.framework", + "$(SRCROOT)/build/watchos/SDWebImage.framework", + "$(SRCROOT)/build/watchsimulator/SDWebImage.framework", ); name = "Create XCFramework"; outputFileListPaths = ( @@ -1018,7 +1018,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "declare -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.xcarchive/Products/Library/Frameworks/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.\"\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"; }; /* End PBXShellScriptBuildPhase section */ From 57894763be58b71c543e82f5948a9abb4b7a2020 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Wed, 26 Jun 2019 16:39:50 +0800 Subject: [PATCH 3/3] Open Finder when build all frameworks finished on Xcode 10 as well (Xcode 11 will open when xcframework build finished) --- SDWebImage.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SDWebImage.xcodeproj/project.pbxproj b/SDWebImage.xcodeproj/project.pbxproj index cdf8671a..8d8ada51 100644 --- a/SDWebImage.xcodeproj/project.pbxproj +++ b/SDWebImage.xcodeproj/project.pbxproj @@ -1018,7 +1018,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.\"\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\")\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 */