diff --git a/carthage.sh b/carthage.sh new file mode 100755 index 0000000..fa44975 --- /dev/null +++ b/carthage.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# carthage.sh +# Usage example: ./carthage.sh build --platform iOS + +set -euo pipefail + +xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX) +trap 'rm -f "$xcconfig"' INT TERM HUP EXIT + +# For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise +# the build will fail on lipo due to duplicate architectures. +echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig +echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig + +export XCODE_XCCONFIG_FILE="$xcconfig" +carthage "$@" \ No newline at end of file diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 7f83578..a947148 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -80,18 +80,30 @@ platform :ios do desc "Lint Carthage lib" lane :carthage_lint do - carthage( - command: "update", - platform: "iOS", - cache_builds: true, - ) - carthage( - command: "build", - platform: "iOS", - cache_builds: true, - no_skip_current: true, - ) + # This is a temporary fix while Carthage is broken with Xcode 12 + # https://github.com/Carthage/Carthage/issues/3019#issuecomment-665136323 + # + # The default Fastlane action can be used when a new Carthage version with a fix has been released + # and the ./carthage.sh script can be removed + Dir.chdir("..") do + sh("./carthage.sh", "update", "--platform", "iOS", "--cache-builds") + + sh("./carthage.sh", "build", "--no-skip-current", "--platform", "iOS", "--cache-builds") + end + + # carthage( + # command: "update", + # platform: "iOS", + # cache_builds: true, + # ) + + # carthage( + # command: "build", + # platform: "iOS", + # cache_builds: true, + # no_skip_current: true, + # ) end desc "Deploy a new version to Github and Cocoapods" @@ -108,9 +120,18 @@ platform :ios do UI.user_error! "Podspec version different than tag name" end - carthage( - command: "archive", - ) + # This is a temporary fix while Carthage is broken with Xcode 12 + # https://github.com/Carthage/Carthage/issues/3019#issuecomment-665136323 + # + # The default Fastlane action can be used when a new Carthage version with a fix has been released + # and the ./carthage.sh script can be removed + Dir.chdir("..") do + sh("./carthage.sh", "archive") + end + + # carthage( + # command: "archive", + # ) pod_push( path: "ReCaptcha.podspec",