From 8bc831eb26530616eb0fd1411584b220063f031d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Thu, 31 Oct 2013 22:46:27 +0100 Subject: [PATCH] [profiler] Inherit ENV from parent process. --- lib/motion/project/template/ios.rb | 3 +-- lib/motion/project/xcode_config.rb | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/motion/project/template/ios.rb b/lib/motion/project/template/ios.rb index 3d561d30..8fc696d4 100644 --- a/lib/motion/project/template/ios.rb +++ b/lib/motion/project/template/ios.rb @@ -204,10 +204,9 @@ namespace :profile do App.fail 'Unable to determine remote app path' end - plist = App.config.profiler_config_plist('iPhoneOS', ENV['args']) + plist = App.config.profiler_config_plist('iPhoneOS', ENV['args'], false) plist['absolutePathOfLaunchable'] = File.join($deployed_app_path, App.config.bundle_name) plist['deviceIdentifier'] = (ENV['id'] or App.config.device_id) - plist['environmentEntries'] = {} App.profile('iPhoneOS', plist) end end diff --git a/lib/motion/project/xcode_config.rb b/lib/motion/project/xcode_config.rb index d54704a8..38da9551 100644 --- a/lib/motion/project/xcode_config.rb +++ b/lib/motion/project/xcode_config.rb @@ -278,23 +278,27 @@ EOS end # TODO - # * add env vars from user - # * add optional Instruments template to use? - def profiler_config_plist(platform, args) + # * Add env vars from user. + # * Add optional Instruments template to use. + def profiler_config_plist(platform, args, set_build_env = true) working_dir = File.expand_path(versionized_build_dir(platform)) + env = ENV.to_hash + if set_build_env + env.merge!({ + 'DYLD_FRAMEWORK_PATH' => working_dir, + 'DYLD_LIBRARY_PATH' => working_dir, + '__XCODE_BUILT_PRODUCTS_DIR_PATHS' => working_dir, + '__XPC_DYLD_FRAMEWORK_PATH' => working_dir, + '__XPC_DYLD_LIBRARY_PATH' => working_dir, + }) + end { 'CFBundleIdentifier' => identifier, 'absolutePathOfLaunchable' => File.expand_path(app_bundle_executable(platform)), 'argumentEntries' => (args or ''), 'workingDirectory' => working_dir, 'workspacePath' => '', # Normally: /path/to/Project.xcodeproj/project.xcworkspace - 'environmentEntries' => { - 'DYLD_FRAMEWORK_PATH' => working_dir, - 'DYLD_LIBRARY_PATH' => working_dir, - '__XCODE_BUILT_PRODUCTS_DIR_PATHS' => working_dir, - '__XPC_DYLD_FRAMEWORK_PATH' => working_dir, - '__XPC_DYLD_LIBRARY_PATH' => working_dir, - }, + 'environmentEntries' => env, 'optionalData' => { 'launchOptions' => { 'architectureType' => 1,