Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ gem 'builder'
gem 'multi_json'
gem 'plist'
gem 'rest-client'
gem 'xcpretty'

# Documentation
gem 'yard'
Expand Down
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# XCoder

## No Longer Maintained

Unfortuantely, I just don't have the time to maintain Xcoder, and given there are so many other tools that do bits and peices of what xcoder does, it doesnt feel as needed any more.

Perhaps parts of xcoder (keychain, profile management) could be extracted into stand-along tools - take a more unix-y approach to managing tools.

If anyone wants to more actively maintain Xcoder, please contact me.

## Description

Taking the pain out of scripting and automating xcode builds.
Expand Down
69 changes: 62 additions & 7 deletions lib/xcode/builder/base_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def profile= (value)
@profile = ProvisioningProfile.new(value)
end
end

def cocoapods_installed?
system("which pod > /dev/null 2>&1")
end
Expand All @@ -43,7 +43,7 @@ def dependencies
if has_dependencies? and cocoapods_installed?
print_task :builder, "Fetch depencies", :notice
podfile = File.join(File.dirname(@target.project.path), "Podfile")

print_task :cocoapods, "pod setup", :info
with_command('pod setup').execute

Expand All @@ -57,10 +57,10 @@ def prepare_xcodebuild sdk=@sdk #:yield: Xcode::Shell::Command

cmd.log_to_file = true
cmd.attach Xcode::Builder::XcodebuildParser.new

cmd.env["OBJROOT"] = "\"#{objroot}/\""
cmd.env["SYMROOT"] = "\"#{symroot}/\""

unless profile.nil?
profile.install
print_task "builder", "Using profile #{profile.install_path}", :debug
Expand All @@ -81,8 +81,8 @@ def prepare_xcodebuild sdk=@sdk #:yield: Xcode::Shell::Command

yield cmd if block_given?
end
end
end

def with_command command_line
cmd = Xcode::Shell::Command.new command_line
cmd.output_dir = objroot
Expand Down Expand Up @@ -124,6 +124,59 @@ def prepare_package_command
end
end

# Packaging doesn't come with SwiftSupport folder, so we need to copy them over.
def copy_swift_packages
swift_frameworks = Dir["#{app_path}/Frameworks/libswift*"]

unless swift_frameworks.empty?
Dir.mktmpdir do | tmpdir |
swift_support_path = File.join(tmpdir, "SwiftSupport")
Dir.mkdir(swift_support_path)

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

swift_frameworks.each do | path |
filename = File.basename(path)
toolchain_version = "#{xcode_path}/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/#{@sdk}/#{filename}"

FileUtils.cp(toolchain_version, swift_support_path, :verbose => true)
end

command = with_command 'zip' do |zip|
zip << "--recurse-paths \"#{ipa_path}\" \"SwiftSupport\""
end

#have to change the directory so we can just zip in the SwiftSupport folder
Dir.chdir(tmpdir) do
command.execute
end
end
end
end

# Credits to https://github.com/drewcrawford/cavejohnson for reverse-engineering the process
def prepare_dsym_itunesconnect
Dir.mktmpdir do | tmpdir |
symbol_path = File.join(tmpdir, "Symbols")
Dir.mkdir(symbol_path)

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

appbinary = File.join(app_path, "#{product_name}")
toolchain_symbol_path = File.join(xcode_path, "/usr/bin/symbols")

system "#{toolchain_symbol_path} -noTextInSOD -noDaemon -arch all -symbolsPackageDir \"#{symbol_path}\" \"#{appbinary}\""

zip_cmd = with_command 'zip' do |zip|
zip << "--recurse-paths \"#{ipa_path}\" \"Symbols\""
end

Dir.chdir(tmpdir) do
zip_cmd.execute
end
end
end

def prepare_dsym_command
# package dSYM
with_command 'zip' do |cmd|
Expand Down Expand Up @@ -246,6 +299,8 @@ def package options = {}, &block
print_task :package, "generating IPA: #{ipa_path}", :info
with_keychain do
prepare_package_command.execute
copy_swift_packages
prepare_dsym_itunesconnect
end

print_task :package, "creating dSYM zip: #{dsym_zip_path}", :info
Expand Down Expand Up @@ -308,7 +363,7 @@ def objroot
@objroot ||= build_path
end

def symroot
def symroot
@symroot ||= File.join(build_path, 'Products')
end

Expand Down
2 changes: 2 additions & 0 deletions lib/xcode/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,8 @@ def substitute(value)
case match
when "$(TARGET_NAME)"
@target.name
when "$(SRCROOT)"

else
raise "Unknown substitution variable #{match}"
end
Expand Down
74 changes: 74 additions & 0 deletions lib/xcode/deploy/hockeyapp.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
require 'rest-client'

module Xcode
module Deploy
class Hockeyapp
attr_accessor :app_id, :hockeyapp_token, :status, :notify, :proxy, :notes, :notes_type, :builder, :tags, :teams, :users
@@defaults = {}

def self.defaults(defaults={})
@@defaults = defaults
end

def initialize(builder, options={})
@builder = builder
@app_id = options[:app_id]||@@defaults[:app_id]
@hockeyapp_token = options[:hockeyapp_token]||@@defaults[:hockeyapp_token]
@status = options[:status]
@notify = options[:notify]
@notes = options[:notes]
@notes_type = options[:notes_type]
@tags = options[:tags]||[]
@teams = options[:teams]||[]
@users = options[:users]||[]
@proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
end

def deploy
puts "Uploading to HockeyApp..."

# RestClient.proxy = @proxy || ENV['http_proxy'] || ENV['HTTP_PROXY']
# RestClient.log = '/tmp/restclient.log'
#
# response = RestClient.post('http://testflightapp.com/api/builds.json',
# :file => File.new(builder.ipa_path),
# :dsym => File.new(builder.dsym_zip_path),
# :api_token => @api_token,
# :team_token => @team_token,
# :notes => @notes,
# :notify => @notify ? 'True' : 'False',
# :distribution_lists => @lists.join(',')
# )
#
# json = JSON.parse(response)
# puts " + Done, got: #{json.inspect}"
# json



cmd = Xcode::Shell::Command.new 'curl'
cmd << "--proxy #{@proxy}" unless @proxy.nil? or @proxy==''
cmd << "-X POST https://rink.hockeyapp.net/api/2/apps/#{@app_id}/app_versions/upload"
cmd << "-F ipa=@\"#{@builder.ipa_path}\""
cmd << "-F dsym=@\"#{@builder.dsym_zip_path}\"" unless @builder.dsym_zip_path.nil?
cmd << "-F notes=\"#{@notes}\"" unless @notes.nil?
cmd << "-F notify=\"#{@notify}\"" unless @notify.nil?
cmd << "-F status=\"#{@status}\"" unless @status.nil?
cmd << "-F notes_type=\"#{@notes_type}\"" unless @notes_type.nil?
cmd << "-F tags='#{@tags.join(',')}'" unless @tags.count==0
cmd << "-F teams='#{@teams.join(',')}'" unless @teams.count==0
cmd << "-F users='#{@users.join(',')}'" unless @users.count==0
cmd << "-H \"X-HockeyAppToken: #{@hockeyapp_token}\""

response = cmd.execute

json = MultiJson.load(response.join(''))
puts " + Done, got: #{json.inspect}"

yield(json) if block_given?

json
end
end
end
end
2 changes: 1 addition & 1 deletion lib/xcode/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Xcode
VERSION = "0.1.19"
VERSION = "0.1.24"
end
1 change: 1 addition & 0 deletions lib/xcoder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
require 'xcode/workspace'
require 'xcode/platform'
require 'multi_json'
require 'xcpretty'

module Xcode

Expand Down
53 changes: 53 additions & 0 deletions xcoder.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RUBY_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="RVM: ruby-2.0.0-p598" jdkType="RUBY_SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="aws-sdk (v1.60.2, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="aws-sdk-v1 (v1.60.2, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.2, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.7.6, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="celluloid (v0.16.0, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="coderay (v1.1.0, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="colorize (v0.7.5, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.5, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.9.6, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="formatador (v0.2.5, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="guard (v2.11.1, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="guard-compat (v1.2.0, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="guard-rspec (v4.5.0, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="hitimes (v1.2.2, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="json (v1.8.1, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="listen (v2.8.5, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="lumberjack (v1.0.9, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="method_source (v0.8.2, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mime-types (v2.4.3, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mini_portile (v0.6.2, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.10.1, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="nenv (v0.1.1, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="net-scp (v1.2.1, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="net-ssh (v2.9.1, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="netrc (v0.10.2, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.6.5, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="notiffany (v0.0.2, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="plist (v3.1.0, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="pry (v0.10.1, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rake (v10.4.2, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rb-fsevent (v0.9.4, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rb-inotify (v0.9.5, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="redcarpet (v3.2.2, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rest-client (v1.7.2, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.1.0, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.1.7, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.1.2, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.1.3, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.1.2, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="shellany (v0.0.1, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="slop (v3.6.0, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="thor (v0.19.1, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="timers (v4.0.1, RVM: ruby-2.0.0-p598) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="yard (v0.8.7.6, RVM: ruby-2.0.0-p598) [gem]" level="application" />
</component>
</module>