1.1 --- a/tools/builder/ABuilder.cs Sun Oct 14 18:53:29 2007 +0000
1.2 +++ b/tools/builder/ABuilder.cs Sun Oct 14 18:55:49 2007 +0000
1.3 @@ -12,15 +12,13 @@
1.4 {
1.5 }
1.6
1.7 - public abstract string CompressPackage(Package pkg);
1.8 -
1.9 public abstract bool BuildLibrary(Package pkg, Library lib, ref string _binName, ref string _binPath);
1.10
1.11 public abstract string GetPawnCompilerName();
1.12
1.13 public bool CompilePlugin(Package pkg, Plugin pl)
1.14 {
1.15 - string local_dir = Config.PathFormat("{0}/{1}/addons/sourcemod/scripting", cfg.OutputBase, pkg.GetBaseFolder());
1.16 + string local_dir = Config.PathFormat("{0}/{1}/addons/sourcemod/scripting", cfg.pkg_path, pkg.GetBaseFolder());
1.17
1.18 string filepath = null;
1.19 if (pl.Folder != null)
1.20 @@ -48,7 +46,7 @@
1.21
1.22 Console.WriteLine(output);
1.23
1.24 - string binary = Config.PathFormat("{0}/{1}/addons/sourcemod/scripting/{2}.smx", cfg.OutputBase, pkg.GetBaseFolder(), pl.Source);
1.25 + string binary = Config.PathFormat("{0}/{1}/addons/sourcemod/scripting/{2}.smx", cfg.pkg_path, pkg.GetBaseFolder(), pl.Source);
1.26 if (!File.Exists(binary))
1.27 {
1.28 return false;
1.29 @@ -57,11 +55,11 @@
1.30 string new_loc;
1.31 if (pl.disabled)
1.32 {
1.33 - new_loc = Config.PathFormat("{0}/{1}/addons/sourcemod/plugins/disabled/{2}.smx", cfg.OutputBase, pkg.GetBaseFolder(), pl.Source);
1.34 + new_loc = Config.PathFormat("{0}/{1}/addons/sourcemod/plugins/disabled/{2}.smx", cfg.pkg_path, pkg.GetBaseFolder(), pl.Source);
1.35 }
1.36 else
1.37 {
1.38 - new_loc = Config.PathFormat("{0}/{1}/addons/sourcemod/plugins/{2}.smx", cfg.OutputBase, pkg.GetBaseFolder(), pl.Source);
1.39 + new_loc = Config.PathFormat("{0}/{1}/addons/sourcemod/plugins/{2}.smx", cfg.pkg_path, pkg.GetBaseFolder(), pl.Source);
1.40 }
1.41
1.42 try
1.43 @@ -81,51 +79,13 @@
1.44 return true;
1.45 }
1.46
1.47 - public string GetRevsionOfPath(string path)
1.48 - {
1.49 - ProcessStartInfo info = new ProcessStartInfo();
1.50 -
1.51 - info.WorkingDirectory = path;
1.52 - info.FileName = cfg.SVNVersion;
1.53 - info.Arguments = "--committed \"" + path + "\"";
1.54 - info.UseShellExecute = false;
1.55 - info.RedirectStandardOutput = true;
1.56 -
1.57 - Process p = Process.Start(info);
1.58 - string output = p.StandardOutput.ReadToEnd();
1.59 - p.WaitForExit();
1.60 - p.Close();
1.61 -
1.62 - string [] revs = output.Split(":".ToCharArray(), 2);
1.63 - if (revs.Length < 1)
1.64 - {
1.65 - return null;
1.66 - }
1.67 -
1.68 - string rev = null;
1.69 - if (revs.Length == 1)
1.70 - {
1.71 - rev = revs[0];
1.72 - }
1.73 - else
1.74 - {
1.75 - rev = revs[1];
1.76 - }
1.77 -
1.78 - rev = rev.Trim();
1.79 - rev = rev.Replace("M", "");
1.80 - rev = rev.Replace("S", "");
1.81 -
1.82 - return rev;
1.83 - }
1.84 -
1.85 public bool CopyFile(Package pkg, string source, string dest)
1.86 {
1.87 string from = Config.PathFormat("{0}/{1}",
1.88 - cfg.SourceBase,
1.89 + cfg.source_path,
1.90 source);
1.91 string to = Config.PathFormat("{0}/{1}/{2}",
1.92 - cfg.OutputBase,
1.93 + cfg.pkg_path,
1.94 pkg.GetBaseFolder(),
1.95 dest);
1.96
1.97 @@ -137,19 +97,19 @@
1.98 /** dest can be null to mean root base folder */
1.99 public void CopyFolder(Package pkg, string source, string dest, string [] omits)
1.100 {
1.101 - string from_base = Config.PathFormat("{0}/{1}", cfg.SourceBase, source);
1.102 + string from_base = Config.PathFormat("{0}/{1}", cfg.source_path, source);
1.103 string to_base = null;
1.104
1.105 if (dest == null)
1.106 {
1.107 to_base = Config.PathFormat("{0}/{1}",
1.108 - cfg.OutputBase,
1.109 + cfg.pkg_path,
1.110 pkg.GetBaseFolder());
1.111 }
1.112 else
1.113 {
1.114 to_base = Config.PathFormat("{0}/{1}/{2}",
1.115 - cfg.OutputBase,
1.116 + cfg.pkg_path,
1.117 pkg.GetBaseFolder(),
1.118 dest);
1.119 }
1.120 @@ -182,20 +142,9 @@
1.121 }
1.122 }
1.123
1.124 - public string PackageBuildName(Package pkg)
1.125 - {
1.126 - return pkg.GetPackageName()
1.127 - + "-r"
1.128 - + GetRevsionOfPath(cfg.SourceBase)
1.129 - + "-"
1.130 - + DateTime.Now.Year
1.131 - + DateTime.Now.Month.ToString("00")
1.132 - + DateTime.Now.Day.ToString("00");
1.133 - }
1.134 -
1.135 public void BuildPackage(Package pkg)
1.136 {
1.137 - string path = Config.PathFormat("{0}/{1}", cfg.OutputBase, pkg.GetBaseFolder());
1.138 + string path = Config.PathFormat("{0}/{1}", cfg.pkg_path, pkg.GetBaseFolder());
1.139
1.140 if (!Directory.Exists(path))
1.141 {
1.142 @@ -206,7 +155,7 @@
1.143 string [] paths = pkg.GetFolders();
1.144 for (int i=0; i<paths.GetLength(0); i++)
1.145 {
1.146 - path = Config.PathFormat("{0}/{1}/{2}", cfg.OutputBase, pkg.GetBaseFolder(), paths[i]);
1.147 + path = Config.PathFormat("{0}/{1}/{2}", cfg.pkg_path, pkg.GetBaseFolder(), paths[i]);
1.148 if (!Directory.Exists(path))
1.149 {
1.150 Directory.CreateDirectory(path);
1.151 @@ -225,15 +174,15 @@
1.152 if (BuildLibrary(pkg, libs[i], ref bin, ref binpath))
1.153 {
1.154 path = Config.PathFormat("{0}/{1}/{2}/{3}",
1.155 - cfg.OutputBase,
1.156 + cfg.pkg_path,
1.157 pkg.GetBaseFolder(),
1.158 - libs[i].Destination,
1.159 + libs[i].package_path,
1.160 bin);
1.161 File.Copy(binpath, path, true);
1.162 }
1.163 else
1.164 {
1.165 - throw new System.Exception("Failed to compile library: " + libs[i].Name);
1.166 + throw new System.Exception("Failed to compile library: " + libs[i].binary_name);
1.167 }
1.168 }
1.169
1.170 @@ -249,30 +198,6 @@
1.171 }
1.172 }
1.173 }
1.174 -
1.175 - string pkg_file = null;
1.176 - if (cfg.Compressor != null)
1.177 - {
1.178 - if ((pkg_file=CompressPackage(pkg)) == null)
1.179 - {
1.180 - throw new System.Exception("Failed to compress package: " + pkg.GetPackageName());
1.181 - }
1.182 -
1.183 - string lpath = null, ltarget = null;
1.184 - pkg.GetCompressBases(ref lpath, ref ltarget);
1.185 - lpath = Config.PathFormat("{0}/{1}/{2}",
1.186 - cfg.OutputBase,
1.187 - lpath,
1.188 - pkg_file);
1.189 - ltarget = Config.PathFormat("{0}/{1}", cfg.OutputBase, pkg_file);
1.190 -
1.191 - if (File.Exists(ltarget))
1.192 - {
1.193 - File.Delete(ltarget);
1.194 - }
1.195 -
1.196 - File.Move(lpath, ltarget);
1.197 - }
1.198 }
1.199 }
1.200 }