diff --git a/.gitignore b/.gitignore index e9b29be..b385c21 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ # Xcode # build/ +.build/ +Carthage/ *.pbxuser !default.pbxuser *.mode1v3 diff --git a/.swift-version b/.swift-version index 819e07a..d346e2a 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -5.0 +5.3 diff --git a/.swiftformat b/.swiftformat index f2ebf11..e1c0ee1 100644 --- a/.swiftformat +++ b/.swiftformat @@ -1,6 +1,6 @@ --disable blankLinesAroundMark,blankLinesAtStartOfScope --patternlet inline --stripunusedargs closure-only ---swiftversion 5.0 +--swiftversion 5.3 --wraparguments beforefirst --wrapcollections beforefirst diff --git a/MonkeyKing.podspec b/MonkeyKing.podspec index dabe891..5787c2c 100644 --- a/MonkeyKing.podspec +++ b/MonkeyKing.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "MonkeyKing" - s.version = "1.16.0" + s.version = "1.17.0" s.summary = "MonkeyKing helps you to post messages to Chinese Social Networks, or do OAuth and Payment." s.description = <<-DESC @@ -16,7 +16,7 @@ Pod::Spec.new do |s| s.authors = { "nixzhu" => "zhuhongxu@gmail.com" } s.social_media_url = "https://twitter.com/nixzhu" - s.ios.deployment_target = "8.0" + s.ios.deployment_target = "9.0" s.swift_version = '5.0' s.source = { :git => "https://github.com/nixzhu/MonkeyKing.git", :tag => s.version } diff --git a/Package.swift b/Package.swift index 2921cfc..a9d1dfd 100644 --- a/Package.swift +++ b/Package.swift @@ -1,34 +1,42 @@ -// swift-tools-version:5.1 -// The swift-tools-version declares the minimum version of Swift required to build this package. +// swift-tools-version:5.3 import PackageDescription let package = Package( name: "MonkeyKing", platforms: [ - .iOS(.v8), + .iOS(.v9), ], products: [ - // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( - name: "MonkeyKing", + name: "MonkeyKingStatic", + type: .static, + targets: ["MonkeyKingSource"] + ), + .library( + name: "MonkeyKingDynamic", + type: .dynamic, + targets: ["MonkeyKingSource"] + ), + .library( + name: "MonkeyKingXCFramework", targets: ["MonkeyKing"] ), ], - dependencies: [ - // Dependencies declare other packages that this package depends on. - // .package(url: /* package url */, from: "1.0.0"), - ], targets: [ - // Targets are the basic building blocks of a package. A target can define a module or a test suite. - // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( - name: "MonkeyKing", - dependencies: [] + name: "MonkeyKingSource", + path: "Sources/MonkeyKing" ), .testTarget( name: "MonkeyKingTests", - dependencies: ["MonkeyKing"] + dependencies: ["MonkeyKing"], + path: "Tests/MonkeyKingTests" ), + .binaryTarget( + name: "MonkeyKing", + url: "https://github.com/nixzhu/MonkeyKing/releases/download/pre-1.17.0/MonkeyKing.xcframework.zip", + checksum: "1b4fafe9b3c438c7fe9f3490a5b4194baad0cb70c20ee374e0fb86326ee0e283" + ) ] ) diff --git a/README.md b/README.md index 18f21ee..fe232a3 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ MonkeyKing also supports **OAuth** and **Mobile payment** via WeChat and Alipay! ## Requirements -Swift 5, iOS 8 +Swift 5, iOS 9 (For Swift 4.2, use version 1.13.0) @@ -175,6 +175,12 @@ github "nixzhu/MonkeyKing" pod 'MonkeyKing' ``` +### Swift Package Manager + +``` +https://github.com/nixzhu/MonkeyKing +``` + ## Contributors Thanks to all the [contributors](https://github.com/nixzhu/MonkeyKing/graphs/contributors). diff --git a/Scripts/carthage_workaround.sh b/Scripts/carthage_workaround.sh new file mode 100755 index 0000000..a55ffeb --- /dev/null +++ b/Scripts/carthage_workaround.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# carthage-build.sh +# Usage example: ./carthage-build.sh --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. +# Xcode 12 GM (12A7209) +echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_12A7209 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig + +echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_$(XCODE_PRODUCT_BUILD_VERSION))' >> $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" + +rm -rf Carthage/Build + +carthage build --no-skip-current --platform iOS + +cd Carthage/Build && zip -vry MonkeyKing.Carthage.framework.zip ./ -x "*.DS_Store" + +open . \ No newline at end of file diff --git a/Scripts/xcframework.sh b/Scripts/xcframework.sh new file mode 100755 index 0000000..b694dbe --- /dev/null +++ b/Scripts/xcframework.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +xcodebuild archive -project "China.xcodeproj" \ + -scheme "MonkeyKing" -configuration Release \ + -sdk iphonesimulator \ + -archivePath "build/MonkeyKing/Simulator" \ + SKIP_INSTALL=NO \ + BUILD_LIBRARY_FOR_DISTRIBUTION=YES + +xcodebuild archive -project "China.xcodeproj" \ + -scheme "MonkeyKing" -configuration Release \ + -sdk iphoneos \ + -archivePath "build/MonkeyKing/iOS" \ + SKIP_INSTALL=NO \ + BUILD_LIBRARY_FOR_DISTRIBUTION=YES + +xcodebuild -create-xcframework \ + -framework build/MonkeyKing/Simulator.xcarchive/Products/Library/Frameworks/MonkeyKing.framework \ + -framework build/MonkeyKing/iOS.xcarchive/Products/Library/Frameworks/MonkeyKing.framework \ + -output build/MonkeyKing.xcframework + +cd Build && find . -name "*.swiftinterface" -exec sed -i -e 's/MonkeyKing\.MonkeyKing/MonkeyKing/g' {} \; + +zip -vry MonkeyKing.xcframework.zip MonkeyKing.xcframework/ -x "*.DS_Store" + +echo "\n-----" +swift package compute-checksum MonkeyKing.xcframework.zip +echo "-----" + +open .