🤝 Merge pull request #99 from Instabug/hotfix/fix_link_script_if_condition

📝 Update script to add brackets to if condition as it did not get eva…
This commit is contained in:
salmatarzi 2017-12-05 11:43:06 +02:00 committed by GitHub
commit e79aa9eee2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 55 deletions

View File

@ -26,13 +26,13 @@ project = Xcodeproj::Project.open(project_location)
frameworks_group = project.groups.find { |group| group.display_name == 'Frameworks' } frameworks_group = project.groups.find { |group| group.display_name == 'Frameworks' }
frameworks_group ||= project.new_group('Frameworks') frameworks_group ||= project.new_group('Frameworks')
default_target = project.targets.find { |target| target.to_s == default_target_name } default_target = project.targets.find { |target| target.to_s == default_target_name }
targets = project.targets targets = project.targets.select { |target| (target.is_a? Xcodeproj::Project::Object::PBXNativeTarget) &&
(target.product_type == "com.apple.product-type.application") &&
(target.platform_name == :ios) }
framework_ref = frameworks_group.new_file("#{framework_root}/#{framework_name}") framework_ref = frameworks_group.new_file("#{framework_root}/#{framework_name}")
# Add Instabug to every target that is of type application # Add Instabug to every target that is of type application
targets.each do |target| targets.each do |target|
if target.is_a? Xcodeproj::Project::Object::PBXNativeTarget && (target.product_type == "com.apple.product-type.application") && (target.platform_name == :ios)
# Add new "Embed Frameworks" build phase to target # Add new "Embed Frameworks" build phase to target
embed_frameworks_build_phase = target.build_phases.find { |build_phase| build_phase.to_s == 'Embed Instabug Framework'} embed_frameworks_build_phase = target.build_phases.find { |build_phase| build_phase.to_s == 'Embed Instabug Framework'}
Kernel.exit(0) if embed_frameworks_build_phase Kernel.exit(0) if embed_frameworks_build_phase
@ -68,7 +68,6 @@ targets.each do |target|
#Add New Run Script Phase to Build Phases #Add New Run Script Phase to Build Phases
phase = target.new_shell_script_build_phase(INSTABUG_PHASE_NAME) phase = target.new_shell_script_build_phase(INSTABUG_PHASE_NAME)
phase.shell_script = INSTABUG_PHASE_SCRIPT phase.shell_script = INSTABUG_PHASE_SCRIPT
end
end end
# Save Xcode project # Save Xcode project

View File

@ -19,7 +19,9 @@ INSTABUG_PHASE_NAME = "Strip Frameworks"
# Get useful variables # Get useful variables
project = Xcodeproj::Project.open(project_location) project = Xcodeproj::Project.open(project_location)
frameworks_group = project.groups.find { |group| group.display_name == 'Frameworks' } frameworks_group = project.groups.find { |group| group.display_name == 'Frameworks' }
targets = project.targets targets = project.targets.select { |target| (target.is_a? Xcodeproj::Project::Object::PBXNativeTarget) &&
(target.product_type == "com.apple.product-type.application") &&
(target.platform_name == :ios) }
framework_ref = frameworks_group.files.find { |file_reference| file_reference.path == "#{framework_root}/#{framework_name}"} framework_ref = frameworks_group.files.find { |file_reference| file_reference.path == "#{framework_root}/#{framework_name}"}
# Remove Instabug's framework from the Frameworks group # Remove Instabug's framework from the Frameworks group
@ -27,8 +29,6 @@ frameworks_group.children.delete(framework_ref)
# Remove Instabug to every target that is of type application # Remove Instabug to every target that is of type application
targets.each do |target| targets.each do |target|
if target.is_a? Xcodeproj::Project::Object::PBXNativeTarget && (target.product_type == "com.apple.product-type.application") && (target.platform_name == :ios)
# Remove "Embed Frameworks" build phase to target # Remove "Embed Frameworks" build phase to target
embed_frameworks_build_phase = target.build_phases.find { |build_phase| build_phase.to_s == 'Embed Instabug Framework'} embed_frameworks_build_phase = target.build_phases.find { |build_phase| build_phase.to_s == 'Embed Instabug Framework'}
Kernel.exit(0) unless embed_frameworks_build_phase Kernel.exit(0) unless embed_frameworks_build_phase
@ -45,7 +45,6 @@ targets.each do |target|
#Delete New Run Script Phase from Build Phases #Delete New Run Script Phase from Build Phases
shell_script_build_phase = target.shell_script_build_phases.find { |build_phase| build_phase.to_s == INSTABUG_PHASE_NAME } shell_script_build_phase = target.shell_script_build_phases.find { |build_phase| build_phase.to_s == INSTABUG_PHASE_NAME }
target.build_phases.delete(shell_script_build_phase) target.build_phases.delete(shell_script_build_phase)
end
end end
# Save Xcode project # Save Xcode project