Skip to content
This repository has been archived by the owner on Jun 20, 2021. It is now read-only.

Commit

Permalink
Merge pull request #258 from fikeminkel/master
Browse files Browse the repository at this point in the history
Adding WatchKitSupport folder to zipped .ipa for WatchKit apps
  • Loading branch information
mattt committed May 2, 2015
2 parents 6a97ac5 + f87d8e8 commit f5c6dfb
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions lib/shenzhen/commands/build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@

log "xcodebuild", (@workspace || @project)

xcode = `xcode-select --print-path`.strip

actions = []
actions << :clean unless options.clean == false
actions << :build
Expand All @@ -93,6 +95,7 @@
puts command if $verbose
abort unless system command


# Determine whether this is a Swift project and, eventually, the list of libraries to copy from
# Xcode's toolchain directory since there's no "xcodebuild" target to do just that (it is done
# post-build when exporting an archived build from the "Organizer").
Expand All @@ -106,8 +109,6 @@

Dir.mkdir(swift_support)

xcode = `xcode-select --print-path`.strip

@ipa_swift_frameworks.each do |path|
framework = File.basename(path)

Expand All @@ -121,6 +122,21 @@
end
end

log "Adding WatchKit support files", "#{xcode}/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/Library/Application Support/WatchKit/WK"
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}/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 "#{@ipa_path}" "WatchKitSupport" #{'> /dev/null' unless $verbose}}
end
end

log "zip", @dsym_filename
abort unless system %{cp -r "#{@dsym_path}" "#{@destination}" && pushd "#{File.dirname(@dsym_filename)}" && zip -r "#{@dsym_filename}.zip" "#{File.basename(@dsym_filename)}" #{'> /dev/null' unless $verbose} && popd && rm -rf "#{@dsym_filename}"}

Expand Down

0 comments on commit f5c6dfb

Please sign in to comment.