Skip to content

Commit

Permalink
macOS Vendor library (#57)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jerson authored Aug 10, 2023
1 parent b2863d4 commit 520a7b6
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 111 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/tests_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ on:

jobs:
e2e:
runs-on: macos-latest
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
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:
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion example/macos/Podfile
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
8 changes: 4 additions & 4 deletions example/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 8 additions & 5 deletions example/macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {

/* Begin PBXAggregateTarget section */
Expand Down Expand Up @@ -203,7 +203,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "The Flutter Authors";
TargetAttributes = {
33CC10EC2044A3C60003C045 = {
Expand Down Expand Up @@ -256,6 +256,7 @@
/* Begin PBXShellScriptBuildPhase section */
3399D490228B24CF009A79C7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ packages:
path: ".."
relative: true
source: path
version: "3.6.0"
version: "3.6.1"
ffi:
dependency: transitive
description:
Expand Down
Binary file modified ios/librsa_bridge.a
Binary file not shown.
18 changes: 15 additions & 3 deletions lib/bridge/binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -116,13 +115,26 @@ class Binding {
}
}

Directory _findAppDirectory(Directory directory) {
try {
return directory
.listSync(recursive: false, followLinks: false)
.whereType<Directory>()
.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);
}
Expand Down
6 changes: 3 additions & 3 deletions macos/fast_rsa.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Binary file modified macos/librsa_bridge.dylib
Binary file not shown.
81 changes: 0 additions & 81 deletions macos/librsa_bridge.h

This file was deleted.

2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit 520a7b6

Please sign in to comment.