Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fastlane.swift] fix Unexpected duplicate tasks error message in Fastlane Swift #21621

Merged
merged 1 commit into from Dec 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions fastlane/lib/fastlane/swift_runner_upgrader.rb
Expand Up @@ -232,16 +232,19 @@ def add_missing_flags!(dry_run: false)
# adds new copy files build phase to fastlane_runner_target
def add_missing_copy_phase!(dry_run: false)
# Check if upgrade is needed
# If fastlane copy files build phase exists already, we don't need any more changes to the Xcode project
phase_copy_sign = self.fastlane_runner_target.copy_files_build_phases.select { |phase_copy| phase_copy.name == "FastlaneRunnerCopySigned" }.first

old_phase_copy_sign = self.fastlane_runner_target.shell_script_build_phases.select { |phase_copy| phase_copy.shell_script == "cd \"${SRCROOT}\"\ncd ../..\ncp \"${TARGET_BUILD_DIR}/${EXECUTABLE_PATH}\" .\n" }.first
# Check if Copy Files build phase contains FastlaneRunner target.
phase_copy_sign = self.fastlane_runner_target.copy_files_build_phases.map(&:files).flatten.select { |file| file.display_name == "FastlaneRunner" }.first

# If fastlane copy files build phase exists already, we don't need any more changes to the Xcode project
phase_copy_sign = self.fastlane_runner_target.copy_files_build_phases.select { |phase_copy| phase_copy.name == "FastlaneRunnerCopySigned" }.first unless phase_copy_sign

return true if dry_run && phase_copy_sign.nil?

return false if dry_run

# Proceed to upgrade
old_phase_copy_sign = self.fastlane_runner_target.shell_script_build_phases.select { |phase_copy| phase_copy.shell_script == "cd \"${SRCROOT}\"\ncd ../..\ncp \"${TARGET_BUILD_DIR}/${EXECUTABLE_PATH}\" .\n" }.first
old_phase_copy_sign.remove_from_project unless old_phase_copy_sign.nil?

unless phase_copy_sign
Expand Down