Skip to content

Commit 8f0c179

Browse files
committed
Update crashlytics script
1 parent 4321f07 commit 8f0c179

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

editor/crashlytics/src/iOSPostBuild.cs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,30 @@ public class iOSPostBuild {
4747

4848
// In Unity 2019.3 - PODS_ROOT is no longer an environment variable that is exposed.
4949
// Use ${PROJECT_DIR}/Pods.
50-
private const string RunScriptBody = "chmod u+x \"${PROJECT_DIR}/Pods/FirebaseCrashlytics/run\"\n" +
51-
"chmod u+x \"${PROJECT_DIR}/Pods/FirebaseCrashlytics/upload-symbols\"\n" +
52-
"\"${PROJECT_DIR}/Pods/FirebaseCrashlytics/run\"";
50+
private const string RunScriptBody = @"
51+
# Define the path to the Cocoapods FirebaseCrashlytics 'run' script
52+
COCOAPODS_RUN_PATH=""${PROJECT_DIR}/Pods/FirebaseCrashlytics/run""
53+
54+
# Check if the file exists at the Cocoapods path
55+
if [ -f ""$COCOAPODS_RUN_PATH"" ]; then
56+
# --- File exists (Cocoapods integration) ---
57+
echo ""Running Firebase Crashlytics (Cocoapods)""
58+
59+
# Make scripts executable
60+
chmod u+x ""$COCOAPODS_RUN_PATH""
61+
chmod u+x ""${PROJECT_DIR}/Pods/FirebaseCrashlytics/upload-symbols""
62+
63+
# Run the script
64+
""$COCOAPODS_RUN_PATH"" -gsp ""${PROJECT_DIR}/GoogleService-Info.plist""
65+
66+
else
67+
# --- File does not exist (Swift Package Manager integration) ---
68+
echo ""Running Firebase Crashlytics (SPM)""
69+
70+
# Run the SPM script
71+
""${BUILD_DIR%/Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run"" -gsp ""${PROJECT_DIR}/GoogleService-Info.plist""
72+
fi
73+
";
5374

5475
private const string GooglePlistPath = "${PROJECT_DIR}/GoogleService-Info.plist";
5576

0 commit comments

Comments
 (0)