-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_xcframeworks.sh
More file actions
executable file
Β·113 lines (90 loc) Β· 3.98 KB
/
fix_xcframeworks.sh
File metadata and controls
executable file
Β·113 lines (90 loc) Β· 3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/bash
# fix_xcframeworks.sh
# Run this script after generating the xcframeworks to fix module compatibility issues
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
FRAMEWORKS_DIR="${SCRIPT_DIR}/TestConnectSDK"
echo "π§ Fixing xcframeworks in ${FRAMEWORKS_DIR}..."
# =============================================================================
# 1. Fix ConnectSdkFramework - Add modulemap and headers
# =============================================================================
fix_connect_sdk_framework() {
local XCFRAMEWORK="${FRAMEWORKS_DIR}/ConnectSdkFramework.xcframework"
if [ ! -d "$XCFRAMEWORK" ]; then
echo "β ConnectSdkFramework.xcframework not found"
return 1
fi
echo "π¦ Fixing ConnectSdkFramework.xcframework..."
# Find all slices (ios-arm64, ios-arm64_x86_64-simulator, etc.)
for SLICE_DIR in "$XCFRAMEWORK"/*/; do
local FRAMEWORK_DIR="${SLICE_DIR}ConnectSdkFramework.framework"
if [ ! -d "$FRAMEWORK_DIR" ]; then
continue
fi
echo " β Processing slice: $(basename "$SLICE_DIR")"
# Create Headers directory if it doesn't exist
mkdir -p "${FRAMEWORK_DIR}/Headers"
# Create umbrella header with Obj-C declarations for @objc Swift types
cat > "${FRAMEWORK_DIR}/Headers/ConnectSdkFramework.h" << 'HEADER_EOF'
#import <Foundation/Foundation.h>
//! Project version number for ConnectSdkFramework.
FOUNDATION_EXPORT double ConnectSdkFrameworkVersionNumber;
//! Project version string for ConnectSdkFramework.
FOUNDATION_EXPORT const unsigned char ConnectSdkFrameworkVersionString[];
@protocol NativeCommunicationDelegate <NSObject>
- (NSString * _Nullable)requestDataSync;
- (void)handleEventFromReactNative:(NSString * _Nonnull)data;
@end
@interface NativeCommunicationService : NSObject
@property (class, nonatomic, readonly, strong) NativeCommunicationService * _Nonnull shared;
@property (nonatomic, weak, nullable) id<NativeCommunicationDelegate> delegate;
- (NSString * _Nullable)requestDataSync;
- (void)handleEventFromReactNative:(NSString * _Nonnull)data;
- (void)sendEventToReactNative:(NSDictionary<NSString *, id> * _Nonnull)eventData;
- (void)sendEventWithType:(NSString * _Nonnull)type payload:(NSDictionary<NSString *, id> * _Nullable)payload;
@end
HEADER_EOF
# Create Modules directory if it doesn't exist
mkdir -p "${FRAMEWORK_DIR}/Modules"
# Create module.modulemap
cat > "${FRAMEWORK_DIR}/Modules/module.modulemap" << 'MODULEMAP_EOF'
framework module ConnectSdkFramework {
umbrella header "ConnectSdkFramework.h"
export *
module * { export * }
}
MODULEMAP_EOF
echo " β Added Headers and modulemap"
done
}
# =============================================================================
# 2. Fix hermes.xcframework - Rename to hermesvm.xcframework
# =============================================================================
fix_hermes_framework() {
local HERMES_XCFRAMEWORK="${FRAMEWORKS_DIR}/hermes.xcframework"
local HERMESVM_XCFRAMEWORK="${FRAMEWORKS_DIR}/hermesvm.xcframework"
if [ -d "$HERMESVM_XCFRAMEWORK" ]; then
echo "π¦ hermesvm.xcframework already exists, skipping rename"
return 0
fi
if [ ! -d "$HERMES_XCFRAMEWORK" ]; then
echo "β οΈ hermes.xcframework not found (might already be renamed)"
return 0
fi
echo "π¦ Renaming hermes.xcframework to hermesvm.xcframework..."
mv "$HERMES_XCFRAMEWORK" "$HERMESVM_XCFRAMEWORK"
echo " β Renamed successfully"
}
# =============================================================================
# Main
# =============================================================================
echo ""
fix_connect_sdk_framework
echo ""
fix_hermes_framework
echo ""
echo "β
XCFrameworks fixed successfully!"
echo ""
echo "Next steps:"
echo " 1. Run 'pod install' in your consuming project"
echo " 2. Build your project"