forked from hltsenarslan/xcFrameworkConverter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuniversal.command
82 lines (65 loc) · 2.6 KB
/
universal.command
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
#!/bin/sh
#Created by Halit ŞENARSLAN
CURRENT_DIR="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
#--- Project Variables
PROJECT_ROOT_FOLDER="${CURRENT_DIR}"
PROJECT_NAME="[ProjectName]"
SCHEME="[SchemeToBuild]"
DERIVED_DATA="[DerivedDataFolder]"
#---
function createBuildDir() {
mkdir $CURRENT_DIR/build
}
function buildForIphone() {
echo "--Building For Device----------START-----------"
xcodebuild clean build \
-project $PROJECT_ROOT_FOLDER/$PROJECT_NAME.xcodeproj \
-scheme $SCHEME \
-configuration Release \
-sdk iphoneos \
-derivedDataPath $DERIVED_DATA \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
mkdir $CURRENT_DIR/build/devices
cp -r $DERIVED_DATA/Build/Products/Release-iphoneos/$SCHEME.framework $CURRENT_DIR/build/devices
echo "--Building For Device----------END-----------"
}
function buildForSimulator() {
echo "--Building For Simulator----------START-----------"
xcodebuild clean build \
-project $PROJECT_ROOT_FOLDER/$PROJECT_NAME.xcodeproj \
-scheme $SCHEME \
-configuration Release \
-sdk iphonesimulator \
-derivedDataPath $DERIVED_DATA \
EXCLUDED_ARCHS=arm64\
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
mkdir $CURRENT_DIR/build/simulator
cp -r $DERIVED_DATA/Build/Products/Release-iphonesimulator/$SCHEME.framework $CURRENT_DIR/build/simulator
#lipo -remove arm64 "$CURRENT_DIR/build/simulator/${PROJECT_NAME}.framework/$SCHEME" -output "$CURRENT_DIR/build/simulator/${PROJECT_NAME}.framework/$SCHEME"
echo "--Building For Simulator----------END-----------"
}
function createUniversalBaseDirectory() {
mkdir $CURRENT_DIR/build/universal
cp -r $CURRENT_DIR/build/devices/$SCHEME.framework $CURRENT_DIR/build/universal/
}
function createUniversalLibrary() {
lipo -create \
$CURRENT_DIR/build/simulator/$SCHEME.framework/$SCHEME \
$CURRENT_DIR/build/devices/$SCHEME.framework/$SCHEME \
-output $CURRENT_DIR/build/universal/$SCHEME.framework/$SCHEME
cp -r \
$CURRENT_DIR/build/simulator/$SCHEME.framework/Modules/$SCHEME.swiftmodule/* \
$CURRENT_DIR/build/universal/$SCHEME.framework/Modules/$SCHEME.swiftmodule/
xcrun xcodebuild -create-xcframework \
-framework $CURRENT_DIR/build/devices/$SCHEME.framework \
-framework $CURRENT_DIR/build/simulator/$SCHEME.framework \
-output $CURRENT_DIR/build/universal/${SCHEME}.xcframework
}
function executePipeline() {
createBuildDir
buildForIphone
buildForSimulator
createUniversalBaseDirectory
createUniversalLibrary
}
executePipeline