diff --git a/NEWS b/NEWS index d244a1fe..be1b17e3 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,17 @@ * Fixed a bug in REPL which often causes an error with "quit" command. * Fixed a bug which AVPlayer#currentTime causes `{?=qiIq}@:' not precompiled' error. + * Improved `rake spec' error message to include the details. Thanks to + Steven Webb for pull request #68. + * Improved `rake spec files=...' to make _spec suffix optional. Thanks to + Dave Lee for pull request #71. + * Fixed a bug where it caused a crash when use AudioQueueBuffer structure. + * Added :force_load option into configuration of `app.vendor_project'. There + are 3rd-party library which would trigger "duplicate symbol" error at + compile time. It will be useful in such libraries when specify false in + :force_load option (by default true). + EX) app.vendor_project('path/to/lib', :static, :force_load => false, ...) + * Added Dir#to_path method for CRuby compatibility. = RubyMotion 1.34 = diff --git a/lib/motion/project/builder.rb b/lib/motion/project/builder.rb index 8cdc675d..d424bba4 100644 --- a/lib/motion/project/builder.rb +++ b/lib/motion/project/builder.rb @@ -385,7 +385,12 @@ EOS framework_search_paths = config.framework_search_paths.map { |x| "-F#{File.expand_path(x)}" }.join(' ') frameworks = config.frameworks_dependencies.map { |x| "-framework #{x}" }.join(' ') weak_frameworks = config.weak_frameworks.map { |x| "-weak_framework #{x}" }.join(' ') - sh "#{cxx} -o \"#{main_exec}\" #{objs_list} #{config.ldflags(platform)} -L#{File.join(datadir, platform)} -lmacruby-static -lobjc -licucore #{framework_search_paths} #{frameworks} #{weak_frameworks} #{config.libs.join(' ')} #{vendor_libs.map { |x| '-force_load "' + x + '"' }.join(' ')}" + vendor_libs = config.vendor_projects.inject([]) do |libs, vendor_project| + libs << vendor_project.libs.map { |x| + (vendor_project.opts[:force_load] ? '-force_load ' : '-ObjC ') + "\"#{x}\"" + } + end.join(' ') + sh "#{cxx} -o \"#{main_exec}\" #{objs_list} #{config.ldflags(platform)} -L#{File.join(datadir, platform)} -lmacruby-static -lobjc -licucore #{framework_search_paths} #{frameworks} #{weak_frameworks} #{config.libs.join(' ')} #{vendor_libs}" main_exec_created = true end diff --git a/lib/motion/project/config.rb b/lib/motion/project/config.rb index d6d26ee8..b1adc390 100644 --- a/lib/motion/project/config.rb +++ b/lib/motion/project/config.rb @@ -291,6 +291,7 @@ EOS attr_reader :vendor_projects def vendor_project(path, type, opts={}) + opts[:force_load] = true unless opts[:force_load] == false @vendor_projects << Motion::Project::Vendor.new(path, type, self, opts) end @@ -379,7 +380,7 @@ EOS # Filter specs we want to run. A filter can be either the basename of a spec file or its path. files_filter = files_filter.split(',') files_filter.map! { |x| File.exist?(x) ? File.expand_path(x) : x } - specs.delete_if { |x| !files_filter.include?(File.expand_path(x)) and !files_filter.include?(File.basename(x, '.rb')) } + specs.delete_if { |x| [File.expand_path(x), File.basename(x, '.rb'), File.basename(x, '_spec.rb')].none? { |p| files_filter.include?(p) } } end core + helpers + specs end diff --git a/lib/motion/project/vendor.rb b/lib/motion/project/vendor.rb index f6887394..d7a70ae5 100644 --- a/lib/motion/project/vendor.rb +++ b/lib/motion/project/vendor.rb @@ -34,7 +34,7 @@ module Motion; module Project; @bs_files = [] end - attr_reader :path, :libs, :bs_files + attr_reader :path, :libs, :bs_files, :opts def build(platform) App.info 'Build', @path diff --git a/lib/motion/spec.rb b/lib/motion/spec.rb index d1f125be..44bb31ac 100644 --- a/lib/motion/spec.rb +++ b/lib/motion/spec.rb @@ -413,10 +413,10 @@ module Bacon @error = if e.kind_of? Error Counter[e.count_as] += 1 - e.count_as.to_s.upcase + "#{e.count_as.to_s.upcase} - #{e}" else Counter[:errors] += 1 - "ERROR: #{e.class}" + "ERROR: #{e.class} - #{e}" end end end diff --git a/test/test/spec/boxed_spec.rb b/test/test/spec/boxed_spec.rb new file mode 100644 index 00000000..c89da6f1 --- /dev/null +++ b/test/test/spec/boxed_spec.rb @@ -0,0 +1,5 @@ +describe "Boxed" do + it ".type should work with structure which has field of structure pointer" do + MyStructHasStructPointer.type.should == "{MyStructHasStructPointer=^{MyStruct4C}}" + end +end diff --git a/test/test/vendor/code/code.h b/test/test/vendor/code/code.h index 6e1e8a7a..c959dd08 100644 --- a/test/test/vendor/code/code.h +++ b/test/test/vendor/code/code.h @@ -4,6 +4,10 @@ struct MyStruct4C { char a, b, c, d; }; +struct MyStructHasStructPointer { + struct MyStruct4C *field; +}; + typedef id (^MyBlock)(void); @protocol TestProtocol diff --git a/vm b/vm index 650025de..ab28b648 160000 --- a/vm +++ b/vm @@ -1 +1 @@ -Subproject commit 650025de0abc8137b9c57fe142812f60d71eb84d +Subproject commit ab28b6483e70a25141716a48a0969068c6d5205a