Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan McGovern <alan@xamarin.com>2015-09-29 12:16:42 +0300
committerAlan McGovern <alan@xamarin.com>2015-09-29 12:26:56 +0300
commitc02b94d13a01504ccb98ba69d396ce8f83f4e27a (patch)
tree3985818ce7c4950a6eab66efc1ff65e3939fbad8 /dependency_checker.rb
parentcf2b55cb8f2ab9bf20040671c4280289fd4a1cac (diff)
[build] Properly error out when a dependency does not exist
We should print a message saying it's missing, not explode because we couldn't invoke the binary.
Diffstat (limited to 'dependency_checker.rb')
-rw-r--r--dependency_checker.rb38
1 files changed, 27 insertions, 11 deletions
diff --git a/dependency_checker.rb b/dependency_checker.rb
index cfc10b45f0..223a0321f9 100644
--- a/dependency_checker.rb
+++ b/dependency_checker.rb
@@ -1,5 +1,7 @@
require 'pp'
+NOT_INSTALLED_VERSION="-1"
+
XAMARIN_MAC_MIN_VERSION="2.3"
XAMARIN_MAC_VERSION=lambda { product_version ("/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/bin/mmp") }
XAMARIN_MAC_URL="http://www.xamarin.com"
@@ -20,25 +22,39 @@ def compare_version(first, second)
end
def mono_version(binary)
- actual_version = `#{binary} --version`
- # Extract the version number from a string like this:
- # `Mono JIT compiler version 4.2.0 (explicit/08b7103 Mon Aug 17 16:58:52 EDT 2015)`
- actual_version = actual_version.split('version ')[1]
- return actual_version.split(' ')[0]
+ if File.exist?("#{binary}")
+ actual_version = `#{binary} --version`
+ # Extract the version number from a string like this:
+ # `Mono JIT compiler version 4.2.0 (explicit/08b7103 Mon Aug 17 16:58:52 EDT 2015)`
+ actual_version = actual_version.split('version ')[1]
+ return actual_version.split(' ')[0]
+ else
+ return NOT_INSTALLED_VERSION
+ end
end
def product_version(binary)
- version = `#{binary} --version`
- return version.split(' ')[1]
+ if File.exist?("#{binary}")
+ version = `#{binary} --version`
+ return version.split(' ')[1]
+ else
+ return NOT_INSTALLED_VERSION
+ end
end
def check_product(product_min_version, product_version, product_url, product_name)
actual_version = product_version.call
- retval = compare_version(actual_version, product_min_version)
- if (retval < 0)
- puts ""
+ if (actual_version == NOT_INSTALLED_VERSION)
+ puts "You do not have #{product_name} installed.".red
+ retval = -1
+ else
puts "Your installed #{product_name} (#{actual_version}) is too old, please use #{product_min_version} or newer".red
+ retval = compare_version(actual_version, product_min_version)
+ end
+
+ if (retval < 0)
puts "You can download it from #{product_url}".red
+ puts
end
return retval
end
@@ -49,7 +65,7 @@ def check_monodevelop_dependencies()
check_product(XAMARIN_MAC_MIN_VERSION, XAMARIN_MAC_VERSION, XAMARIN_MAC_URL, "Xamarin.Mac")
]
if (result.min < 0)
- raise RuntimeError
+ exit 1
end
end