From 3c050441487fb09d082df386707f3ee47d85daae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Wed, 8 Oct 2014 19:06:52 +0200 Subject: [PATCH] [Vendor] Fail as early as possible. Otherwise we'd still generate BS metadata for no good reason. In addition this could make subsequent builds fail because the build dir would exist and seem up-to-date. --- lib/motion/project/vendor.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/motion/project/vendor.rb b/lib/motion/project/vendor.rb index 8719f3da..87245620 100644 --- a/lib/motion/project/vendor.rb +++ b/lib/motion/project/vendor.rb @@ -45,9 +45,6 @@ module Motion; module Project; Dir.chdir(@path) do send(gen_method('build'), platform) end - if @libs.empty? - App.fail "Building vendor project `#{@path}' failed to create at least one `.a' library." - end end def clean(platforms) @@ -140,6 +137,11 @@ EOS libs << libpath if File.exist?(libpath) end + @libs = libs.map { |x| File.expand_path(x) } + if @libs.empty? + App.fail "Building vendor project `#{@path}' failed to create at least one `.a' library." + end + headers = source_files.select { |p| File.extname(p) == '.h' } bs_files = [] unless headers.empty? @@ -152,8 +154,6 @@ EOS end bs_files << bs_file end - - @libs = libs.map { |x| File.expand_path(x) } @bs_files = bs_files.map { |x| File.expand_path(x) } end @@ -181,6 +181,11 @@ EOS `/usr/bin/touch \"#{build_dir}\"` end + @libs = Dir.glob("#{build_dir}/*.a").map { |x| File.expand_path(x) } + if @libs.empty? + App.fail "Building vendor project `#{@path}' failed to create at least one `.a' library." + end + # Generate the bridgesupport file if we need to. bs_file = bridgesupport_build_path(build_dir) headers_dir = @opts[:headers_dir] @@ -195,9 +200,7 @@ EOS @config.gen_bridge_metadata(platform, headers, bs_file, bs_cflags, bs_exceptions) end end - @bs_files = Dir.glob("#{build_dir}/*.bridgesupport").map { |x| File.expand_path(x) } - @libs = Dir.glob("#{build_dir}/*.a").map { |x| File.expand_path(x) } end private