tools/builder/Main.cs
author David Anderson <dvander@alliedmods.net>
Sat Sep 06 09:12:21 2008 +0000 (2008-09-06)
changeset 2256 de422b59bdfc
parent 1952 b7aa2b626807
child 2259 278850958494
permissions -rw-r--r--
Bootstrap performs all steps up to executing builer now.
Builder sends error code on failure now.
     1 using System;
     2 using System.IO;
     3 using System.Diagnostics;
     4 
     5 namespace builder
     6 {
     7 	class Program
     8 	{
     9 		static void Main(string[] args)
    10 		{
    11 			if (args.GetLength(0) < 1)
    12 			{
    13 				System.Console.WriteLine("Usage: <config file>");
    14 				return;
    15 			}
    16 
    17 			Config cfg = new Config();
    18 			if (!cfg.ReadFromFile(args[0]))
    19 			{
    20 				return;
    21 			}
    22 
    23 			/* :TODO: Add path validation */
    24 
    25 			ABuilder bld = null;
    26 			
    27 			if (cfg.Platform == BasePlatform.Platform_Linux)
    28 			{
    29 				bld = new LinuxBuilder(cfg);
    30 			} 
    31 			else if (cfg.Platform == BasePlatform.Platform_Windows)
    32 			{
    33 				bld = new Win32Builder(cfg);
    34 				if (cfg.pdb_log_file != null && File.Exists(cfg.pdb_log_file))
    35 				{
    36 					File.Delete(cfg.pdb_log_file);
    37 				}
    38 			}
    39 
    40 			try
    41 			{
    42 				bld.BuildPackage(new PkgCore());
    43 			} 
    44 			catch (System.Exception e) 
    45 			{
    46 				Console.WriteLine("Build failed: " + e.Message);
    47                 Environment.Exit(1);
    48 			}
    49 		}
    50 	}
    51 }