Skip to content

Commit f1a4eff

Browse files
committed
chore: using xcframework for ios
1 parent b47b1a7 commit f1a4eff

File tree

8 files changed

+228
-10
lines changed

8 files changed

+228
-10
lines changed

ios/Rsa.xcframework/Info.plist

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>AvailableLibraries</key>
6+
<array>
7+
<dict>
8+
<key>BinaryPath</key>
9+
<string>librsa_bridge.a</string>
10+
<key>HeadersPath</key>
11+
<string>Headers</string>
12+
<key>LibraryIdentifier</key>
13+
<string>ios-arm64_x86_64-simulator</string>
14+
<key>LibraryPath</key>
15+
<string>librsa_bridge.a</string>
16+
<key>SupportedArchitectures</key>
17+
<array>
18+
<string>arm64</string>
19+
<string>x86_64</string>
20+
</array>
21+
<key>SupportedPlatform</key>
22+
<string>ios</string>
23+
<key>SupportedPlatformVariant</key>
24+
<string>simulator</string>
25+
</dict>
26+
<dict>
27+
<key>BinaryPath</key>
28+
<string>librsa_bridge.a</string>
29+
<key>HeadersPath</key>
30+
<string>Headers</string>
31+
<key>LibraryIdentifier</key>
32+
<string>ios-arm64</string>
33+
<key>LibraryPath</key>
34+
<string>librsa_bridge.a</string>
35+
<key>SupportedArchitectures</key>
36+
<array>
37+
<string>arm64</string>
38+
</array>
39+
<key>SupportedPlatform</key>
40+
<string>ios</string>
41+
</dict>
42+
</array>
43+
<key>CFBundlePackageType</key>
44+
<string>XFWK</string>
45+
<key>XCFrameworkFormatVersion</key>
46+
<string>1.0</string>
47+
</dict>
48+
</plist>
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/* Code generated by cmd/cgo; DO NOT EDIT. */
2+
3+
/* package command-line-arguments */
4+
5+
6+
#line 1 "cgo-builtin-export-prolog"
7+
8+
#include <stddef.h>
9+
10+
#ifndef GO_CGO_EXPORT_PROLOGUE_H
11+
#define GO_CGO_EXPORT_PROLOGUE_H
12+
13+
#ifndef GO_CGO_GOSTRING_TYPEDEF
14+
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
15+
#endif
16+
17+
#endif
18+
19+
/* Start of preamble from import "C" comments. */
20+
21+
22+
#line 3 "main.go"
23+
#include <stdint.h>
24+
#include <stdlib.h>
25+
typedef struct { void* message; int size; char* error; } BytesReturn;
26+
27+
#line 1 "cgo-generated-wrapper"
28+
29+
30+
/* End of preamble from import "C" comments. */
31+
32+
33+
/* Start of boilerplate cgo prologue. */
34+
#line 1 "cgo-gcc-export-header-prolog"
35+
36+
#ifndef GO_CGO_PROLOGUE_H
37+
#define GO_CGO_PROLOGUE_H
38+
39+
typedef signed char GoInt8;
40+
typedef unsigned char GoUint8;
41+
typedef short GoInt16;
42+
typedef unsigned short GoUint16;
43+
typedef int GoInt32;
44+
typedef unsigned int GoUint32;
45+
typedef long long GoInt64;
46+
typedef unsigned long long GoUint64;
47+
typedef GoInt64 GoInt;
48+
typedef GoUint64 GoUint;
49+
typedef size_t GoUintptr;
50+
typedef float GoFloat32;
51+
typedef double GoFloat64;
52+
#ifdef _MSC_VER
53+
#include <complex.h>
54+
typedef _Fcomplex GoComplex64;
55+
typedef _Dcomplex GoComplex128;
56+
#else
57+
typedef float _Complex GoComplex64;
58+
typedef double _Complex GoComplex128;
59+
#endif
60+
61+
/*
62+
static assertion to make sure the file is being used on architecture
63+
at least with matching size of GoInt.
64+
*/
65+
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
66+
67+
#ifndef GO_CGO_GOSTRING_TYPEDEF
68+
typedef _GoString_ GoString;
69+
#endif
70+
typedef void *GoMap;
71+
typedef void *GoChan;
72+
typedef struct { void *t; void *v; } GoInterface;
73+
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
74+
75+
#endif
76+
77+
/* End of boilerplate cgo prologue. */
78+
79+
#ifdef __cplusplus
80+
extern "C" {
81+
#endif
82+
83+
extern BytesReturn* RSABridgeCall(char* name, void* payload, int payloadSize);
84+
85+
#ifdef __cplusplus
86+
}
87+
#endif
4.9 MB
Binary file not shown.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/* Code generated by cmd/cgo; DO NOT EDIT. */
2+
3+
/* package command-line-arguments */
4+
5+
6+
#line 1 "cgo-builtin-export-prolog"
7+
8+
#include <stddef.h>
9+
10+
#ifndef GO_CGO_EXPORT_PROLOGUE_H
11+
#define GO_CGO_EXPORT_PROLOGUE_H
12+
13+
#ifndef GO_CGO_GOSTRING_TYPEDEF
14+
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
15+
#endif
16+
17+
#endif
18+
19+
/* Start of preamble from import "C" comments. */
20+
21+
22+
#line 3 "main.go"
23+
#include <stdint.h>
24+
#include <stdlib.h>
25+
typedef struct { void* message; int size; char* error; } BytesReturn;
26+
27+
#line 1 "cgo-generated-wrapper"
28+
29+
30+
/* End of preamble from import "C" comments. */
31+
32+
33+
/* Start of boilerplate cgo prologue. */
34+
#line 1 "cgo-gcc-export-header-prolog"
35+
36+
#ifndef GO_CGO_PROLOGUE_H
37+
#define GO_CGO_PROLOGUE_H
38+
39+
typedef signed char GoInt8;
40+
typedef unsigned char GoUint8;
41+
typedef short GoInt16;
42+
typedef unsigned short GoUint16;
43+
typedef int GoInt32;
44+
typedef unsigned int GoUint32;
45+
typedef long long GoInt64;
46+
typedef unsigned long long GoUint64;
47+
typedef GoInt64 GoInt;
48+
typedef GoUint64 GoUint;
49+
typedef size_t GoUintptr;
50+
typedef float GoFloat32;
51+
typedef double GoFloat64;
52+
#ifdef _MSC_VER
53+
#include <complex.h>
54+
typedef _Fcomplex GoComplex64;
55+
typedef _Dcomplex GoComplex128;
56+
#else
57+
typedef float _Complex GoComplex64;
58+
typedef double _Complex GoComplex128;
59+
#endif
60+
61+
/*
62+
static assertion to make sure the file is being used on architecture
63+
at least with matching size of GoInt.
64+
*/
65+
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
66+
67+
#ifndef GO_CGO_GOSTRING_TYPEDEF
68+
typedef _GoString_ GoString;
69+
#endif
70+
typedef void *GoMap;
71+
typedef void *GoChan;
72+
typedef struct { void *t; void *v; } GoInterface;
73+
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
74+
75+
#endif
76+
77+
/* End of boilerplate cgo prologue. */
78+
79+
#ifdef __cplusplus
80+
extern "C" {
81+
#endif
82+
83+
extern BytesReturn* RSABridgeCall(char* name, void* payload, int payloadSize);
84+
85+
#ifdef __cplusplus
86+
}
87+
#endif

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-fast-rsa",
3-
"version": "2.4.2",
3+
"version": "2.4.3",
44
"description": "library for use RSA",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",

