diff --git a/.github/workflows/tests/swift/action.yml b/.github/workflows/tests/swift/action.yml index 19b0925bc..1ef571e52 100644 --- a/.github/workflows/tests/swift/action.yml +++ b/.github/workflows/tests/swift/action.yml @@ -6,3 +6,9 @@ runs: working-directory: ./wrappers/swift shell: bash run: sh generate.sh + + - name: Upload package + uses: actions/upload-artifact@v4.3.6 + with: + name: swift + path: ./wrappers/swift/package \ No newline at end of file diff --git a/wrappers/swift/DevolutionsCryptoSwift.podspec b/wrappers/swift/DevolutionsCryptoSwift.podspec new file mode 100644 index 000000000..9480843b5 --- /dev/null +++ b/wrappers/swift/DevolutionsCryptoSwift.podspec @@ -0,0 +1,22 @@ +Pod::Spec.new do |s| + s.name = 'DevolutionsCryptoSwift' + s.version = '0.9.2' + s.summary = 'A Swift wrapper around Devolutions Crypto Rust crate' + + s.homepage = 'https://github.com/Devolutions/devolutions-crypto.git' + s.license = { :type => 'MIT', :file => './LICENSE-MIT' } + s.author = { 'Devolutions Security' => 'security@devolutions.net' } + s.source = { + :git => 'https://github.com/Devolutions/devolutions-crypto.git', + :tag => s.version.to_s + } + + s.swift_version = '5.0' + s.ios.deployment_target = '16.0' + + s.vendored_frameworks = 'DevolutionsCrypto.xcframework' + s.source_files = [ + 'Sources/**/*.{swift}', + 'Tests/**/*.{swift}', + ] +end diff --git a/wrappers/swift/generate.sh b/wrappers/swift/generate.sh index f802b13cb..853763877 100755 --- a/wrappers/swift/generate.sh +++ b/wrappers/swift/generate.sh @@ -35,25 +35,32 @@ mv "./bindings/devolutions_cryptoFFI.modulemap" ./bindings/module.modulemap # combine the platforms # ios simulator -lipo "../../target/x86_64-apple-ios/release/lib$LIBNAME.a" \ - "../../target/aarch64-apple-ios-sim/release/lib$LIBNAME.a" \ - -create -output "./bindings/ios-simulator/lib$LIBNAME.a" +lipo "../../target/x86_64-apple-ios/release/lib$LIBNAME.dylib" \ + "../../target/aarch64-apple-ios-sim/release/lib$LIBNAME.dylib" \ + -create -output "./bindings/ios-simulator/lib$LIBNAME.dylib" # mac -lipo ../../target/x86_64-apple-darwin/release/lib$LIBNAME.a \ - ../../target/aarch64-apple-darwin/release/lib$LIBNAME.a \ - -create -output ./bindings/mac/lib$LIBNAME.a +lipo ../../target/x86_64-apple-darwin/release/lib$LIBNAME.dylib \ + ../../target/aarch64-apple-darwin/release/lib$LIBNAME.dylib \ + -create -output ./bindings/mac/lib$LIBNAME.dylib # no need to combine ios +# Move headers +mkdir headers +cp ./bindings/devolutions_crypto.swift ./headers +cp ./bindings/devolutions_cryptoFFI.h ./headers +cp ./bindings/module.modulemap ./headers + # create the XCFramework xcodebuild -create-xcframework \ - -library "./bindings/ios-simulator/lib$LIBNAME.a" -headers ./bindings \ - -library "./bindings/mac/lib$LIBNAME.a" -headers ./bindings \ - -library "../../target/aarch64-apple-ios/release/lib$LIBNAME.a" -headers ./bindings \ + -library "./bindings/ios-simulator/lib$LIBNAME.dylib" -headers ./headers \ + -library "./bindings/mac/lib$LIBNAME.dylib" -headers ./headers \ + -library "../../target/aarch64-apple-ios/release/lib$LIBNAME.dylib" -headers ./headers \ -output "$XCFRAMEWORK_FOLDER" + # Compress XCFramework ditto -c -k --sequesterRsrc --keepParent "$XCFRAMEWORK_FOLDER" "$XCFRAMEWORK_FOLDER.zip" @@ -68,4 +75,16 @@ cd ./DevolutionsCryptoSwift swift test +cd ../ + +mkdir package + +cp -R ./output/DevolutionsCrypto.xcframework ./package +cp -R ./DevolutionsCryptoSwift/Sources ./package +cp -R ./DevolutionsCryptoSwift/Tests ./package +cp ./DevolutionsCryptoSwift/Package.swift ./package +cp ./DevolutionsCryptoSwift.podspec ./package + +sed -i '' 's|\.\./output/DevolutionsCrypto\.xcframework|./DevolutionsCrypto\.xcframework|g' ./package/Package.swift +