[profiler] Inherit ENV from parent process.

This commit is contained in:
Eloy Durán
2013-10-31 22:46:27 +01:00
parent 1f551327ea
commit ca1aee4a81
2 changed files with 15 additions and 12 deletions

View File

@@ -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

View File

@@ -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,