Sha256: 0c18511eddb20111790356489d812fba0622e3b835215970fbc5e2e0c644f04a

Contents?: true

Size: 1.44 KB

Versions: 226

Compression:

Stored size: 1.44 KB

Contents

module Gym
  class XcodebuildFixes
    class << self
      # Determine whether this app has WatchKit support and manually package up the WatchKit framework
      def watchkit_fix
        return unless should_apply_watchkit1_fix?

        UI.verbose "Adding WatchKit support"

        Dir.mktmpdir do |tmpdir|
          # Make watchkit support directory
          watchkit_support = File.join(tmpdir, "WatchKitSupport")
          Dir.mkdir(watchkit_support)

          # Copy WK from Xcode into WatchKitSupport
          FileUtils.copy_file("#{Xcode.xcode_path}/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/Library/Application Support/WatchKit/WK", File.join(watchkit_support, "WK"))

          # Add "WatchKitSupport" to the .ipa archive
          Dir.chdir(tmpdir) do
            abort unless system %(zip --recurse-paths "#{PackageCommandGenerator.ipa_path}" "WatchKitSupport" > /dev/null)
          end

          UI.verbose "Successfully added WatchKit support"
        end
      end

      # Does this application have a WatchKit target
      def watchkit?
        Dir["#{PackageCommandGenerator.appfile_path}/**/*.plist"].any? do |plist_path|
          `/usr/libexec/PlistBuddy -c 'Print WKWatchKitApp' '#{plist_path}' 2>&1`.strip == 'true'
        end
      end

      # Should only be applied if watchkit app is not a watchkit2 app
      def should_apply_watchkit1_fix?
        watchkit? && !Gym::XcodebuildFixes.watchkit2?
      end
    end
  end
end

Version data entries

226 entries across 226 versions & 2 rubygems

Version Path
fastlane-2.26.0.beta.20170404010022 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.25.0 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.25.0.beta.20170403010018 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.25.0.beta.20170402010035 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.25.0.beta.20170401010021 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.25.0.beta.20170331010039 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.25.0.beta.20170330225747 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.24.0 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.24.0.beta.20170330010023 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.24.0.beta.20170329010023 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.24.0.beta.20170328010037 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.24.0.beta.20170327010009 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.24.0.beta.20170326010023 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.24.0.beta.20170325010032 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.23.0 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.23.0.beta.20170322010036 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.22.0 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.22.0.beta.20170321010023 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.21.0 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb
fastlane-2.21.0.beta.20170320010043 gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb