Class: Gym::XcodebuildFixes

Inherits:
Object
  • Object
show all
Defined in:
gym/lib/gym/xcodebuild_fixes/generic_archive_fix.rb

Class Method Summary collapse

Class Method Details

.generic_archive_fixObject

Determine IPAs for the Watch App which aren’t inside of a containing iOS App and removes them.

In the future it may be nice to modify the plist file for the archive itself so that it points to the correct IPA as well.

This is a workaround for this bug github.com/CocoaPods/CocoaPods/issues/4178



17
18
19
20
21
22
23
24
25
26
# File 'gym/lib/gym/xcodebuild_fixes/generic_archive_fix.rb', line 17

def generic_archive_fix
  UI.verbose("Looking For Orphaned WatchKit2 Applications")

  Dir.glob("#{BuildCommandGenerator.archive_path}/Products/Applications/*.app").each do |app_path|
    if is_watchkit_app?(app_path)
      UI.verbose("Removing Orphaned WatchKit2 Application #{app_path}")
      FileUtils.rm_rf(app_path)
    end
  end
end

.is_watchkit_app?(app_path) ⇒ Boolean

Does this application have a WatchKit target

Returns:



29
30
31
32
# File 'gym/lib/gym/xcodebuild_fixes/generic_archive_fix.rb', line 29

def is_watchkit_app?(app_path)
  plist_path = "#{app_path}/Info.plist"
  `/usr/libexec/PlistBuddy -c 'Print :DTSDKName' #{plist_path.shellescape} 2>&1`.match(/^\s*watchos2\.\d+\s*$/) != nil
end