From 520a7b649ee4dd7f6e3e8b0bd7e90d5ab260cd33 Mon Sep 17 00:00:00 2001 From: Gerson Alexander Pardo Gamez Date: Thu, 10 Aug 2023 08:50:55 -0500 Subject: [PATCH] macOS Vendor library (#57) * chore: updated macos podspec * chore: added resources on more time * chore: updated macos podspec * chore: updated binaries from ci * chore: using classic version for macos and iOS * chore: updated macos version * chore: updated ios simulator version * chore: fixed macos detection for tests * chore: updated version --- .github/workflows/tests_android.yml | 14 ++- .github/workflows/tests_ios.yml | 4 +- .github/workflows/tests_macos.yml | 2 +- CHANGELOG.md | 5 ++ example/macos/Podfile | 2 +- example/macos/Podfile.lock | 8 +- .../macos/Runner.xcodeproj/project.pbxproj | 13 +-- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- example/pubspec.lock | 2 +- ios/librsa_bridge.a | Bin 17210504 -> 17210504 bytes lib/bridge/binding.dart | 18 +++- macos/fast_rsa.podspec | 6 +- macos/librsa_bridge.dylib | Bin 8792722 -> 8792736 bytes macos/librsa_bridge.h | 81 ------------------ pubspec.yaml | 2 +- 15 files changed, 48 insertions(+), 111 deletions(-) delete mode 100644 macos/librsa_bridge.h diff --git a/.github/workflows/tests_android.yml b/.github/workflows/tests_android.yml index b7bf570..72af7b2 100644 --- a/.github/workflows/tests_android.yml +++ b/.github/workflows/tests_android.yml @@ -9,7 +9,7 @@ on: jobs: e2e: - runs-on: macos-latest + runs-on: macos-13 steps: - uses: actions/checkout@v3 - uses: actions/cache@v3 @@ -17,18 +17,18 @@ jobs: path: | ~/.gradle/caches ~/.gradle/wrapper - key: gradle + key: gradle-android - uses: actions/cache@v3 id: avd-cache with: path: | ~/.android/avd/* ~/.android/adb* - key: avd + key: avd-android - uses: actions/setup-java@v3 with: distribution: 'temurin' - java-version: '11' + java-version: '17' - uses: android-actions/setup-android@v2 - uses: subosito/flutter-action@main with: @@ -38,18 +38,16 @@ jobs: - if: steps.avd-cache.outputs.cache-hit != 'true' uses: reactivecircus/android-emulator-runner@v2 with: - api-level: 29 + api-level: 30 avd-name: PhoneAPI30 - arch: x86_64 force-avd-creation: false emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: false script: echo "Generated AVD snapshot for caching." - uses: reactivecircus/android-emulator-runner@v2 with: - api-level: 29 + api-level: 30 avd-name: PhoneAPI30 - arch: x86_64 force-avd-creation: false emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true diff --git a/.github/workflows/tests_ios.yml b/.github/workflows/tests_ios.yml index d000592..848d44e 100644 --- a/.github/workflows/tests_ios.yml +++ b/.github/workflows/tests_ios.yml @@ -9,11 +9,11 @@ on: jobs: e2e: - runs-on: macos-latest + runs-on: macos-13 steps: - uses: futureware-tech/simulator-action@v1 with: - model: "iPhone 12 mini" + model: "iPhone 14 Plus" - uses: actions/checkout@v3 - uses: subosito/flutter-action@main with: diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index ec33d8f..247b681 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -9,7 +9,7 @@ on: jobs: e2e: - runs-on: macos-latest + runs-on: macos-13 steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@main diff --git a/CHANGELOG.md b/CHANGELOG.md index 37e3876..448046f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 3.6.1 + +- Fixed macOS podspec issue when signing apps +- Updated binaries to v1.4.2 + ## 3.6.0 - Updated binaries to v1.4.1 diff --git a/example/macos/Podfile b/example/macos/Podfile index dade8df..049abe2 100644 --- a/example/macos/Podfile +++ b/example/macos/Podfile @@ -1,4 +1,4 @@ -platform :osx, '10.11' +platform :osx, '10.14' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock index 2f2f183..0816bfa 100644 --- a/example/macos/Podfile.lock +++ b/example/macos/Podfile.lock @@ -14,9 +14,9 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral SPEC CHECKSUMS: - fast_rsa: 87a964a26439f5b8a603949463525110ab025944 - FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424 + fast_rsa: 47a50bec1042c8c01726007dc0590a078418f997 + FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 -PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c +PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 -COCOAPODS: 1.10.1 +COCOAPODS: 1.12.1 diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj index 7aaf8fe..c623449 100644 --- a/example/macos/Runner.xcodeproj/project.pbxproj +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 54; objects = { /* Begin PBXAggregateTarget section */ @@ -203,7 +203,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = "The Flutter Authors"; TargetAttributes = { 33CC10EC2044A3C60003C045 = { @@ -256,6 +256,7 @@ /* Begin PBXShellScriptBuildPhase section */ 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -298,10 +299,12 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", + "${PODS_ROOT}/../Flutter/ephemeral/.symlinks/plugins/fast_rsa/macos/librsa_bridge.dylib", "${BUILT_PRODUCTS_DIR}/fast_rsa/fast_rsa.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/librsa_bridge.dylib", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/fast_rsa.framework", ); runOnlyForDeploymentPostprocessing = 0; @@ -405,7 +408,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; @@ -488,7 +491,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -535,7 +538,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; diff --git a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 32e7a4d..2631c31 100644 --- a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ 64B%)~Q zltI{P6qRUkhol}Yl2%q4QI;YVgc;BRZC2Lr%`guA@qM3r&OPUT?tAZkZdv2*VP&XX zq)ALP#o78o<>30&Z5kqD;(>YEHTn^g)8@`J#S~g{Vz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z*pwunOLTN?UM|;6atxzt{vP;6z`W92n$SkS>D=IVB&F z9Hj$Yu5EOw+c@Le#-QBp@93f`Oq}#EJ2xNYYc?3PvC+oZcq>~ni2Nz$26uN7LLXsX zqc_aTnPZNeldvqaFmrKfV#bQJoctx@JwvT)7n#ReT9eFJhWl_oicpN@Sb>!&K`9=< zDy+tXScA1F!#b=-IX2)SSWtn7u@RNngeq*t7F1&^w&4+M#}4d-6_4UE?84)yK`ov@ z9d_eMJcXz644%bv*n{U$j~DPF8t@Wc#w*y1M(o3Wyo%S*BwCZiju`brT6dR=AYqn8 zs-H6qw{m_w>RR_`C5`AS6OC^6FHT{PeWbR8TRBJ`b=56uO^d}@W8Nq>csbVz68fDY zB-Gw)Y!U~f?Guy)3*XbC-Bs5#BvO4{U3pqtoVP37>t~Dfu`kj!&Q`3kPfQQDg^RMu zwid_M2>Tr)V}vb3qn?;vm}a9uDC!-p2>{5J&J4KE@|FievZ`?f48G_#9v0IKISJIDwPs z#3^*)YkY%m(TyH_hhCh<_c((e(1(5u;79y~pYaO@F@#_78-B+h_!DRG7yiaSIEQ~L z{Y}yqs1G;w;jTV3lHzaDN`6_6?`yw$6w_9%lpZ*o;f66N^_-h@&k>nAHKVs4E*D-( z#6GPQJ#tbh;Rq!;Gh9gq_P=fPx(g|mcdY3A`g*vG{V7NxTbQGyvC$+c_XY8+d Q+@kycD=MaKIw{TbKX1GRR{#J2 diff --git a/lib/bridge/binding.dart b/lib/bridge/binding.dart index 49a8895..881c4d8 100644 --- a/lib/bridge/binding.dart +++ b/lib/bridge/binding.dart @@ -14,7 +14,6 @@ import 'package:path/path.dart' as Path; class Binding { static final String _callFuncName = 'RSABridgeCall'; static final String _libraryName = 'librsa_bridge'; - static final String _packageName = 'fast_rsa'; static final Binding _singleton = Binding._internal(); late ffi.DynamicLibrary _library; @@ -116,13 +115,26 @@ class Binding { } } + Directory _findAppDirectory(Directory directory) { + try { + return directory + .listSync(recursive: false, followLinks: false) + .whereType() + .firstWhere((dir) => dir.path.endsWith('.app')); + } catch (e) { + return directory; + } + } + ffi.DynamicLibrary openLib() { var isFlutterTest = Platform.environment.containsKey('FLUTTER_TEST'); if (Platform.isMacOS || Platform.isIOS) { if (isFlutterTest) { - var ffiFile = - 'build/macos/Build/Products/Debug/$_packageName/$_packageName.framework/Resources/$_libraryName.dylib'; + final appDirectory = + _findAppDirectory(Directory('build/macos/Build/Products/Debug')); + var ffiFile = Path.join( + appDirectory.path, "Contents", "Frameworks", "$_libraryName.dylib"); validateTestFFIFile(ffiFile); return ffi.DynamicLibrary.open(ffiFile); } diff --git a/macos/fast_rsa.podspec b/macos/fast_rsa.podspec index 6ae0454..774ce7e 100644 --- a/macos/fast_rsa.podspec +++ b/macos/fast_rsa.podspec @@ -18,7 +18,7 @@ Pod::Spec.new do |s| s.platform = :osx, '10.11' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } s.swift_version = '5.0' - #s.vendored_libraries = 'librsa_bridge.dylib' - s.resources = ['librsa_bridge.dylib'] - s.xcconfig = { 'LD_RUNPATH_SEARCH_PATHS' => '@loader_path/../Frameworks/fast_rsa.framework/Resources' } + s.preserve_paths = 'librsa_bridge.dylib' + s.vendored_libraries = 'librsa_bridge.dylib' + s.xcconfig = { 'LD_RUNPATH_SEARCH_PATHS' => '@loader_path/../Frameworks' } end diff --git a/macos/librsa_bridge.dylib b/macos/librsa_bridge.dylib index 4812eaa135bad74dca18373c44b9d469b145b305..ae34f053d11ce86b04b0bb3f2f70e5a4af6316a4 100644 GIT binary patch delta 895 zcmb8tYfQ~?7zgnGIh~YH(J7Z)PIB)?E`{h+e|20sC0{AGE>7q|oN@`}bm&`VmdSR! z%!b&+noVOv8`B%}!e-_&%gn|L@0ww=`C{IAVbv&0U;RpLH-NbzNy=$)1v?)pdKP zhdH_iS|<5HSO_Z-MA(R6VgwOFgc2i(Fk%!jnixZb6A?rtF_sudL=ko(nusCB6BCGu z#3Uk?m`qF|rV`T#2N6e1C*p}2#7trqF`Jk}%q8X#2}B~1L?ja_#C&1_kxDEi77>ey zB}5vLPAnys5zC1TVg<31$RwOZ7LiTl+=gjSwD|g?edha+Xu}u$XL8Pr-?_U+b>O1c z5!K~z*;4*u5S+-G-Z|KN}jl6wXBh~vQF~FEd^32>!nCG2xOxa%O)w2 zQrRq9WUFkG?NTP?QX!SHLp)L?J7t&bmTIYyTB(ygvR8incc1JRuQW)b9FT)@NDfPr z9Fe1POq!)dj*CxP#V;rNg9cAN8j2gz9{wJ*{rlU|R>SZ=F|0Pjuqq6rF7UCZ&0O@a z121eZbl>Qik{r8u_`{u7t`|46hvQ4P)c3y5xYwEddfb;l(bcwc$6Y*Jzx-NTb;9S+ g3t^p!rv{d!_28-R)q{pNmg{*D@A{uzZ5wF)3E3h-d;kCd delta 852 zcmZwFT};gZ7zXhFIh~XvoSc)7d~^zl6j2G$Idzbd4(B04UrPFbe}0E8L#HF)Z*0S#PXKfsKO}(=&TO@7nUpi@BF(5ZZ$gXUCwMv)c-;)ZLAy5G~m1Fxoi9K z?PF#}RC3g#iC^1yjN0P+Loa!*nam^pzNBgCfu12xzN2inH=!vdAN9ql3Ep~lUQJ4Q z=7pePk8F^QvPrUKv*bvwY>_gA9emIi5*BXU%lr}hM{SVy=! zChnzw%rtDbzQ6t;q2tleNBcW(prp6G#Q7rU#?8K0Ult{16lVWw_^{?e!Ks^Xih2f~ S$2JC+tbbkG|GBq)uZT diff --git a/macos/librsa_bridge.h b/macos/librsa_bridge.h deleted file mode 100644 index 9bbafbc..0000000 --- a/macos/librsa_bridge.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Code generated by cmd/cgo; DO NOT EDIT. */ - -/* package command-line-arguments */ - - -#line 1 "cgo-builtin-export-prolog" - -#include /* for ptrdiff_t below */ - -#ifndef GO_CGO_EXPORT_PROLOGUE_H -#define GO_CGO_EXPORT_PROLOGUE_H - -#ifndef GO_CGO_GOSTRING_TYPEDEF -typedef struct { const char *p; ptrdiff_t n; } _GoString_; -#endif - -#endif - -/* Start of preamble from import "C" comments. */ - - -#line 3 "main.go" -#include -#include -typedef struct { void* message; int size; char* error; } BytesReturn; - -#line 1 "cgo-generated-wrapper" - - -/* End of preamble from import "C" comments. */ - - -/* Start of boilerplate cgo prologue. */ -#line 1 "cgo-gcc-export-header-prolog" - -#ifndef GO_CGO_PROLOGUE_H -#define GO_CGO_PROLOGUE_H - -typedef signed char GoInt8; -typedef unsigned char GoUint8; -typedef short GoInt16; -typedef unsigned short GoUint16; -typedef int GoInt32; -typedef unsigned int GoUint32; -typedef long long GoInt64; -typedef unsigned long long GoUint64; -typedef GoInt64 GoInt; -typedef GoUint64 GoUint; -typedef __SIZE_TYPE__ GoUintptr; -typedef float GoFloat32; -typedef double GoFloat64; -typedef float _Complex GoComplex64; -typedef double _Complex GoComplex128; - -/* - static assertion to make sure the file is being used on architecture - at least with matching size of GoInt. -*/ -typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1]; - -#ifndef GO_CGO_GOSTRING_TYPEDEF -typedef _GoString_ GoString; -#endif -typedef void *GoMap; -typedef void *GoChan; -typedef struct { void *t; void *v; } GoInterface; -typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; - -#endif - -/* End of boilerplate cgo prologue. */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern BytesReturn* RSABridgeCall(char* name, void* payload, int payloadSize); - -#ifdef __cplusplus -} -#endif diff --git a/pubspec.yaml b/pubspec.yaml index e3fc7ef..f828a8c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: fast_rsa description: library for use RSA with support for android and ios, macOS, linux, windows and web -version: 3.6.0 +version: 3.6.1 homepage: https://github.com/jerson/flutter-rsa environment: