[WatchKit] Honor xcode_dir setting from host app.

Fixes http://hipbyte.myjetbrains.com/youtrack/issue/RM-690
This commit is contained in:
Eloy Durán
2014-12-17 14:58:26 +01:00
parent 366483ccd8
commit f0f019ce47
8 changed files with 28 additions and 26 deletions

View File

@@ -356,7 +356,7 @@ EOS
ib_resources.each do |src, dest|
if !File.exist?(dest) or File.mtime(src) > File.mtime(dest)
App.info 'Compile', src
sh "/usr/bin/ibtool --compile \"#{dest}\" \"#{src}\""
sh "'#{File.join(config.xcode_dir, '/usr/bin/ibtool')}' --compile \"#{dest}\" \"#{src}\""
end
end
end

View File

@@ -83,7 +83,6 @@ PLIST
@host_app_dir = ENV['RM_TARGET_HOST_APP_PATH']
config.sdk_version = ENV['RM_TARGET_SDK_VERSION'] if ENV['RM_TARGET_SDK_VERSION']
config.deployment_target = ENV['RM_TARGET_DEPLOYMENT_TARGET'] if ENV['RM_TARGET_DEPLOYMENT_TARGET']
config.xcode_dir = ENV['RM_TARGET_XCODE_DIR'] if ENV['RM_TARGET_XCODE_DIR']
if ENV['RM_TARGET_ARCHS']
eval(ENV['RM_TARGET_ARCHS']).each do |platform, archs|
config.archs[platform] = archs.uniq
@@ -358,7 +357,7 @@ EOS
ib_resources.each do |src, dest|
if !File.exist?(dest) or File.mtime(src) > File.mtime(dest)
App.info 'Compile', relative_path(src)
sh "/usr/bin/ibtool --compile \"#{File.expand_path(dest)}\" \"#{File.expand_path(src)}\""
sh "'#{File.join(config.xcode_dir, '/usr/bin/ibtool')}' --compile \"#{File.expand_path(dest)}\" \"#{File.expand_path(src)}\""
end
end
end

View File

@@ -36,7 +36,6 @@ module Motion; module Project
@host_app_dir = ENV['RM_TARGET_HOST_APP_PATH']
config.sdk_version = ENV['RM_TARGET_SDK_VERSION'] if ENV['RM_TARGET_SDK_VERSION']
config.deployment_target = ENV['RM_TARGET_DEPLOYMENT_TARGET'] if ENV['RM_TARGET_DEPLOYMENT_TARGET']
config.xcode_dir = ENV['RM_TARGET_XCODE_DIR'] if ENV['RM_TARGET_XCODE_DIR']
if ENV['RM_TARGET_ARCHS']
eval(ENV['RM_TARGET_ARCHS']).each do |platform, archs|
config.archs[platform] = archs.uniq
@@ -259,7 +258,7 @@ EOS
ib_resources.each do |src, dest|
if !File.exist?(dest) or File.mtime(src) > File.mtime(dest)
App.info 'Compile', relative_path(src)
sh "/usr/bin/ibtool --compile \"#{dest}\" \"#{src}\""
sh "'#{File.join(config.xcode_dir, '/usr/bin/ibtool')}' --compile \"#{File.expand_path(dest)}\" \"#{File.expand_path(src)}\""
end
end
end

View File

@@ -35,7 +35,7 @@ module Motion; module Project
sh "/usr/bin/ditto -rsrc '#{source}' '#{destination}'"
# Compile storyboard
sh "/usr/bin/ibtool --errors --warnings --notices --module #{config.escaped_storyboard_module_name} --minimum-deployment-target #{config.sdk_version} --output-partial-info-plist /tmp/Interface-SBPartialInfo.plist --auto-activate-custom-fonts --output-format human-readable-text --compilation-directory '#{config.app_bundle(platform)}' watch_app/Interface.storyboard"
sh "'#{File.join(config.xcode_dir, '/usr/bin/ibtool')}' --errors --warnings --notices --module #{config.escaped_storyboard_module_name} --minimum-deployment-target #{config.sdk_version} --output-partial-info-plist /tmp/Interface-SBPartialInfo.plist --auto-activate-custom-fonts --output-format human-readable-text --compilation-directory '#{config.app_bundle(platform)}' watch_app/Interface.storyboard"
# Compile asset bundles
compile_asset_bundles(config, platform)

View File

@@ -137,9 +137,6 @@ EOS
@name = ENV['RM_TARGET_HOST_APP_NAME'] + ' Watch App'
end
# TODO How does one provide an icon for a Watch app?
# undef_method :app_icons_asset_bundle
def sdk_version
@extension_config.sdk_version
end

View File

@@ -99,7 +99,9 @@ namespace :watch do
app = App.config.app_bundle('iPhoneSimulator')
sim = File.join(App.config.bindir, 'watch-sim')
command = "'#{sim}' '#{app}' -verbose #{App::VERBOSE ? 'YES' : 'NO'} -start-suspended #{ENV['no_continue'] ? 'YES' : 'NO'}"
command = "'#{sim}' '#{app}' -developer-dir '#{App.config.xcode_dir}'"
command << " -verbose #{App::VERBOSE ? 'YES' : 'NO'}"
command << " -start-suspended #{ENV['no_continue'] ? 'YES' : 'NO'}"
command << " -display #{ENV['display']}" if ENV['display']
command << " -type #{ENV['type']}" if ENV['type']
command << " -notification-payload '#{ENV['payload']}'" if ENV['payload']

View File

@@ -56,15 +56,18 @@ module Motion; module Project;
def xcode_dir
@xcode_version = nil
@xcode_dir ||= begin
xcode_dot_app_path = '/Applications/Xcode.app/Contents/Developer'
if ENV['RM_TARGET_XCODE_DIR']
ENV['RM_TARGET_XCODE_DIR']
else
xcode_dot_app_path = '/Applications/Xcode.app/Contents/Developer'
# First, honor /usr/bin/xcode-select
xcodeselect = '/usr/bin/xcode-select'
if File.exist?(xcodeselect)
path = `#{xcodeselect} -print-path`.strip
if path.match(/^\/Developer\//) and File.exist?(xcode_dot_app_path)
@xcode_error_printed ||= false
$stderr.puts(<<EOS) unless @xcode_error_printed
# First, honor /usr/bin/xcode-select
xcodeselect = '/usr/bin/xcode-select'
if File.exist?(xcodeselect)
path = `#{xcodeselect} -print-path`.strip
if path.match(/^\/Developer\//) and File.exist?(xcode_dot_app_path)
@xcode_error_printed ||= false
$stderr.puts(<<EOS) unless @xcode_error_printed
===============================================================================
It appears that you have a version of Xcode installed in /Applications that has
not been set as the default version. It is possible that RubyMotion may be
@@ -74,16 +77,17 @@ To fix this problem, you can type the following command in the terminal:
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
===============================================================================
EOS
@xcode_error_printed = true
@xcode_error_printed = true
end
return path if File.exist?(path)
end
return path if File.exist?(path)
# Since xcode-select is borked, we assume the user installed Xcode
# as an app (new in Xcode 4.3).
return xcode_dot_app_path if File.exist?(xcode_dot_app_path)
App.fail "Can't locate any version of Xcode on the system."
end
# Since xcode-select is borked, we assume the user installed Xcode
# as an app (new in Xcode 4.3).
return xcode_dot_app_path if File.exist?(xcode_dot_app_path)
App.fail "Can't locate any version of Xcode on the system."
end
unescape_path(@xcode_dir)
end