Skip to content

Commit

Permalink
Catch Xcode 8.3 legacy API while patching Xcode PackageApplication sc…
Browse files Browse the repository at this point in the history
…ript (#8717)

* Add link to migration information for legacy build API

* Catch Xcode 8.3 legacy API while patching Xcode PackageApplication script

This will show an appropriate error message for Xcode 8.3 users that still have the legacy build API enabled. We want to migrate 100% of the users away from it, as it was now officially removed from Xcode
  • Loading branch information
KrauseFx committed Mar 30, 2017
1 parent 0fff3f4 commit 6ffd13f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
16 changes: 9 additions & 7 deletions gym/lib/gym/error_handler.rb
Expand Up @@ -104,6 +104,15 @@ def find_standard_output_path(output)
return File.join(m[1], 'IDEDistribution.standard.log') unless m.nil?
end

def raise_legacy_build_api_error(output)
UI.error("You enabled the legacy build API in _gym_")
UI.error("This option has been deprecated for about a year")
UI.error("and was removed with Xcode 8.3")
UI.error("Please update your Fastfile to include the export_type too")
UI.error("more information about how to migrate away: https://github.com/fastlane/fastlane/releases/tag/2.24.0")
UI.user_error!("Build failed. Please remove the `use_legacy_build_api` option in your Fastfile and try again", error_info: output)
end

private

def read_standard_output(output)
Expand Down Expand Up @@ -140,13 +149,6 @@ def print_xcode_version
title: "Build environment".yellow)
end

def raise_legacy_build_api_error(output)
UI.error("You enabled the legacy build API in _gym_")
UI.error("This option has been deprecated for about a year")
UI.error("and broke with one of the most recent Xcode releases")
UI.user_error!("Build failed. Please remove the `use_legacy_build_api` option in your Fastfile and try again", error_info: output)
end

def print_xcode_path_instructions
xcode_path = File.expand_path("../..", FastlaneCore::Helper.xcode_path)
default_xcode_path = "/Applications/"
Expand Down
4 changes: 4 additions & 0 deletions gym/lib/gym/xcodebuild_fixes/package_application_fix.rb
Expand Up @@ -20,6 +20,10 @@ def patch_package_application
# If that location changes, search it using xcrun --sdk iphoneos -f PackageApplication
package_application_path = "#{Xcode.xcode_path}/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication"

unless File.exist?(package_application_path)
ErrorHandler.raise_legacy_build_api_error("")
end

UI.crash!("Unable to patch the `PackageApplication` script bundled in Xcode. This is not supported.") unless expected_md5_hashes.include?(Digest::MD5.file(package_application_path).hexdigest)

# Duplicate PackageApplication script to PackageApplication4Gym
Expand Down

0 comments on commit 6ffd13f

Please sign in to comment.