diff --git a/NEWS b/NEWS index ee6ab160..c9c9972a 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ = RubyMotion 3.2 = + * [iOS] Fixed a bug where WatchKit applications did not honor `xcode_dir`. * [OSX] Fixed a bug where NSString#initWithXXX would trigger a crash by double free. diff --git a/lib/motion/project/builder.rb b/lib/motion/project/builder.rb index 754dad06..ee570d2e 100644 --- a/lib/motion/project/builder.rb +++ b/lib/motion/project/builder.rb @@ -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 diff --git a/lib/motion/project/template/ios-extension-builder.rb b/lib/motion/project/template/ios-extension-builder.rb index a01f745a..e0e04c90 100644 --- a/lib/motion/project/template/ios-extension-builder.rb +++ b/lib/motion/project/template/ios-extension-builder.rb @@ -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 diff --git a/lib/motion/project/template/ios-framework/builder.rb b/lib/motion/project/template/ios-framework/builder.rb index e89628b8..675a340a 100644 --- a/lib/motion/project/template/ios-framework/builder.rb +++ b/lib/motion/project/template/ios-framework/builder.rb @@ -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 diff --git a/lib/motion/project/template/ios-watch-extension-builder.rb b/lib/motion/project/template/ios-watch-extension-builder.rb index f75d2587..868a8a0d 100644 --- a/lib/motion/project/template/ios-watch-extension-builder.rb +++ b/lib/motion/project/template/ios-watch-extension-builder.rb @@ -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) diff --git a/lib/motion/project/template/ios-watch-extension-config.rb b/lib/motion/project/template/ios-watch-extension-config.rb index c1d079ae..0c0eb723 100644 --- a/lib/motion/project/template/ios-watch-extension-config.rb +++ b/lib/motion/project/template/ios-watch-extension-config.rb @@ -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 diff --git a/lib/motion/project/template/ios.rb b/lib/motion/project/template/ios.rb index adcb177f..80044e9c 100644 --- a/lib/motion/project/template/ios.rb +++ b/lib/motion/project/template/ios.rb @@ -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'] diff --git a/lib/motion/project/xcode_config.rb b/lib/motion/project/xcode_config.rb index 7dbc34d9..e7101a14 100644 --- a/lib/motion/project/xcode_config.rb +++ b/lib/motion/project/xcode_config.rb @@ -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(<