From 97d1660b340752a8b1ff6c0d25aab7b342df337e Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 14 Oct 2007 18:55:49 +0000 Subject: [PATCH] added real support for alternate building methods and orangebox packaging refactored a lot of variable names, yuck removed tons of legacy compressing/SVN code that's since handled by Perl --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401554 --- tools/builder/ABuilder.cs | 103 ++------------- tools/builder/Config.cs | 36 ++--- tools/builder/LinuxBuilder.cs | 71 ++++------ tools/builder/Package.cs | 37 ++++-- tools/builder/PkgCore.cs | 238 +++++++++++++++++++++------------- tools/builder/Win32Builder.cs | 79 +++++------ tools/builder/build-win32.cfg | 3 +- 7 files changed, 259 insertions(+), 308 deletions(-) diff --git a/tools/builder/ABuilder.cs b/tools/builder/ABuilder.cs index 562cc0ce..a4cea367 100644 --- a/tools/builder/ABuilder.cs +++ b/tools/builder/ABuilder.cs @@ -12,15 +12,13 @@ namespace builder { } - public abstract string CompressPackage(Package pkg); - public abstract bool BuildLibrary(Package pkg, Library lib, ref string _binName, ref string _binPath); public abstract string GetPawnCompilerName(); public bool CompilePlugin(Package pkg, Plugin pl) { - string local_dir = Config.PathFormat("{0}/{1}/addons/sourcemod/scripting", cfg.OutputBase, pkg.GetBaseFolder()); + string local_dir = Config.PathFormat("{0}/{1}/addons/sourcemod/scripting", cfg.pkg_path, pkg.GetBaseFolder()); string filepath = null; if (pl.Folder != null) @@ -48,7 +46,7 @@ namespace builder Console.WriteLine(output); - string binary = Config.PathFormat("{0}/{1}/addons/sourcemod/scripting/{2}.smx", cfg.OutputBase, pkg.GetBaseFolder(), pl.Source); + string binary = Config.PathFormat("{0}/{1}/addons/sourcemod/scripting/{2}.smx", cfg.pkg_path, pkg.GetBaseFolder(), pl.Source); if (!File.Exists(binary)) { return false; @@ -57,11 +55,11 @@ namespace builder string new_loc; if (pl.disabled) { - new_loc = Config.PathFormat("{0}/{1}/addons/sourcemod/plugins/disabled/{2}.smx", cfg.OutputBase, pkg.GetBaseFolder(), pl.Source); + new_loc = Config.PathFormat("{0}/{1}/addons/sourcemod/plugins/disabled/{2}.smx", cfg.pkg_path, pkg.GetBaseFolder(), pl.Source); } else { - new_loc = Config.PathFormat("{0}/{1}/addons/sourcemod/plugins/{2}.smx", cfg.OutputBase, pkg.GetBaseFolder(), pl.Source); + new_loc = Config.PathFormat("{0}/{1}/addons/sourcemod/plugins/{2}.smx", cfg.pkg_path, pkg.GetBaseFolder(), pl.Source); } try @@ -81,51 +79,13 @@ namespace builder return true; } - public string GetRevsionOfPath(string path) - { - ProcessStartInfo info = new ProcessStartInfo(); - - info.WorkingDirectory = path; - info.FileName = cfg.SVNVersion; - info.Arguments = "--committed \"" + path + "\""; - info.UseShellExecute = false; - info.RedirectStandardOutput = true; - - Process p = Process.Start(info); - string output = p.StandardOutput.ReadToEnd(); - p.WaitForExit(); - p.Close(); - - string [] revs = output.Split(":".ToCharArray(), 2); - if (revs.Length < 1) - { - return null; - } - - string rev = null; - if (revs.Length == 1) - { - rev = revs[0]; - } - else - { - rev = revs[1]; - } - - rev = rev.Trim(); - rev = rev.Replace("M", ""); - rev = rev.Replace("S", ""); - - return rev; - } - public bool CopyFile(Package pkg, string source, string dest) { string from = Config.PathFormat("{0}/{1}", - cfg.SourceBase, + cfg.source_path, source); string to = Config.PathFormat("{0}/{1}/{2}", - cfg.OutputBase, + cfg.pkg_path, pkg.GetBaseFolder(), dest); @@ -137,19 +97,19 @@ namespace builder /** dest can be null to mean root base folder */ public void CopyFolder(Package pkg, string source, string dest, string [] omits) { - string from_base = Config.PathFormat("{0}/{1}", cfg.SourceBase, source); + string from_base = Config.PathFormat("{0}/{1}", cfg.source_path, source); string to_base = null; if (dest == null) { to_base = Config.PathFormat("{0}/{1}", - cfg.OutputBase, + cfg.pkg_path, pkg.GetBaseFolder()); } else { to_base = Config.PathFormat("{0}/{1}/{2}", - cfg.OutputBase, + cfg.pkg_path, pkg.GetBaseFolder(), dest); } @@ -182,20 +142,9 @@ namespace builder } } - public string PackageBuildName(Package pkg) - { - return pkg.GetPackageName() - + "-r" - + GetRevsionOfPath(cfg.SourceBase) - + "-" - + DateTime.Now.Year - + DateTime.Now.Month.ToString("00") - + DateTime.Now.Day.ToString("00"); - } - public void BuildPackage(Package pkg) { - string path = Config.PathFormat("{0}/{1}", cfg.OutputBase, pkg.GetBaseFolder()); + string path = Config.PathFormat("{0}/{1}", cfg.pkg_path, pkg.GetBaseFolder()); if (!Directory.Exists(path)) { @@ -206,7 +155,7 @@ namespace builder string [] paths = pkg.GetFolders(); for (int i=0; i