mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-06-14 10:09:14 +08:00
introduce 'spec:device' rake task to run the specs on the device, fixed 'static' rake task for iOS 6, fixed a bug in the last commit
This commit is contained in:
@@ -116,10 +116,22 @@ namespace :archive do
|
||||
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"
|
||||
|
||||
@@ -234,9 +234,9 @@ EOS
|
||||
# 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 @@ EOS
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
@@ -48,7 +48,7 @@ module Motion; module Project
|
||||
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 @@ module Motion; module Project
|
||||
@dependencies = {}
|
||||
@frameworks = ['UIKit', 'Foundation', 'CoreGraphics']
|
||||
@weak_frameworks = []
|
||||
@framework_search_paths = []
|
||||
@libs = []
|
||||
@delegate_class = 'AppDelegate'
|
||||
@name = 'Untitled'
|
||||
@@ -319,8 +320,10 @@ EOS
|
||||
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 @@ EOS
|
||||
end
|
||||
end
|
||||
end
|
||||
deps << 'UIAutomation' if spec_mode
|
||||
bs_files
|
||||
end
|
||||
end
|
||||
@@ -444,9 +448,7 @@ EOS
|
||||
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 @@ EOS
|
||||
'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
|
||||
|
||||
Reference in New Issue
Block a user