Sha256: 7ece27d115499a59ad66ace667c26e2b804733d99c707d4e11f2cb883751e764

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

require 'shellwords'

require_relative '../module'
require_relative '../generators/build_command_generator'

module Gym
  class XcodebuildFixes
    class << self
      # 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
      # https://github.com/CocoaPods/CocoaPods/issues/4178
      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

      # Does this application have a WatchKit target
      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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fastlane_hotfix-2.165.1 gym/lib/gym/xcodebuild_fixes/generic_archive_fix.rb
fastlane_hotfix-2.165.0 gym/lib/gym/xcodebuild_fixes/generic_archive_fix.rb
fastlane_hotfix-2.187.0 gym/lib/gym/xcodebuild_fixes/generic_archive_fix.rb