1
1
#! /bin/bash
2
2
3
- PATH_UNITY=" /Applications/Unity/Unity.app/Contents/MacOS/Unity"
3
+ PATH_UNITY=" /Applications/Unity/Hub/Editor/2021.3.26f1/ Unity.app/Contents/MacOS/Unity"
4
4
PATH_TO_UNITY_SDK_SAMPLE_APP=" ./"
5
5
BUILD_METHOD=" MobileBuilder.BuildForAltTester"
6
- APPLE_TEAM_ID=" "
6
+ APPLE_TEAM_ID=" 54XMLXPF98 "
7
7
8
8
# Define the build paths
9
9
BUILD_XCODE_PATH=" $( pwd) /build/output/iOS/Xcode"
10
10
BUILD_ARCHIVE_PATH=" $( pwd) /build/output/iOS/Archive"
11
11
BUILD_IPA_PATH=" $( pwd) /build/output/iOS/IPA"
12
+ DERIVED_DATA_PATH=" $( pwd) /build/output/iOS/DerivedData"
12
13
13
14
# Function to clear a directory
14
15
clear_directory () {
@@ -25,9 +26,15 @@ clear_directory() {
25
26
clear_directory " $BUILD_XCODE_PATH "
26
27
clear_directory " $BUILD_ARCHIVE_PATH "
27
28
clear_directory " $BUILD_IPA_PATH "
29
+ clear_directory " $DERIVED_DATA_PATH "
30
+
31
+ mkdir -p " $BUILD_XCODE_PATH "
32
+ mkdir -p " $BUILD_ARCHIVE_PATH "
33
+ mkdir -p " $BUILD_IPA_PATH "
34
+ mkdir -p " $DERIVED_DATA_PATH "
28
35
29
36
# Unity build command
30
- UNITY_COMMAND=" $PATH_UNITY -projectPath \" $PATH_TO_UNITY_SDK_SAMPLE_APP \" -executeMethod $BUILD_METHOD -logFile logFile.log -quit -batchmode --buildPath \" $BUILD_XCODE_PATH \" --platform iOS"
37
+ UNITY_COMMAND=" $PATH_UNITY -projectPath \" $PATH_TO_UNITY_SDK_SAMPLE_APP \" -executeMethod $BUILD_METHOD -logFile logFile.log -quit -batchmode --buildPath \" $BUILD_XCODE_PATH \" --platform iOS --bundleIdentifier com.immutable.Immutable-Sample-GameSDK "
31
38
echo " Running command: $UNITY_COMMAND "
32
39
33
40
# Execute the Unity build command
@@ -39,39 +46,56 @@ if [ $? -ne 0 ]; then
39
46
exit 1
40
47
fi
41
48
42
- # Build and archive project
43
- xcodebuild -project " $( pwd) /build/output/iOS/Xcode/Unity-iPhone.xcodeproj" \
49
+ echo " Building app..."
50
+ xcodebuild clean build \
51
+ -project " $( pwd) /build/output/iOS/Xcode/Unity-iPhone.xcodeproj" \
44
52
-scheme Unity-iPhone \
45
- -archivePath " $( pwd) /build/output/iOS/Archive/Unity-iPhone.xcarchive" \
46
- -configuration Release \
53
+ -destination " generic/platform=iOS" \
47
54
DEVELOPMENT_TEAM=" $APPLE_TEAM_ID " \
48
- CODE_SIGN_STYLE=Automatic \
49
- archive
50
-
51
- # Create ExportOptions.plist with the correct APPLE_TEAM_ID
52
- EXPORT_OPTIONS_PATH=" $( pwd) /build/output/iOS/Archive/ExportOptions.plist"
53
-
54
- cat << EOF > "$EXPORT_OPTIONS_PATH "
55
- <?xml version="1.0" encoding="UTF-8"?>
56
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
57
- <plist version="1.0">
58
- <dict>
59
- <key>method</key>
60
- <string>development</string> <!-- Use 'ad-hoc' or 'app-store' as needed -->
61
- <key>teamID</key>
62
- <string>$APPLE_TEAM_ID </string>
63
- <key>signingStyle</key>
64
- <string>automatic</string> <!-- Use automatic signing -->
65
- <key>compileBitcode</key>
66
- <false/>
67
- <key>thinning</key>
68
- <string><none></string>
69
- </dict>
70
- </plist>
71
- EOF
72
-
73
- # Generate .ipa file
74
- xcodebuild -exportArchive \
75
- -archivePath " $( pwd) /build/output/iOS/Archive/Unity-iPhone.xcarchive" \
76
- -exportPath " $( pwd) /build/output/iOS/IPA" \
77
- -exportOptionsPlist " $EXPORT_OPTIONS_PATH "
55
+ -allowProvisioningUpdates \
56
+ -derivedDataPath " $( pwd) /build/output/iOS/DerivedData"
57
+
58
+ mkdir -p " $( pwd) /build/output/iOS/IPA/Payload"
59
+
60
+ mv " $( pwd) /build/output/iOS/DerivedData/Build/Products/ReleaseForRunning-iphoneos/ImmutableSample.app" " $( pwd) /build/output/iOS/IPA/Payload"
61
+
62
+ pushd " $( pwd) /build/output/iOS/IPA" && zip -r Payload.zip Payload && popd
63
+
64
+ mv " $( pwd) /build/output/iOS/IPA/Payload.zip" " $( pwd) /Tests/Payload.ipa"
65
+
66
+ # # Build and archive project
67
+ # xcodebuild -project "$(pwd)/build/output/iOS/Xcode/Unity-iPhone.xcodeproj" \
68
+ # -scheme Unity-iPhone \
69
+ # -archivePath "$(pwd)/build/output/iOS/Archive/Unity-iPhone.xcarchive" \
70
+ # -configuration Release \
71
+ # DEVELOPMENT_TEAM="$APPLE_TEAM_ID" \
72
+ # CODE_SIGN_STYLE=Automatic \
73
+ # archive
74
+
75
+ # # Create ExportOptions.plist with the correct APPLE_TEAM_ID
76
+ # EXPORT_OPTIONS_PATH="$(pwd)/build/output/iOS/Archive/ExportOptions.plist"
77
+
78
+ # cat <<EOF > "$EXPORT_OPTIONS_PATH"
79
+ # <?xml version="1.0" encoding="UTF-8"?>
80
+ # <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
81
+ # <plist version="1.0">
82
+ # <dict>
83
+ # <key>method</key>
84
+ # <string>development</string> <!-- Use 'ad-hoc' or 'app-store' as needed -->
85
+ # <key>teamID</key>
86
+ # <string>$APPLE_TEAM_ID</string>
87
+ # <key>signingStyle</key>
88
+ # <string>automatic</string> <!-- Use automatic signing -->
89
+ # <key>compileBitcode</key>
90
+ # <false/>
91
+ # <key>thinning</key>
92
+ # <string><none></string>
93
+ # </dict>
94
+ # </plist>
95
+ # EOF
96
+
97
+ # # Generate .ipa file
98
+ # xcodebuild -exportArchive \
99
+ # -archivePath "$(pwd)/build/output/iOS/Archive/Unity-iPhone.xcarchive" \
100
+ # -exportPath "$(pwd)/build/output/iOS/IPA" \
101
+ # -exportOptionsPlist "$EXPORT_OPTIONS_PATH"
0 commit comments