From c2037417a610ee6a380d214d94a95183a3db4a0a Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Wed, 26 Jun 2019 16:38:36 +0800 Subject: [PATCH] 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 */