From 19e9bddef328d5480185aa7add3285b40feb19ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Thu, 31 Oct 2013 17:50:47 +0100 Subject: [PATCH] [profiler] Pass arguments to app on launch. --- lib/motion/project/template/ios.rb | 4 ++-- lib/motion/project/template/osx.rb | 3 +-- lib/motion/project/xcode_config.rb | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/motion/project/template/ios.rb b/lib/motion/project/template/ios.rb index 99219133..becac557 100644 --- a/lib/motion/project/template/ios.rb +++ b/lib/motion/project/template/ios.rb @@ -212,7 +212,7 @@ end namespace :profile do desc "Run a build on the simulator through Instruments" task :simulator => 'build:simulator' do - plist = App.config.profiler_config_plist('iPhoneSimulator') + plist = App.config.profiler_config_plist('iPhoneSimulator', ENV['args']) plist['com.apple.xcode.simulatedDeviceFamily'] = App.config.device_family_ints.first plist['com.apple.xcode.SDKPath'] = App.config.sdk('iPhoneSimulator') plist['optionalData']['launchOptions']['architectureType'] = 0 @@ -231,7 +231,7 @@ namespace :profile do App.fail 'Unable to determine remote app path' end - plist = App.config.profiler_config_plist('iPhoneOS') + plist = App.config.profiler_config_plist('iPhoneOS', ENV['args']) plist['absolutePathOfLaunchable'] = File.join($deployed_app_path, App.config.bundle_name) plist['deviceIdentifier'] = (ENV['id'] or App.config.device_id) plist['environmentEntries'] = {} diff --git a/lib/motion/project/template/osx.rb b/lib/motion/project/template/osx.rb index 3be951a6..f6769efc 100644 --- a/lib/motion/project/template/osx.rb +++ b/lib/motion/project/template/osx.rb @@ -98,7 +98,6 @@ end # TODO change to singular build task for development and release. desc "Run a build on the simulator through Instruments" task :profile => 'build:development' do - plist = App.config.profiler_config_plist('MacOSX') - plist['argumentEntries'] = '-NSDocumentRevisionsDebugMode YES' # Xcode default + plist = App.config.profiler_config_plist('MacOSX', "-NSDocumentRevisionsDebugMode YES #{ENV['args']}") App.profile('MacOSX', plist) end diff --git a/lib/motion/project/xcode_config.rb b/lib/motion/project/xcode_config.rb index c2ed2aee..d54704a8 100644 --- a/lib/motion/project/xcode_config.rb +++ b/lib/motion/project/xcode_config.rb @@ -278,14 +278,14 @@ EOS end # TODO - # * add launch args and env vars from user + # * add env vars from user # * add optional Instruments template to use? - def profiler_config_plist(platform) + def profiler_config_plist(platform, args) working_dir = File.expand_path(versionized_build_dir(platform)) { 'CFBundleIdentifier' => identifier, 'absolutePathOfLaunchable' => File.expand_path(app_bundle_executable(platform)), - 'argumentEntries' => '', + 'argumentEntries' => (args or ''), 'workingDirectory' => working_dir, 'workspacePath' => '', # Normally: /path/to/Project.xcodeproj/project.xcworkspace 'environmentEntries' => {