From 6c43a2807ca024659cfaf21efe78b24cb26b5c66 Mon Sep 17 00:00:00 2001 From: Watson Date: Thu, 4 Oct 2012 11:35:24 +0900 Subject: [PATCH] add framework_search_paths property --- NEWS | 2 ++ lib/motion/project/builder.rb | 3 ++- lib/motion/project/config.rb | 8 ++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index c9e01555..287539f8 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,8 @@ appropriate function if raise an Argument Error exception. * Fixed a bug which fails looking up method when call super from block in define_method. + * Added `app.framework_search_paths' to configure your app in Rakefile. + This property is used to search the custom framework paths. = RubyMotion 1.25 = diff --git a/lib/motion/project/builder.rb b/lib/motion/project/builder.rb index e697257f..edc77d36 100644 --- a/lib/motion/project/builder.rb +++ b/lib/motion/project/builder.rb @@ -370,9 +370,10 @@ EOS or File.mtime(File.join(datadir, platform, 'libmacruby-static.a')) > File.mtime(main_exec) App.info 'Link', main_exec objs_list = objs.map { |path, _| path }.unshift(init_o, main_o, *config.frameworks_stubs_objects(platform)).map { |x| "\"#{x}\"" }.join(' ') + 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 #{frameworks} #{weak_frameworks} #{config.libs.join(' ')} #{vendor_libs.map { |x| '-force_load "' + 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(' ')}" main_exec_created = true end diff --git a/lib/motion/project/config.rb b/lib/motion/project/config.rb index 105b1c9a..f4bc0461 100644 --- a/lib/motion/project/config.rb +++ b/lib/motion/project/config.rb @@ -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,7 +320,10 @@ EOS end deps << framework end - deps = deps.uniq.select { |dep| File.exist?(File.join(datadir, 'BridgeSupport', dep + '.bridgesupport')) } + deps.uniq! + if @framework_search_paths.empty? + deps.select! { |dep| File.exist?(File.join(datadir, 'BridgeSupport', dep + '.bridgesupport')) } + end deps << 'UIAutomation' if spec_mode deps end