|
| 1 | +#!/usr/bin/env ruby |
| 2 | + |
| 3 | +# Copyright 2025 Google LLC |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +require 'xcodeproj' |
| 18 | + |
| 19 | +# This script patches the Crashlytics Quickstart's Xcode project to fix the |
| 20 | +# path to the `run` script for XCFramework-based builds. |
| 21 | +# |
| 22 | +# The default project assumes an SPM dependency and has a hardcoded path: |
| 23 | +# ${BUILD_DIR%Build/*}SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run |
| 24 | +# |
| 25 | +# This script changes it to the path used by the XCFramework distribution: |
| 26 | +# "${SRCROOT}/Firebase/FirebaseCrashlytics/run" |
| 27 | + |
| 28 | +project_path = 'quickstart-ios/crashlytics/CrashlyticsExample.xcodeproj' |
| 29 | +project = Xcodeproj::Project.open(project_path) |
| 30 | + |
| 31 | +project.targets.each do |target| |
| 32 | + target.build_phases.each do |phase| |
| 33 | + if phase.is_a?(Xcodeproj::Project::Object::PBXShellScriptBuildPhase) && phase.name == 'Run Script' |
| 34 | + if phase.shell_script.include?('SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run') |
| 35 | + puts "Patching Run Script phase in target: #{target.name}" |
| 36 | + phase.shell_script = '"${SRCROOT}/Firebase/FirebaseCrashlytics/run"' |
| 37 | + end |
| 38 | + end |
| 39 | + end |
| 40 | +end |
| 41 | + |
| 42 | +project.save |
0 commit comments