This repository has been archived by the owner on Nov 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-ios.sh
executable file
·66 lines (48 loc) · 2.87 KB
/
build-ios.sh
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
#!/bin/bash
#
# Builds the GiniBank.iOS.dll.
#
# Check the README for required preconditions.
#
# Uncomment for debugging (prints the executed commands)
# set -x
pushd GiniBank.iOS.Proxy
# clean build dir
rm -rf build/Release-fat
rm -rf build/Release-fat.lipo
rm -rf build/XamarinApiDef
# Init Fat Framework folder
cp -R build/Release-iphoneos build/Release-fat
cp -R build/Release-iphonesimulator/GiniBankProxy.framework/Modules/GiniBankProxy.swiftmodule build/Release-fat/GiniBankProxy.framework/Modules
# copy bundle res(swift packages issue)
cp -R build/Release-iphoneos/GiniBankSDK_GiniBankSDK.bundle build/Release-fat/GiniBankProxy.framework
cp -R build/Release-iphoneos/GiniCaptureSDK_GiniCaptureSDK.bundle build/Release-fat/GiniBankProxy.framework
# Create fat library
lipo -create build/Release-iphoneos/GiniBankProxy.framework/GiniBankProxy build/Release-iphonesimulator/GiniBankProxy.framework/GiniBankProxy -output build/Release-fat/GiniBankProxy.framework/GiniBankProxy
# Generate binding classes
sharpie bind --sdk=iphoneos --output="build/XamarinApiDef" --namespace="GiniBank.iOS" --scope=build/Release-fat/GiniBankProxy.framework/Headers build/Release-fat/GiniBankProxy.framework/Headers/GiniBankProxy-Swift.h -c -F build/Release-fat
# TODO: fix 3 erros on missed Foundations(No extensions and onboardingPages)
# Fix binding issues
# Remove this line
sed '/using GiniBankProxy;/d' build/XamarinApiDef/APIDefinitions.cs > build/XamarinApiDef/APIDefinitions.cs_new
mv build/XamarinApiDef/APIDefinitions.cs_new build/XamarinApiDef/APIDefinitions.cs
# Fix nint to long issue
sed 's/nint/long/g' build/XamarinApiDef/StructsAndEnums.cs > build/XamarinApiDef/StructsAndEnums.cs_new
mv build/XamarinApiDef/StructsAndEnums.cs_new build/XamarinApiDef/StructsAndEnums.cs
# Revert .NET 6 NativeHandle to previous IntPtr type so that it works with the bindings project (https://github.com/xamarin/xamarin-macios/issues/13087)
sed 's/NativeHandle/IntPtr/g' build/XamarinApiDef/APIDefinitions.cs > build/XamarinApiDef/APIDefinitions.cs_new
mv build/XamarinApiDef/APIDefinitions.cs_new build/XamarinApiDef/APIDefinitions.cs
# Copy to Bindings
cp build/XamarinApiDef/* ../GiniBank.iOS
# Build Bindings project
msbuild ../GiniBank.iOS/GiniBank.iOS.csproj -t:Clean
msbuild ../GiniBank.iOS/GiniBank.iOS.csproj
# This will fail
msbuild
# Fix Xamarin pointlessly adding I to protocol names, but not everywhere.
sed 's/IGiniCaptureProxyDelegate/GiniCaptureProxyDelegate/g' ../GiniBank.iOS/obj/Debug/ios/GiniBank.iOS/GiniCaptureProxyDelegate.g.cs > ../GiniBank.iOS/obj/Debug/ios/GiniBank.iOS/GiniCaptureProxyDelegate.g.cs_new
mv ../GiniBank.iOS/obj/Debug/ios/GiniBank.iOS/GiniCaptureProxyDelegate.g.cs_new ../GiniBank.iOS/obj/Debug/ios/GiniBank.iOS/GiniCaptureProxyDelegate.g.cs
# This should succeed
msbuild ../GiniBank.iOS/GiniBank.iOS.csproj
cp ../GiniBank.iOS/bin/Debug/GiniBank.iOS.dll ../ExampleiOSApp/GiniBank.iOS.dll
popd