@cetapod/react-native-smb 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +72 -0
- package/ReactNativeSmb.podspec +59 -0
- package/cpp/ios/OnLoad.mm +24 -0
- package/cpp/shared/HybridSMB.cpp +324 -0
- package/cpp/shared/HybridSMB.hpp +102 -0
- package/cpp/shared/ReactNativeSmb.hpp +428 -0
- package/cpp/shared/connection/ContextRequest.hpp +27 -0
- package/cpp/shared/connection/ContextRequestQueue.cpp +85 -0
- package/cpp/shared/connection/ContextRequestQueue.hpp +28 -0
- package/cpp/shared/connection/MetadataContextLease.hpp +33 -0
- package/cpp/shared/connection/PoolContextHandle.cpp +35 -0
- package/cpp/shared/connection/PoolContextHandle.hpp +44 -0
- package/cpp/shared/connection/PoolSlot.cpp +73 -0
- package/cpp/shared/connection/PoolSlot.hpp +46 -0
- package/cpp/shared/connection/PoolTypes.hpp +41 -0
- package/cpp/shared/connection/SmbConnection.cpp +385 -0
- package/cpp/shared/connection/SmbConnection.hpp +93 -0
- package/cpp/shared/connection/SmbConnectionPool.cpp +316 -0
- package/cpp/shared/connection/SmbConnectionPool.hpp +84 -0
- package/cpp/shared/core/CancellationToken.hpp +22 -0
- package/cpp/shared/core/OperatorContext.hpp +24 -0
- package/cpp/shared/core/SmbEnums.hpp +126 -0
- package/cpp/shared/core/SmbTask.cpp +131 -0
- package/cpp/shared/core/SmbTask.hpp +52 -0
- package/cpp/shared/core/SmbTaskCore.cpp +222 -0
- package/cpp/shared/core/SmbTaskCore.hpp +107 -0
- package/cpp/shared/core/SmbTypes.hpp +35 -0
- package/cpp/shared/core/TaskObserverHub.cpp +166 -0
- package/cpp/shared/core/TaskObserverHub.hpp +66 -0
- package/cpp/shared/core/TaskSnapshotCodec.cpp +32 -0
- package/cpp/shared/core/TaskSnapshotCodec.hpp +41 -0
- package/cpp/shared/io/SmbCopyTree.hpp +114 -0
- package/cpp/shared/io/SmbDirScan.hpp +80 -0
- package/cpp/shared/io/SmbFileIO.cpp +1355 -0
- package/cpp/shared/io/SmbFileIO.hpp +45 -0
- package/cpp/shared/io/SmbPathUtil.hpp +75 -0
- package/cpp/shared/io/SmbSecurity.cpp +308 -0
- package/cpp/shared/io/SmbSecurity.hpp +32 -0
- package/cpp/shared/io/SmbTreeOps.hpp +112 -0
- package/cpp/shared/operators/Operator.hpp +35 -0
- package/cpp/shared/operators/OperatorBase.cpp +57 -0
- package/cpp/shared/operators/OperatorBase.hpp +57 -0
- package/cpp/shared/operators/connection/ConnectOperator.cpp +19 -0
- package/cpp/shared/operators/connection/ConnectOperator.hpp +22 -0
- package/cpp/shared/operators/connection/ConnectShareOperator.cpp +19 -0
- package/cpp/shared/operators/connection/ConnectShareOperator.hpp +21 -0
- package/cpp/shared/operators/connection/DisconnectOperator.cpp +12 -0
- package/cpp/shared/operators/connection/DisconnectOperator.hpp +15 -0
- package/cpp/shared/operators/connection/InitializeOperator.cpp +12 -0
- package/cpp/shared/operators/connection/InitializeOperator.hpp +22 -0
- package/cpp/shared/operators/connection/ListSharesOperator.cpp +13 -0
- package/cpp/shared/operators/connection/ListSharesOperator.hpp +18 -0
- package/cpp/shared/operators/listing/GetPathInfoOperator.cpp +43 -0
- package/cpp/shared/operators/listing/GetPathInfoOperator.hpp +21 -0
- package/cpp/shared/operators/listing/GetSecurityDescriptorOperator.cpp +202 -0
- package/cpp/shared/operators/listing/GetSecurityDescriptorOperator.hpp +22 -0
- package/cpp/shared/operators/listing/ListDirectoryOperator.cpp +20 -0
- package/cpp/shared/operators/listing/ListDirectoryOperator.hpp +24 -0
- package/cpp/shared/operators/mutate/CopyItemOperator.cpp +19 -0
- package/cpp/shared/operators/mutate/CopyItemOperator.hpp +25 -0
- package/cpp/shared/operators/mutate/CreateDirectoryOperator.cpp +28 -0
- package/cpp/shared/operators/mutate/CreateDirectoryOperator.hpp +20 -0
- package/cpp/shared/operators/mutate/DeleteItemOperator.cpp +96 -0
- package/cpp/shared/operators/mutate/DeleteItemOperator.hpp +23 -0
- package/cpp/shared/operators/mutate/DuplicateItemOperator.cpp +48 -0
- package/cpp/shared/operators/mutate/DuplicateItemOperator.hpp +23 -0
- package/cpp/shared/operators/mutate/MoveItemOperator.cpp +32 -0
- package/cpp/shared/operators/mutate/MoveItemOperator.hpp +21 -0
- package/cpp/shared/operators/mutate/RenameItemOperator.cpp +37 -0
- package/cpp/shared/operators/mutate/RenameItemOperator.hpp +21 -0
- package/cpp/shared/operators/transfer/DownloadFileOperator.cpp +31 -0
- package/cpp/shared/operators/transfer/DownloadFileOperator.hpp +21 -0
- package/cpp/shared/operators/transfer/UploadFileOperator.cpp +27 -0
- package/cpp/shared/operators/transfer/UploadFileOperator.hpp +21 -0
- package/cpp/shared/util/SmbErrorMapper.hpp +229 -0
- package/cpp/shared/util/SmbLog.hpp +20 -0
- package/docs/API.md +105 -0
- package/docs/ARCHITECTURE.md +70 -0
- package/docs/TASK_MODEL.md +149 -0
- package/ios/include/smb2/libsmb2-dcerpc-lsa.h +172 -0
- package/ios/include/smb2/libsmb2-dcerpc-srvsvc.h +180 -0
- package/ios/include/smb2/libsmb2-dcerpc.h +155 -0
- package/ios/include/smb2/libsmb2-raw.h +497 -0
- package/ios/include/smb2/libsmb2.h +1384 -0
- package/ios/include/smb2/smb2-errors.h +549 -0
- package/ios/include/smb2/smb2.h +1251 -0
- package/ios/libs/device/libsmb2-device.a +0 -0
- package/ios/libs/libsmb2.xcframework/Info.plist +48 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64/Headers/smb2/libsmb2-dcerpc-lsa.h +172 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64/Headers/smb2/libsmb2-dcerpc-srvsvc.h +180 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64/Headers/smb2/libsmb2-dcerpc.h +155 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64/Headers/smb2/libsmb2-raw.h +497 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64/Headers/smb2/libsmb2.h +1384 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64/Headers/smb2/smb2-errors.h +549 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64/Headers/smb2/smb2.h +1251 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64/libsmb2.a +0 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64_x86_64-simulator/Headers/smb2/libsmb2-dcerpc-lsa.h +172 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64_x86_64-simulator/Headers/smb2/libsmb2-dcerpc-srvsvc.h +180 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64_x86_64-simulator/Headers/smb2/libsmb2-dcerpc.h +155 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64_x86_64-simulator/Headers/smb2/libsmb2-raw.h +497 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64_x86_64-simulator/Headers/smb2/libsmb2.h +1384 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64_x86_64-simulator/Headers/smb2/smb2-errors.h +549 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64_x86_64-simulator/Headers/smb2/smb2.h +1251 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64_x86_64-simulator/libsmb2.a +0 -0
- package/ios/libs/simulator/libsmb2-simulator.a +0 -0
- package/lib/ReactNativeSmb.d.ts +200 -0
- package/lib/ReactNativeSmb.js +1 -0
- package/lib/bridge/decode.d.ts +4 -0
- package/lib/bridge/decode.js +92 -0
- package/lib/core/SMB.d.ts +3 -0
- package/lib/core/SMB.js +4 -0
- package/lib/core/SmbClient.d.ts +35 -0
- package/lib/core/SmbClient.js +99 -0
- package/lib/core/SmbTask.d.ts +41 -0
- package/lib/core/SmbTask.js +74 -0
- package/lib/core/TransferStore.d.ts +22 -0
- package/lib/core/TransferStore.js +88 -0
- package/lib/core/ids.d.ts +1 -0
- package/lib/core/ids.js +3 -0
- package/lib/core/taskResult.d.ts +3 -0
- package/lib/core/taskResult.js +52 -0
- package/lib/hooks/useSubscribe.d.ts +20 -0
- package/lib/hooks/useSubscribe.js +36 -0
- package/lib/hooks/useTransfers.d.ts +7 -0
- package/lib/hooks/useTransfers.js +29 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +7 -0
- package/lib/labels.d.ts +6 -0
- package/lib/labels.js +71 -0
- package/lib/types.d.ts +141 -0
- package/lib/types.js +59 -0
- package/lib/utils.d.ts +79 -0
- package/lib/utils.js +153 -0
- package/package.json +63 -0
- package/scripts/build-libsmb2.sh +143 -0
- package/scripts/create-xcframework.sh +84 -0
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cetapod/react-native-smb",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A React Native Nitro module exposing libsmb2 C++ library for SMB client functionality",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"build:libsmb2": "chmod +x scripts/build-libsmb2.sh && scripts/build-libsmb2.sh",
|
|
10
|
+
"build:xcframework": "chmod +x scripts/create-xcframework.sh && scripts/create-xcframework.sh",
|
|
11
|
+
"build:ios": "npm run build:libsmb2 && npm run build:xcframework",
|
|
12
|
+
"build:full": "npm run build && npm run build:ios",
|
|
13
|
+
"prepare": "npm run build",
|
|
14
|
+
"prepack": "npm run build:full",
|
|
15
|
+
"postpack": "npm run clean:build",
|
|
16
|
+
"clean": "rm -rf lib",
|
|
17
|
+
"clean:build": "rm -rf ios/ && cd libsmb2 && rm -rf build/",
|
|
18
|
+
"setup:example": "npm run build:full && cd example && npm install",
|
|
19
|
+
"example": "npm run setup:example && cd example && npm run ios",
|
|
20
|
+
"example:prebuild": "npm run setup:example && cd example && npm run prebuild:ios"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/cetapod/react-native-smb.git"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"react-native",
|
|
28
|
+
"expo",
|
|
29
|
+
"nitro",
|
|
30
|
+
"native-module",
|
|
31
|
+
"smb",
|
|
32
|
+
"libsmb2",
|
|
33
|
+
"react-native-smb",
|
|
34
|
+
"@cetapod/react-native-smb"
|
|
35
|
+
],
|
|
36
|
+
"author": "Cetapod open source <open-source@cetapod.com>",
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public",
|
|
39
|
+
"registry": "https://registry.npmjs.org/"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"react": ">=19.0.0",
|
|
43
|
+
"react-native": ">=0.76.0",
|
|
44
|
+
"react-native-nitro-modules": ">=0.22.0 <1.0.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/react": "^19.1.1",
|
|
48
|
+
"react-native": "0.83.4",
|
|
49
|
+
"react-native-nitro-modules": "~0.31.9",
|
|
50
|
+
"typescript": "^5.0.0"
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"lib/",
|
|
54
|
+
"cpp/",
|
|
55
|
+
"ios/",
|
|
56
|
+
"android/",
|
|
57
|
+
"scripts/",
|
|
58
|
+
"docs/",
|
|
59
|
+
"ReactNativeSmb.podspec",
|
|
60
|
+
"README.md",
|
|
61
|
+
"LICENSE"
|
|
62
|
+
]
|
|
63
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# npm-friendly iOS libsmb2 build script
|
|
4
|
+
# Run from project root via: npm run build:libsmb2
|
|
5
|
+
# Creates separate device and simulator libraries
|
|
6
|
+
|
|
7
|
+
set -e
|
|
8
|
+
|
|
9
|
+
echo "📱 Building libsmb2 for iOS - @cetapod/react-native-smb"
|
|
10
|
+
|
|
11
|
+
# Check if we're in the correct directory (project root)
|
|
12
|
+
if [[ ! -d "libsmb2" ]] || [[ ! -f "libsmb2/CMakeLists.txt" ]]; then
|
|
13
|
+
echo "❌ Error: libsmb2 submodule not found or not in project root"
|
|
14
|
+
echo " Please run this script from the project root: npm run build:libsmb2"
|
|
15
|
+
exit 1
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# Get project root (current directory when run from npm script)
|
|
19
|
+
PROJECT_ROOT="$(pwd)"
|
|
20
|
+
|
|
21
|
+
# Change to libsmb2 directory for building
|
|
22
|
+
cd libsmb2
|
|
23
|
+
|
|
24
|
+
# Clean previous builds
|
|
25
|
+
echo "🧹 Cleaning previous builds..."
|
|
26
|
+
rm -rf build
|
|
27
|
+
rm -rf "${PROJECT_ROOT}/ios/libs"
|
|
28
|
+
|
|
29
|
+
# Create build structure
|
|
30
|
+
mkdir -p build
|
|
31
|
+
|
|
32
|
+
# Create output structure
|
|
33
|
+
mkdir -p "${PROJECT_ROOT}/ios/libs/device"
|
|
34
|
+
mkdir -p "${PROJECT_ROOT}/ios/libs/simulator"
|
|
35
|
+
|
|
36
|
+
# Get SDK paths and versions
|
|
37
|
+
DEVICE_SDK_PATH=$(xcrun --sdk iphoneos --show-sdk-path)
|
|
38
|
+
SIMULATOR_SDK_PATH=$(xcrun --sdk iphonesimulator --show-sdk-path)
|
|
39
|
+
MIN_IOS_VERSION="12.0"
|
|
40
|
+
|
|
41
|
+
echo "📱 Device SDK: $DEVICE_SDK_PATH"
|
|
42
|
+
echo "🖥️ Simulator SDK: $SIMULATOR_SDK_PATH"
|
|
43
|
+
echo "📱 Minimum iOS version: $MIN_IOS_VERSION"
|
|
44
|
+
|
|
45
|
+
# Function to build for a specific target
|
|
46
|
+
build_target() {
|
|
47
|
+
local target_name=$1
|
|
48
|
+
local build_dir=$2
|
|
49
|
+
local sdk_path=$3
|
|
50
|
+
local architectures=$4
|
|
51
|
+
local output_name=$5
|
|
52
|
+
local output_dir=$6
|
|
53
|
+
|
|
54
|
+
echo ""
|
|
55
|
+
echo "🔨 Building $target_name ($architectures)..."
|
|
56
|
+
|
|
57
|
+
mkdir -p "$build_dir"
|
|
58
|
+
cd "$build_dir"
|
|
59
|
+
|
|
60
|
+
# Configure with proper platform settings
|
|
61
|
+
cmake ../.. \
|
|
62
|
+
-DCMAKE_SYSTEM_NAME=iOS \
|
|
63
|
+
-DCMAKE_OSX_SYSROOT="$sdk_path" \
|
|
64
|
+
-DCMAKE_OSX_ARCHITECTURES="$architectures" \
|
|
65
|
+
-DCMAKE_OSX_DEPLOYMENT_TARGET="$MIN_IOS_VERSION" \
|
|
66
|
+
-DCMAKE_BUILD_TYPE=Release \
|
|
67
|
+
-DBUILD_SHARED_LIBS=OFF \
|
|
68
|
+
-DWITHOUT_LIBKRB5=ON \
|
|
69
|
+
-DENABLE_WERROR=OFF \
|
|
70
|
+
-DENABLE_EXAMPLES=OFF \
|
|
71
|
+
-DCMAKE_C_FLAGS="-fembed-bitcode=off"
|
|
72
|
+
|
|
73
|
+
# Use Apple config if available
|
|
74
|
+
if [[ -f "../../include/apple/config.h" ]]; then
|
|
75
|
+
echo "🍎 Using Apple-specific configuration..."
|
|
76
|
+
cp ../../include/apple/config.h .
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
# Build
|
|
80
|
+
make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)
|
|
81
|
+
|
|
82
|
+
# Copy to output location with proper naming
|
|
83
|
+
cp lib/libsmb2.a "${PROJECT_ROOT}/ios/libs/${output_dir}/${output_name}"
|
|
84
|
+
|
|
85
|
+
# Verify the platform
|
|
86
|
+
echo "🔍 Verifying $target_name platform:"
|
|
87
|
+
echo "Library info:"
|
|
88
|
+
file "${PROJECT_ROOT}/ios/libs/${output_dir}/${output_name}"
|
|
89
|
+
lipo -info "${PROJECT_ROOT}/ios/libs/${output_dir}/${output_name}"
|
|
90
|
+
|
|
91
|
+
# Check platform of object files
|
|
92
|
+
echo "Platform verification:"
|
|
93
|
+
ar -x "${PROJECT_ROOT}/ios/libs/${output_dir}/${output_name}" aes.c.o 2>/dev/null || echo "No aes.c.o found"
|
|
94
|
+
if [[ -f "aes.c.o" ]]; then
|
|
95
|
+
platform_info=$(otool -l aes.c.o | grep -A 3 "platform" | head -4)
|
|
96
|
+
echo "$platform_info"
|
|
97
|
+
rm -f aes.c.o
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
cd ../..
|
|
101
|
+
echo "✅ $target_name build completed"
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
echo ""
|
|
105
|
+
echo "=== Building iOS Device Library ==="
|
|
106
|
+
# Build iOS Device library (arm64 only) - Platform 2 = iOS
|
|
107
|
+
build_target "iOS Device" "build/ios-device" "$DEVICE_SDK_PATH" "arm64" "libsmb2-device.a" "device"
|
|
108
|
+
|
|
109
|
+
echo ""
|
|
110
|
+
echo "=== Building iOS Simulator Library ==="
|
|
111
|
+
# Build iOS Simulator library (x86_64 + arm64 for Apple Silicon) - Platform 7 = iOS Simulator
|
|
112
|
+
build_target "iOS Simulator" "build/ios-simulator" "$SIMULATOR_SDK_PATH" "x86_64;arm64" "libsmb2-simulator.a" "simulator"
|
|
113
|
+
|
|
114
|
+
# Copy headers to include directory
|
|
115
|
+
echo ""
|
|
116
|
+
echo "📄 Copying headers to include directory..."
|
|
117
|
+
mkdir -p "${PROJECT_ROOT}/ios/include"
|
|
118
|
+
cp -r include/smb2 "${PROJECT_ROOT}/ios/include/"
|
|
119
|
+
|
|
120
|
+
# Return to project root
|
|
121
|
+
cd "${PROJECT_ROOT}"
|
|
122
|
+
|
|
123
|
+
echo ""
|
|
124
|
+
echo "🔍 Final verification:"
|
|
125
|
+
echo ""
|
|
126
|
+
echo "Device library (iOS Physical Devices):"
|
|
127
|
+
file "ios/libs/device/libsmb2-device.a"
|
|
128
|
+
lipo -info "ios/libs/device/libsmb2-device.a"
|
|
129
|
+
|
|
130
|
+
echo ""
|
|
131
|
+
echo "Simulator library (iOS Simulator):"
|
|
132
|
+
file "ios/libs/simulator/libsmb2-simulator.a"
|
|
133
|
+
lipo -info "ios/libs/simulator/libsmb2-simulator.a"
|
|
134
|
+
|
|
135
|
+
echo ""
|
|
136
|
+
echo "🎉 Build completed successfully!"
|
|
137
|
+
echo ""
|
|
138
|
+
echo "📍 Libraries created:"
|
|
139
|
+
echo " Device: ios/libs/device/libsmb2-device.a"
|
|
140
|
+
echo " Simulator: ios/libs/simulator/libsmb2-simulator.a"
|
|
141
|
+
echo " Headers: ios/include/smb2/"
|
|
142
|
+
echo ""
|
|
143
|
+
echo "🚀 Ready to create XCFramework! Run: npm run build:xcframework"
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# npm-friendly XCFramework creation script
|
|
4
|
+
# Run from project root via: npm run build:xcframework
|
|
5
|
+
# Creates XCFramework with consistent binary names for @cetapod/react-native-smb
|
|
6
|
+
|
|
7
|
+
set -e
|
|
8
|
+
|
|
9
|
+
echo "🏗️ Creating XCFramework for @cetapod/react-native-smb..."
|
|
10
|
+
|
|
11
|
+
# Check if we're in the project root
|
|
12
|
+
if [[ ! -d "ios/libs" ]] || [[ ! -f "package.json" ]]; then
|
|
13
|
+
echo "❌ Error: Not in project root or ios/libs not found"
|
|
14
|
+
echo " Please run this script from the project root: npm run build:xcframework"
|
|
15
|
+
exit 1
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# Use current directory as project root
|
|
19
|
+
PROJECT_ROOT="$(pwd)"
|
|
20
|
+
|
|
21
|
+
# Check if the separate libraries exist
|
|
22
|
+
if [[ ! -f "ios/libs/device/libsmb2-device.a" ]]; then
|
|
23
|
+
echo "❌ Device library not found. Please run the build script first: npm run build:libsmb2"
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
if [[ ! -f "ios/libs/simulator/libsmb2-simulator.a" ]]; then
|
|
28
|
+
echo "❌ Simulator library not found. Please run the build script first: npm run build:libsmb2"
|
|
29
|
+
exit 1
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
# Create temporary directory with consistent naming
|
|
33
|
+
temp_dir=$(mktemp -d)
|
|
34
|
+
echo "🔧 Working in temporary directory: $temp_dir"
|
|
35
|
+
|
|
36
|
+
# Copy libraries with consistent names
|
|
37
|
+
cp "ios/libs/device/libsmb2-device.a" "$temp_dir/libsmb2.a"
|
|
38
|
+
device_lib="$temp_dir/libsmb2.a"
|
|
39
|
+
|
|
40
|
+
# Copy simulator library with consistent name
|
|
41
|
+
cp "ios/libs/simulator/libsmb2-simulator.a" "$temp_dir/libsmb2_sim.a"
|
|
42
|
+
simulator_lib="$temp_dir/libsmb2_sim.a"
|
|
43
|
+
|
|
44
|
+
# Clean and create output directory
|
|
45
|
+
rm -rf "ios/libs/libsmb2.xcframework"
|
|
46
|
+
mkdir -p "ios/libs"
|
|
47
|
+
|
|
48
|
+
echo "📦 Creating XCFramework with consistent binary names..."
|
|
49
|
+
|
|
50
|
+
# Create XCFramework using xcodebuild with renamed libraries
|
|
51
|
+
xcodebuild -create-xcframework \
|
|
52
|
+
-library "$device_lib" \
|
|
53
|
+
-headers "ios/include" \
|
|
54
|
+
-library "$simulator_lib" \
|
|
55
|
+
-headers "ios/include" \
|
|
56
|
+
-output "ios/libs/libsmb2.xcframework"
|
|
57
|
+
|
|
58
|
+
# Rename the simulator library inside the framework to match device library name
|
|
59
|
+
mv "ios/libs/libsmb2.xcframework/ios-arm64_x86_64-simulator/libsmb2_sim.a" \
|
|
60
|
+
"ios/libs/libsmb2.xcframework/ios-arm64_x86_64-simulator/libsmb2.a"
|
|
61
|
+
|
|
62
|
+
# Update the Info.plist to reflect the consistent binary name
|
|
63
|
+
sed -i '' 's/libsmb2_sim\.a/libsmb2.a/g' "ios/libs/libsmb2.xcframework/Info.plist"
|
|
64
|
+
|
|
65
|
+
# Clean up temp directory
|
|
66
|
+
rm -rf "$temp_dir"
|
|
67
|
+
|
|
68
|
+
echo "✅ XCFramework created successfully with consistent binary names!"
|
|
69
|
+
echo ""
|
|
70
|
+
echo "🔍 Verifying binary names:"
|
|
71
|
+
find "ios/libs/libsmb2.xcframework" -name "*.a" -exec basename {} \;
|
|
72
|
+
echo ""
|
|
73
|
+
echo "📁 XCFramework structure:"
|
|
74
|
+
find "ios/libs/libsmb2.xcframework" -type f | head -10
|
|
75
|
+
|
|
76
|
+
echo ""
|
|
77
|
+
echo "🎉 XCFramework ready at: ios/libs/libsmb2.xcframework"
|
|
78
|
+
echo ""
|
|
79
|
+
echo "All libraries now have the consistent name 'libsmb2.a'"
|
|
80
|
+
echo "This should resolve the CocoaPods installation error."
|
|
81
|
+
echo ""
|
|
82
|
+
echo "🚀 Next steps:"
|
|
83
|
+
echo "1. cd example && pod install"
|
|
84
|
+
echo "2. Build your Expo project"
|