react-native-fast-rsa.podspec

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ require "json"
22

33
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
44
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5-
shared_lib = File.join(__dir__, "ios/librsa_bridge.a").gsub(/ /, '\ ')
65

76
Pod::Spec.new do |s|
87
s.name = package["name"]
@@ -16,10 +15,8 @@ Pod::Spec.new do |s|
1615
s.source = { :git => "https://github.com/jerson/react-native-fast-rsa.git", :tag => "#{s.version}" }
1716

1817
s.source_files = "ios/**/*.{h,m,mm}", "cpp/**/*.{hpp,cpp,c,h}"
19-
s.vendored_libraries = '*.a'
20-
s.xcconfig = { 'OTHER_LDFLAGS' => "-force_load '#{shared_lib}'"}
21-
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
22-
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
18+
s.vendored_framework = 'ios/Rsa.xcframework'
19+
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
2320

2421
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
2522
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.

scripts/upgrade_bridge_libs.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
REPO="jerson/rsa-mobile"
1111
NAME="librsa_bridge"
12-
PLATFORMS=("android" "ios" )
12+
PLATFORMS=("android" "ios_xcframework" )
1313
OUTPUT_DIRS=("android/src/main" "ios")
1414
OUTPUT_SUB_DIRS=("" "")
1515
OUTPUT_STRIP_DIRS=(1 1)
@@ -42,12 +42,12 @@ do
4242
OUTPUT_STRIP_DIR=${OUTPUT_STRIP_DIRS[$INDEX]}
4343

4444
FILE_NAME="${NAME}_${PLATFORM}_${VERSION}.tar.gz"
45-
TMP_FILE="$TMP_DIR/$FILE_NAME"
45+
TMP_FILE="$TMP_DIR/$FILE_NAME"
4646
FILE_URL="https://github.com/${REPO}/releases/download/${VERSION}/${FILE_NAME}"
4747

4848
echo "Platform: $PLATFORM"
4949
echo "Downloading: $FILE_URL to $TMP_FILE"
50-
curl -L -o $TMP_FILE "$FILE_URL"
50+
curl -L -o $TMP_FILE "$FILE_URL"
5151

5252
echo "Extracting: $TMP_FILE to $OUTPUT_DIR"
5353
mkdir -p $OUTPUT_DIR
@@ -60,4 +60,3 @@ do
6060
done
6161
#
6262
echo "All updated"
63-
rm ios/librsa_bridge.h || echo "."

0 commit comments

Comments
 (0)