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

BuildVariables.gen.cs « MonoDevelop.Core « core « src « main - github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4dc0f828253cf463bca5061d775bd5a08f3843e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
using System.IO;
using System.Linq;

namespace Application
{
	public class GenVersion
	{
		public static void Main (string[] args)
		{
			var dir = args [0];
			var lines = File.ReadAllLines (Path.Combine (dir, "..", "..", "..", "..", "version.config"));
			var txt = File.ReadAllText (Path.Combine (dir, "BuildVariables.cs.in"));
			txt = txt.Replace ("@PACKAGE_VERSION@", GetValue (lines, "Version"));
			txt = txt.Replace ("@PACKAGE_VERSION_LABEL@", GetValue (lines, "Label"));
			txt = txt.Replace ("@COMPAT_ADDIN_VERSION@", GetValue (lines, "CompatVersion"));
			File.WriteAllText (Path.Combine (dir, "BuildVariables.cs"), txt);
		}

		static string GetValue (string[] lines, string key)
		{
			var val = lines.First (li => li.StartsWith (key + "="));
			return val.Substring (key.Length + 1);
		}
	}
}