[profiler] Add tasks to list available instruments templates.

This commit is contained in:
Eloy Durán
2013-11-01 14:27:41 +01:00
parent f81235d07b
commit 40e9e8c2e1
2 changed files with 75 additions and 0 deletions

View File

@@ -193,6 +193,33 @@ namespace :profile do
App.profile('iPhoneSimulator', plist)
end
namespace :simulator do
desc 'List all built-in iOS Simulator Instruments templates'
task :templates do
list = `/usr/bin/xcrun instruments -s 2>&1`.strip.split("\n").map do |line|
line.sub(/^\s+"/, '').sub(/",*$/, '')
end
instruments_path = File.expand_path('../Applications/Instruments.app/Contents', App.config.xcode_dir)
regexp = Regexp.new(Regexp.escape(File.join(instruments_path, 'Resources/templates')))
templates_for_all_platforms = list.grep(regexp)
# TODO figure out if there is a way to programatically determine these.
templates_for_ios_sim_platform = [
File.join(instruments_path, "PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate"),
File.join(App.config.xcode_dir, "Platforms/MacOSX.platform/Developer/Library/Instruments/PlugIns/CoreData/Core Data.tracetemplate"),
]
templates = templates_for_all_platforms + templates_for_ios_sim_platform
puts "Built-in templates:"
templates.each do |template|
puts "* #{File.basename(template, File.extname(template))}"
end
end
end
desc "Run a build on the device through Instruments"
task :device do
# Create a build that allows debugging but doesnt start a debugger on deploy.
@@ -209,5 +236,31 @@ namespace :profile do
plist['deviceIdentifier'] = (ENV['id'] or App.config.device_id)
App.profile('iPhoneOS', plist)
end
namespace :device do
desc 'List all built-in iOS device Instruments templates'
task :templates do
list = `/usr/bin/xcrun instruments -s 2>&1`.strip.split("\n").map do |line|
line.sub(/^\s+"/, '').sub(/",*$/, '')
end
instruments_path = File.expand_path('../Applications/Instruments.app/Contents', App.config.xcode_dir)
regexp = Regexp.new(Regexp.escape(File.join(instruments_path, 'Resources/templates')))
templates_for_all_platforms = list.grep(regexp)
# TODO figure out if there is a way to programatically determine these.
templates_for_ios_sim_platform = [
File.join(instruments_path, "PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate"),
]
templates = templates_for_all_platforms + templates_for_ios_sim_platform
puts "Built-in templates:"
templates.each do |template|
puts "* #{File.basename(template, File.extname(template))}"
end
end
end
end

View File

@@ -103,6 +103,28 @@ namespace :profile do
App.profile('MacOSX', plist)
end
end
desc 'List all built-in OS X Instruments templates'
task :templates do
list = `/usr/bin/xcrun instruments -s 2>&1`.strip.split("\n").map do |line|
line.sub(/^\s+"/, '').sub(/",*$/, '')
end
instruments_path = File.expand_path('../Applications/Instruments.app/Contents', App.config.xcode_dir)
regexp = Regexp.new(Regexp.escape(File.join(instruments_path, 'Resources/templates')))
templates_for_all_platforms = list.grep(regexp)
regexp = Regexp.new(Regexp.escape(File.join(App.config.xcode_dir, 'Platforms/MacOSX.platform/Developer/Library/Instruments/PlugIns')))
templates_for_osx_platform = list.grep(regexp)
templates = templates_for_all_platforms + templates_for_osx_platform
puts "Built-in templates:"
templates.each do |template|
puts "* #{File.basename(template, File.extname(template))}"
end
end
end
desc 'Same as profile:development'