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:
authorLluis Sanchez <lluis@xamarin.com>2015-09-24 11:28:18 +0300
committerLluis Sanchez <lluis@xamarin.com>2015-09-24 11:29:03 +0300
commit4630560e9e2cf0e5d2af8ef604e2c9be07a62d10 (patch)
tree556d0457eee954dd38b5eb6b4723746321e28152 /scripts
parent651ab9a403f7f783069986c41e24091bf3719185 (diff)
Specifying SourceUrl in version.config is optional
Diffstat (limited to 'scripts')
-rw-r--r--scripts/configure.cs11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/configure.cs b/scripts/configure.cs
index 9f951b5c64..c34abb84e7 100644
--- a/scripts/configure.cs
+++ b/scripts/configure.cs
@@ -136,7 +136,7 @@ namespace MonoDevelop.Configuration
Version = SystemUtil.Grep(versionTxt, @"Version=(.*)");
ProductVersionText = SystemUtil.Grep(versionTxt, "Label=(.*)");
CompatVersion = SystemUtil.Grep(versionTxt, "CompatVersion=(.*)");
- SourceUrl = SystemUtil.Grep(versionTxt, "SourceUrl=(.*)");
+ SourceUrl = SystemUtil.Grep(versionTxt, "SourceUrl=(.*)", true);
Version ver = new Version(Version);
int vbuild = ver.Build != -1 ? ver.Build : 0;
@@ -270,12 +270,15 @@ namespace MonoDevelop.Configuration
public static Platform Platform { get; private set; }
- public static string Grep(string file, string regex)
+ public static string Grep(string file, string regex, bool optional = false)
{
string txt = File.ReadAllText(file);
var m = Regex.Match(txt, regex);
- if (m == null)
- throw new UserException("Match not found for regex: " + regex);
+ if (m == null || !m.Success) {
+ if (!optional)
+ throw new UserException ("Match not found for regex: " + regex);
+ return null;
+ }
if (m.Groups.Count != 2)
throw new UserException("Invalid regex: expression must have a single capture group: " + regex);
Group cap = m.Groups[1];