Skip to content
Browse files

introduce 'spec:device' rake task to run the specs on the device, fix…

…ed 'static' rake task for iOS 6, fixed a bug in the last commit
  • Loading branch information...
1 parent 22d82ca commit be09e5fdda11d1c02fcefb05bf2916d2e6b0787f @lrz lrz committed Oct 8, 2012
Showing with 30 additions and 13 deletions.
  1. +16 −4 lib/motion/project.rb
  2. +5 −2 lib/motion/project/builder.rb
  3. +9 −7 lib/motion/project/config.rb
View
20 lib/motion/project.rb
@@ -116,10 +116,22 @@
end
end
-desc "Run the test/spec suite"
-task :spec do
- App.config.spec_mode = true
- Rake::Task["simulator"].invoke
+desc "Same as 'spec:simulator'"
+task :spec => ['spec:simulator']
+
+namespace :spec do
+ desc "Run the test/spec suite on the simulator"
+ task :simulator do
+ App.config.spec_mode = true
+ Rake::Task["simulator"].invoke
+ end
+
+ desc "Run the test/spec suite on the device"
+ task :device do
+ App.config.spec_mode = true
+ ENV['debug'] ||= '1'
+ Rake::Task["device"].invoke
+ end
end
desc "Deploy on the device"
View
7 lib/motion/project/builder.rb
@@ -234,9 +234,9 @@ def build(config, platform, opts)
# Create a static archive with all object files + the runtime.
lib = File.join(config.versionized_build_dir(platform), config.name + '.a')
App.info 'Create', lib
- cp File.join(datadir, platform, 'libmacruby-static.a'), lib
+ libmacruby = File.join(datadir, platform, 'libmacruby-static.a')
objs_list = objs.map { |path, _| path }.unshift(init_o, *config.frameworks_stubs_objects(platform)).map { |x| "\"#{x}\"" }.join(' ')
- sh "/usr/bin/ar -rcs \"#{lib}\" #{objs_list}"
+ sh "/usr/bin/libtool -static \"#{libmacruby}\" #{objs_list} -o \"#{lib}\""
return lib
end
@@ -289,6 +289,9 @@ def build(config, platform, opts)
}
}
+ // Load the UIAutomation framework.
+ dlopen("/Developer/Library/PrivateFrameworks/UIAutomation.framework/UIAutomation", RTLD_LOCAL);
+
SpecLauncher *launcher = [[self alloc] init];
[[NSNotificationCenter defaultCenter] addObserver:launcher selector:@selector(appLaunched:) name:UIApplicationDidBecomeActiveNotification object:nil];
return launcher;
View
16 lib/motion/project/config.rb
@@ -48,7 +48,7 @@ def relpath(path)
end
variable :files, :xcode_dir, :sdk_version, :deployment_target, :frameworks,
- :weak_frameworks, :libs, :delegate_class, :name, :build_dir,
+ :weak_frameworks, :framework_search_paths, :libs, :delegate_class, :name, :build_dir,
:resources_dir, :specs_dir, :identifier, :codesign_certificate,
:provisioning_profile, :device_family, :interface_orientations, :version,
:short_version, :icons, :prerendered_icon, :background_modes, :seed_id,
@@ -64,6 +64,7 @@ def initialize(project_dir, build_mode)
@dependencies = {}
@frameworks = ['UIKit', 'Foundation', 'CoreGraphics']
@weak_frameworks = []
+ @framework_search_paths = []
@libs = []
@delegate_class = 'AppDelegate'
@name = 'Untitled'
@@ -319,8 +320,10 @@ def frameworks_dependencies
end
deps << framework
end
- deps = deps.uniq.select { |dep| File.exist?(File.join(datadir, 'BridgeSupport', dep + '.bridgesupport')) }
- deps << 'UIAutomation' if spec_mode
+ deps.uniq!
+ if @framework_search_paths.empty?
+ deps = deps.select { |dep| File.exist?(File.join(datadir, 'BridgeSupport', dep + '.bridgesupport')) }
+ end
deps
end
end
@@ -347,6 +350,7 @@ def bridgesupport_files
end
end
end
+ deps << 'UIAutomation' if spec_mode
bs_files
end
end
@@ -444,9 +448,7 @@ def arch_flags(platform)
end
def common_flags(platform)
- cflags = "#{arch_flags(platform)} -isysroot \"#{sdk(platform)}\" -miphoneos-version-min=#{deployment_target} -F#{sdk(platform)}/System/Library/Frameworks"
- cflags << " -F#{sdk(platform)}/Developer/Library/PrivateFrameworks" if spec_mode # For UIAutomation
- cflags
+ "#{arch_flags(platform)} -isysroot \"#{sdk(platform)}\" -miphoneos-version-min=#{deployment_target} -F#{sdk(platform)}/System/Library/Frameworks"
end
def cflags(platform, cplusplus)
@@ -602,7 +604,7 @@ def info_plist_data
'UIStatusBarStyle' => status_bar_style_const,
'UIBackgroundModes' => background_modes_consts,
'DTXcode' => begin
- vers = xcode_version[0].sub(/\./, '')
+ vers = xcode_version[0].gsub(/\./, '')
if vers.length == 2
'0' + vers + '0'
else

0 comments on commit be09e5f

Please sign in to comment.
Something went wrong with that request. Please try again.