Spring Cleaning, Part Ichi (1)
Various minor things done to project files Updated sample extension project file and updated makefile to the new unified version (more changes likely on the way) Updated regex project file and makefile --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401971
This commit is contained in:
@@ -0,0 +1,199 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace builder
|
||||
{
|
||||
public abstract class ABuilder
|
||||
{
|
||||
public Config cfg;
|
||||
|
||||
public ABuilder()
|
||||
{
|
||||
}
|
||||
|
||||
public abstract bool BuildLibrary(Package pkg, Library lib);
|
||||
|
||||
public abstract string GetPawnCompilerName();
|
||||
|
||||
public bool CompilePlugin(Package pkg, Plugin pl)
|
||||
{
|
||||
string local_dir = Config.PathFormat("{0}/{1}/addons/sourcemod/scripting", cfg.pkg_path, pkg.GetBaseFolder());
|
||||
|
||||
string filepath = null;
|
||||
if (pl.Folder != null)
|
||||
{
|
||||
filepath = Config.PathFormat("{0}/{1}", pl.Folder, pl.Source);
|
||||
}
|
||||
else
|
||||
{
|
||||
filepath = pl.Source;
|
||||
}
|
||||
|
||||
ProcessStartInfo info = new ProcessStartInfo();
|
||||
info.WorkingDirectory = local_dir;
|
||||
info.FileName = Config.PathFormat("{0}/{1}", local_dir, GetPawnCompilerName());
|
||||
info.Arguments = filepath + ".sp";
|
||||
info.UseShellExecute = false;
|
||||
info.RedirectStandardOutput = true;
|
||||
info.RedirectStandardError = true;
|
||||
|
||||
Process p = Process.Start(info);
|
||||
string output = p.StandardOutput.ReadToEnd() + "\n";
|
||||
output += p.StandardError.ReadToEnd();
|
||||
p.WaitForExit();
|
||||
p.Close();
|
||||
|
||||
Console.WriteLine("Debug: wd = " + info.WorkingDirectory + " fn = " + info.FileName + " arg = " + info.Arguments);
|
||||
Console.WriteLine(output);
|
||||
|
||||
string binary = Config.PathFormat("{0}/{1}/addons/sourcemod/scripting/{2}.smx", cfg.pkg_path, pkg.GetBaseFolder(), pl.Source);
|
||||
if (!File.Exists(binary))
|
||||
{
|
||||
Console.WriteLine("Could not find binary: " + binary);
|
||||
return false;
|
||||
}
|
||||
|
||||
string new_loc;
|
||||
if (pl.disabled)
|
||||
{
|
||||
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.pkg_path, pkg.GetBaseFolder(), pl.Source);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (File.Exists(new_loc))
|
||||
{
|
||||
File.Delete(new_loc);
|
||||
}
|
||||
File.Move(binary, new_loc);
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CopyFile(Package pkg, string source, string dest)
|
||||
{
|
||||
string from = Config.PathFormat("{0}/{1}",
|
||||
cfg.source_path,
|
||||
source);
|
||||
string to = Config.PathFormat("{0}/{1}/{2}",
|
||||
cfg.pkg_path,
|
||||
pkg.GetBaseFolder(),
|
||||
dest);
|
||||
|
||||
File.Copy(from, to, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 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.source_path, source);
|
||||
string to_base = null;
|
||||
|
||||
if (dest == null)
|
||||
{
|
||||
to_base = Config.PathFormat("{0}/{1}",
|
||||
cfg.pkg_path,
|
||||
pkg.GetBaseFolder());
|
||||
}
|
||||
else
|
||||
{
|
||||
to_base = Config.PathFormat("{0}/{1}/{2}",
|
||||
cfg.pkg_path,
|
||||
pkg.GetBaseFolder(),
|
||||
dest);
|
||||
}
|
||||
|
||||
string [] files = Directory.GetFiles(from_base);
|
||||
string file;
|
||||
|
||||
for (int i=0; i<files.Length; i++)
|
||||
{
|
||||
file = Path.GetFileName(files[i]);
|
||||
|
||||
if (omits != null)
|
||||
{
|
||||
bool skip = false;
|
||||
for (int j=0; j<omits.Length; j++)
|
||||
{
|
||||
if (file.CompareTo(omits[j]) == 0)
|
||||
{
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (skip)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
dest = Config.PathFormat("{0}/{1}", to_base, file);
|
||||
File.Copy(files[i], dest, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void BuildPackage(Package pkg)
|
||||
{
|
||||
string path = Config.PathFormat("{0}/{1}", cfg.pkg_path, pkg.GetBaseFolder());
|
||||
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
|
||||
/* Create all dirs */
|
||||
string [] paths = pkg.GetFolders();
|
||||
for (int i=0; i<paths.GetLength(0); i++)
|
||||
{
|
||||
path = Config.PathFormat("{0}/{1}/{2}", cfg.pkg_path, pkg.GetBaseFolder(), paths[i]);
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
}
|
||||
|
||||
/* Do primitive copies */
|
||||
pkg.OnCopyFolders(this);
|
||||
pkg.OnCopyFiles(this);
|
||||
|
||||
/* Do libraries */
|
||||
Library [] libs = pkg.GetLibraries();
|
||||
for (int i=0; i<libs.Length; i++)
|
||||
{
|
||||
if (libs[i].build_mode == BuildMode.BuildMode_Episode1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!BuildLibrary(pkg, libs[i]))
|
||||
{
|
||||
throw new System.Exception("Failed to compile library: " + libs[i].binary_name);
|
||||
}
|
||||
}
|
||||
|
||||
/* Do plugins */
|
||||
Plugin [] plugins = pkg.GetPlugins();
|
||||
if (plugins != null)
|
||||
{
|
||||
for (int i=0; i<plugins.Length; i++)
|
||||
{
|
||||
if (!CompilePlugin(pkg, plugins[i]))
|
||||
{
|
||||
throw new System.Exception("Failed to compile plugin: " + plugins[i].Source);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
[assembly: AssemblyTitle("")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
||||
@@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace builder
|
||||
{
|
||||
public enum BasePlatform
|
||||
{
|
||||
Platform_Windows,
|
||||
Platform_Linux
|
||||
};
|
||||
|
||||
public class Config
|
||||
{
|
||||
public string source_path;
|
||||
public string pkg_path;
|
||||
public string builder_path;
|
||||
public string build_options;
|
||||
public string pdb_log_file;
|
||||
public builder.BasePlatform Platform;
|
||||
|
||||
public Config()
|
||||
{
|
||||
if ((int)System.Environment.OSVersion.Platform == 128)
|
||||
{
|
||||
Platform = BasePlatform.Platform_Linux;
|
||||
}
|
||||
else
|
||||
{
|
||||
Platform = BasePlatform.Platform_Windows;
|
||||
}
|
||||
}
|
||||
|
||||
public static string PathFormat(string format, params string [] args)
|
||||
{
|
||||
string temp = string.Format(format, args);
|
||||
return temp.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
|
||||
}
|
||||
|
||||
public bool ReadFromFile(string file)
|
||||
{
|
||||
bool read = true;
|
||||
StreamReader sr = null;
|
||||
try
|
||||
{
|
||||
sr = new StreamReader(file);
|
||||
|
||||
string line;
|
||||
string delim = "\t \n\r\v";
|
||||
string split = "=";
|
||||
|
||||
while ( (line = sr.ReadLine()) != null )
|
||||
{
|
||||
line = line.Trim(delim.ToCharArray());
|
||||
if (line.Length < 1 || line[0] == ';')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string [] s = line.Split(split.ToCharArray());
|
||||
string key, val = "";
|
||||
if (s.GetLength(0) >= 1)
|
||||
{
|
||||
key = s[0];
|
||||
if (s.GetLength(0) >= 2)
|
||||
{
|
||||
for (int i=1; i<s.GetLength(0); i++)
|
||||
{
|
||||
val += s[i];
|
||||
}
|
||||
}
|
||||
key = key.Trim(delim.ToCharArray());
|
||||
val = val.Trim(delim.ToCharArray());
|
||||
if (key.CompareTo("SourceBase") == 0)
|
||||
{
|
||||
source_path = val;
|
||||
}
|
||||
else if (key.CompareTo("OutputBase") == 0)
|
||||
{
|
||||
pkg_path = val;
|
||||
}
|
||||
else if (key.CompareTo("BuilderPath") == 0)
|
||||
{
|
||||
builder_path = val;
|
||||
}
|
||||
else if (key.CompareTo("BuildOptions") == 0)
|
||||
{
|
||||
build_options = val;
|
||||
}
|
||||
else if (key.CompareTo("PDBLog") == 0)
|
||||
{
|
||||
pdb_log_file = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Console.WriteLine("Unable to read {0:s}: {1:s}", file, e.Message);
|
||||
read = false;
|
||||
}
|
||||
|
||||
if (sr != null)
|
||||
{
|
||||
sr.Close();
|
||||
}
|
||||
|
||||
return read;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace builder
|
||||
{
|
||||
public class LinuxBuilder : ABuilder
|
||||
{
|
||||
public LinuxBuilder(Config _cfg)
|
||||
{
|
||||
cfg = _cfg;
|
||||
}
|
||||
|
||||
public override string GetPawnCompilerName()
|
||||
{
|
||||
return "spcomp";
|
||||
}
|
||||
|
||||
public override bool BuildLibrary(Package pkg, Library lib)
|
||||
{
|
||||
ProcessStartInfo info = new ProcessStartInfo();
|
||||
|
||||
string path = Config.PathFormat("{0}/{1}",
|
||||
cfg.source_path,
|
||||
lib.source_path);
|
||||
|
||||
/* PlatformExt ignored for us */
|
||||
string binName = lib.binary_name;
|
||||
|
||||
if (!lib.is_executable)
|
||||
{
|
||||
if (lib.has_platform_ext)
|
||||
{
|
||||
binName += "_i486.so";
|
||||
}
|
||||
else
|
||||
{
|
||||
binName += ".so";
|
||||
}
|
||||
}
|
||||
|
||||
string output_folder = (lib.release_mode == ReleaseMode.ReleaseMode_Release) ? "Release" : "Debug";
|
||||
|
||||
if (lib.build_mode == BuildMode.BuildMode_Episode2)
|
||||
{
|
||||
output_folder += ".orangebox";
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_OldMetamod)
|
||||
{
|
||||
output_folder += ".original";
|
||||
}
|
||||
|
||||
string binpath = Config.PathFormat("{0}/{1}/{2}",
|
||||
path,
|
||||
output_folder,
|
||||
binName);
|
||||
|
||||
if (File.Exists(binpath))
|
||||
{
|
||||
File.Delete(binpath);
|
||||
}
|
||||
|
||||
string makefile_args = "";
|
||||
|
||||
if (lib.build_mode == BuildMode.BuildMode_Episode1)
|
||||
{
|
||||
makefile_args = null;
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_Episode2)
|
||||
{
|
||||
makefile_args = "ENGINE=\"orangebox\"";
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_OldMetamod)
|
||||
{
|
||||
makefile_args = "ENGINE=\"original\"";
|
||||
}
|
||||
|
||||
/* Clean the project first */
|
||||
info.WorkingDirectory = path;
|
||||
info.FileName = cfg.builder_path;
|
||||
info.Arguments = makefile_args + " clean";
|
||||
info.UseShellExecute = false;
|
||||
|
||||
Process p = Process.Start(info);
|
||||
p.WaitForExit();
|
||||
p.Close();
|
||||
|
||||
/* Now build it */
|
||||
info.WorkingDirectory = path;
|
||||
info.FileName = cfg.builder_path;
|
||||
info.Arguments = makefile_args;
|
||||
info.UseShellExecute = false;
|
||||
|
||||
if (cfg.build_options != null)
|
||||
{
|
||||
info.Arguments += " " + cfg.build_options;
|
||||
}
|
||||
|
||||
p = Process.Start(info);
|
||||
p.WaitForExit();
|
||||
p.Close();
|
||||
|
||||
if (!File.Exists(binpath))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
path = Config.PathFormat("{0}/{1}/{2}/{3}",
|
||||
cfg.pkg_path,
|
||||
pkg.GetBaseFolder(),
|
||||
lib.package_path,
|
||||
binName);
|
||||
File.Copy(binpath, path, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace builder
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (args.GetLength(0) < 1)
|
||||
{
|
||||
System.Console.WriteLine("Usage: <config file>");
|
||||
return;
|
||||
}
|
||||
|
||||
Config cfg = new Config();
|
||||
if (!cfg.ReadFromFile(args[0]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* :TODO: Add path validation */
|
||||
|
||||
ABuilder bld = null;
|
||||
|
||||
if (cfg.Platform == BasePlatform.Platform_Linux)
|
||||
{
|
||||
bld = new LinuxBuilder(cfg);
|
||||
}
|
||||
else if (cfg.Platform == BasePlatform.Platform_Windows)
|
||||
{
|
||||
bld = new Win32Builder(cfg);
|
||||
if (cfg.pdb_log_file != null && File.Exists(cfg.pdb_log_file))
|
||||
{
|
||||
File.Delete(cfg.pdb_log_file);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
bld.BuildPackage(new PkgCore());
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Console.WriteLine("Build failed: " + e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
CS = mcs
|
||||
NAME = builder
|
||||
BINARY = $(NAME).exe
|
||||
|
||||
OBJECTS = ABuilder.cs AssemblyInfo.cs Config.cs LinuxBuilder.cs Win32Builder.cs \
|
||||
Package.cs PkgCore.cs Main.cs
|
||||
|
||||
default: all
|
||||
|
||||
all: $(OBJECTS)
|
||||
$(CS) $(OBJECTS) -out:$(BINARY)
|
||||
|
||||
clean:
|
||||
rm -rf $(BINARY)
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
|
||||
namespace builder
|
||||
{
|
||||
public enum ReleaseMode : int
|
||||
{
|
||||
ReleaseMode_Release,
|
||||
ReleaseMode_Debug,
|
||||
};
|
||||
|
||||
public enum BuildMode : int
|
||||
{
|
||||
BuildMode_Simple,
|
||||
BuildMode_OldMetamod,
|
||||
BuildMode_Episode1,
|
||||
BuildMode_Episode2
|
||||
};
|
||||
|
||||
public class Library
|
||||
{
|
||||
public Library()
|
||||
{
|
||||
has_platform_ext = false;
|
||||
is_executable = false;
|
||||
release_mode = ReleaseMode.ReleaseMode_Release;
|
||||
build_mode = BuildMode.BuildMode_Simple;
|
||||
}
|
||||
public string binary_name; /* Name of binary */
|
||||
public string source_path; /* Local path to library build scripts */
|
||||
public ReleaseMode release_mode; /* Release mode */
|
||||
public BuildMode build_mode; /* Build mode */
|
||||
public string package_path; /* Final relative path */
|
||||
public bool has_platform_ext; /* Add extra platform extension? */
|
||||
public string vcproj_name; /* Project file, NULL for standard */
|
||||
public bool is_executable; /* If this is an EXE instead of a DLL */
|
||||
};
|
||||
|
||||
public class Plugin
|
||||
{
|
||||
public Plugin(string file)
|
||||
{
|
||||
Source = file;
|
||||
disabled = false;
|
||||
}
|
||||
public Plugin (string file, string folder)
|
||||
{
|
||||
Source = file;
|
||||
Folder = folder;
|
||||
disabled = false;
|
||||
}
|
||||
public Plugin (string file, bool is_disabled)
|
||||
{
|
||||
Source = file;
|
||||
disabled = is_disabled;
|
||||
}
|
||||
public string Folder; /* Source folder relative to scripting (null for default) */
|
||||
public string Source; /* Source file name */
|
||||
public bool disabled; /* Is the plugin disabled? */
|
||||
};
|
||||
|
||||
public abstract class Package
|
||||
{
|
||||
/**
|
||||
* Must return the root compression point.
|
||||
*/
|
||||
public abstract void GetCompressBases(ref string path, ref string folder);
|
||||
|
||||
/**
|
||||
* Must return the base package output folder.
|
||||
*/
|
||||
public abstract string GetBaseFolder();
|
||||
|
||||
/**
|
||||
* Must return the list of folders to create.
|
||||
*/
|
||||
public abstract string [] GetFolders();
|
||||
|
||||
/**
|
||||
* Called when file to file copies must be performed
|
||||
*/
|
||||
public abstract void OnCopyFiles(ABuilder builder);
|
||||
|
||||
/**
|
||||
* Called when dir to dir copies must be performed
|
||||
*/
|
||||
public abstract void OnCopyFolders(ABuilder builder);
|
||||
|
||||
/**
|
||||
* Called to build libraries
|
||||
*/
|
||||
public abstract Library [] GetLibraries();
|
||||
|
||||
/**
|
||||
* Called to get package name
|
||||
*/
|
||||
public abstract string GetPackageName();
|
||||
|
||||
/**
|
||||
* Called to get a plugin list
|
||||
*/
|
||||
public abstract Plugin [] GetPlugins();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,304 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace builder
|
||||
{
|
||||
public class PkgCore : Package
|
||||
{
|
||||
private ArrayList libraries;
|
||||
private ArrayList plugins;
|
||||
private ArrayList folders;
|
||||
|
||||
public PkgCore()
|
||||
{
|
||||
}
|
||||
|
||||
public override string GetBaseFolder()
|
||||
{
|
||||
return "base";
|
||||
}
|
||||
|
||||
public override void GetCompressBases(ref string path, ref string folder)
|
||||
{
|
||||
path = "base";
|
||||
folder = "addons";
|
||||
}
|
||||
|
||||
public override string GetPackageName()
|
||||
{
|
||||
return "sourcemod-core";
|
||||
}
|
||||
|
||||
/**
|
||||
* Must return the list of folders to create.
|
||||
*/
|
||||
public override string [] GetFolders()
|
||||
{
|
||||
if (folders != null)
|
||||
{
|
||||
return (string [])folders.ToArray(typeof(string));
|
||||
}
|
||||
|
||||
folders = new ArrayList();
|
||||
|
||||
folders.Add("addons/sourcemod/bin");
|
||||
folders.Add("addons/sourcemod/plugins/disabled");
|
||||
folders.Add("addons/sourcemod/gamedata");
|
||||
folders.Add("addons/sourcemod/configs/geoip");
|
||||
folders.Add("addons/sourcemod/translations");
|
||||
folders.Add("addons/sourcemod/logs");
|
||||
folders.Add("addons/sourcemod/extensions");
|
||||
folders.Add("addons/sourcemod/data");
|
||||
folders.Add("addons/sourcemod/scripting/include");
|
||||
folders.Add("addons/sourcemod/scripting/admin-flatfile");
|
||||
folders.Add("addons/sourcemod/scripting/adminmenu");
|
||||
folders.Add("addons/sourcemod/scripting/testsuite");
|
||||
folders.Add("cfg/sourcemod");
|
||||
folders.Add("addons/sourcemod/configs/sql-init-scripts");
|
||||
folders.Add("addons/sourcemod/configs/sql-init-scripts/mysql");
|
||||
folders.Add("addons/sourcemod/configs/sql-init-scripts/sqlite");
|
||||
//folders.Add("addons/sourcemod/extensions/games");
|
||||
folders.Add("addons/sourcemod/scripting/basecommands");
|
||||
folders.Add("addons/sourcemod/scripting/basecomm");
|
||||
folders.Add("addons/sourcemod/scripting/funvotes");
|
||||
folders.Add("addons/sourcemod/scripting/basevotes");
|
||||
folders.Add("addons/sourcemod/scripting/basebans");
|
||||
folders.Add("addons/sourcemod/scripting/funcommands");
|
||||
folders.Add("addons/sourcemod/extensions/auto.1.ep1");
|
||||
//folders.Add("addons/sourcemod/extensions/auto.2.ep1");
|
||||
folders.Add("addons/sourcemod/extensions/auto.2.ep2");
|
||||
folders.Add("addons/sourcemod/scripting/playercommands");
|
||||
folders.Add("addons/metamod");
|
||||
|
||||
return (string [])folders.ToArray(typeof(string));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when file to file copies must be performed
|
||||
*/
|
||||
public override void OnCopyFiles(ABuilder builder)
|
||||
{
|
||||
builder.CopyFile(this, "sourcepawn/batchtool/compile.exe", "addons/sourcemod/scripting/compile.exe");
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when dir to dir copies must be performed
|
||||
*/
|
||||
public override void OnCopyFolders(ABuilder builder)
|
||||
{
|
||||
builder.CopyFolder(this, "configs", "addons/sourcemod/configs", null);
|
||||
builder.CopyFolder(this, "configs/geoip", "addons/sourcemod/configs/geoip", null);
|
||||
builder.CopyFolder(this, "configs/cfg", "cfg/sourcemod", null);
|
||||
builder.CopyFolder(this, "configs/metamod", "addons/metamod", null);
|
||||
builder.CopyFolder(this,
|
||||
"configs/sql-init-scripts",
|
||||
"addons/sourcemod/configs/sql-init-scripts",
|
||||
null);
|
||||
builder.CopyFolder(this,
|
||||
"configs/sql-init-scripts/mysql",
|
||||
"addons/sourcemod/configs/sql-init-scripts/mysql",
|
||||
null);
|
||||
builder.CopyFolder(this,
|
||||
"configs/sql-init-scripts/sqlite",
|
||||
"addons/sourcemod/configs/sql-init-scripts/sqlite",
|
||||
null);
|
||||
|
||||
string [] plugin_omits = new string[1];
|
||||
plugin_omits[0] = "spcomp.exe";
|
||||
|
||||
string [] include_omits = new string[1];
|
||||
include_omits[0] = "version.tpl";
|
||||
|
||||
builder.CopyFolder(this, "gamedata", "addons/sourcemod/gamedata", null);
|
||||
builder.CopyFolder(this, "plugins", "addons/sourcemod/scripting", plugin_omits);
|
||||
builder.CopyFolder(this, "plugins/include", "addons/sourcemod/scripting/include", include_omits);
|
||||
builder.CopyFolder(this, "translations", "addons/sourcemod/translations", null);
|
||||
builder.CopyFolder(this, "public/licenses", "addons/sourcemod", null);
|
||||
builder.CopyFolder(this, "plugins/admin-flatfile", "addons/sourcemod/scripting/admin-flatfile", null);
|
||||
builder.CopyFolder(this, "plugins/adminmenu", "addons/sourcemod/scripting/adminmenu", null);
|
||||
builder.CopyFolder(this, "plugins/testsuite", "addons/sourcemod/scripting/testsuite", null);
|
||||
builder.CopyFolder(this, "plugins/basecommands", "addons/sourcemod/scripting/basecommands", null);
|
||||
builder.CopyFolder(this, "plugins/basecomm", "addons/sourcemod/scripting/basecomm", null);
|
||||
builder.CopyFolder(this, "plugins/funvotes", "addons/sourcemod/scripting/funvotes", null);
|
||||
builder.CopyFolder(this, "plugins/basevotes", "addons/sourcemod/scripting/basevotes", null);
|
||||
builder.CopyFolder(this, "plugins/basebans", "addons/sourcemod/scripting/basebans", null);
|
||||
builder.CopyFolder(this, "plugins/funcommands", "addons/sourcemod/scripting/funcommands", null);
|
||||
builder.CopyFolder(this, "plugins/playercommands", "addons/sourcemod/scripting/playercommands", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to build libraries
|
||||
*/
|
||||
public override Library [] GetLibraries()
|
||||
{
|
||||
if (libraries != null)
|
||||
{
|
||||
return (Library [])libraries.ToArray(typeof(Library));
|
||||
}
|
||||
|
||||
libraries = new ArrayList();
|
||||
|
||||
Library lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/bin";
|
||||
lib.source_path = "loader";
|
||||
lib.binary_name = "sourcemod_mm";
|
||||
lib.vcproj_name = "loader";
|
||||
lib.build_mode = BuildMode.BuildMode_Simple;
|
||||
lib.has_platform_ext = true;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/bin";
|
||||
lib.source_path = "core";
|
||||
lib.binary_name = "sourcemod.1.ep1";
|
||||
lib.vcproj_name = "sourcemod_mm";
|
||||
lib.build_mode = BuildMode.BuildMode_OldMetamod;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/bin";
|
||||
lib.source_path = "core";
|
||||
lib.binary_name = "sourcemod.2.ep1";
|
||||
lib.vcproj_name = "sourcemod_mm";
|
||||
lib.build_mode = BuildMode.BuildMode_Episode1;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/bin";
|
||||
lib.source_path = "core";
|
||||
lib.binary_name = "sourcemod.2.ep2";
|
||||
lib.vcproj_name = "sourcemod_mm";
|
||||
lib.build_mode = BuildMode.BuildMode_Episode2;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/bin";
|
||||
lib.source_path = "sourcepawn/jit/x86";
|
||||
lib.binary_name = "sourcepawn.jit.x86";
|
||||
lib.vcproj_name = "jit-x86";
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/scripting";
|
||||
lib.source_path = "sourcepawn/compiler";
|
||||
lib.binary_name = "spcomp";
|
||||
lib.is_executable = true;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions";
|
||||
lib.source_path = "extensions/geoip";
|
||||
lib.binary_name = "geoip.ext";
|
||||
lib.vcproj_name = "geoip";
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions";
|
||||
lib.source_path = "extensions/bintools";
|
||||
lib.binary_name = "bintools.ext";
|
||||
lib.vcproj_name = "bintools";
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions";
|
||||
lib.source_path = "extensions/mysql";
|
||||
lib.binary_name = "dbi.mysql.ext";
|
||||
lib.vcproj_name = "sm_mysql";
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.1.ep1";
|
||||
lib.source_path = "extensions/sdktools";
|
||||
lib.binary_name = "sdktools.ext";
|
||||
lib.vcproj_name = "sdktools";
|
||||
lib.build_mode = BuildMode.BuildMode_OldMetamod;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.2.ep1";
|
||||
lib.source_path = "extensions/sdktools";
|
||||
lib.binary_name = "sdktools.ext";
|
||||
lib.vcproj_name = "sdktools";
|
||||
lib.build_mode = BuildMode.BuildMode_Episode1;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.2.ep2";
|
||||
lib.source_path = "extensions/sdktools";
|
||||
lib.binary_name = "sdktools.ext";
|
||||
lib.vcproj_name = "sdktools";
|
||||
lib.build_mode = BuildMode.BuildMode_Episode2;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions";
|
||||
lib.source_path = "extensions/sqlite";
|
||||
lib.binary_name = "dbi.sqlite.ext";
|
||||
lib.vcproj_name = "sm_sqlite";
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.1.ep1";
|
||||
lib.source_path = "extensions/cstrike";
|
||||
lib.binary_name = "game.cstrike.ext";
|
||||
lib.vcproj_name = "cstrike";
|
||||
lib.build_mode = BuildMode.BuildMode_OldMetamod;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.2.ep1";
|
||||
lib.source_path = "extensions/cstrike";
|
||||
lib.binary_name = "game.cstrike.ext";
|
||||
lib.vcproj_name = "cstrike";
|
||||
lib.build_mode = BuildMode.BuildMode_Episode1;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions";
|
||||
lib.source_path = "extensions/topmenus";
|
||||
lib.binary_name = "topmenus.ext";
|
||||
lib.vcproj_name = "topmenus";
|
||||
libraries.Add(lib);
|
||||
|
||||
return (Library [])libraries.ToArray(typeof(Library));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to build plugins
|
||||
*/
|
||||
public override Plugin [] GetPlugins()
|
||||
{
|
||||
if (plugins != null)
|
||||
{
|
||||
return (Plugin [])plugins.ToArray(typeof(Plugin));
|
||||
}
|
||||
|
||||
plugins = new ArrayList();
|
||||
|
||||
plugins.Add(new Plugin("admin-flatfile", "admin-flatfile"));
|
||||
plugins.Add(new Plugin("adminhelp"));
|
||||
plugins.Add(new Plugin("antiflood"));
|
||||
plugins.Add(new Plugin("basecommands"));
|
||||
plugins.Add(new Plugin("reservedslots"));
|
||||
plugins.Add(new Plugin("basetriggers"));
|
||||
plugins.Add(new Plugin("nextmap"));
|
||||
plugins.Add(new Plugin("basechat"));
|
||||
plugins.Add(new Plugin("funcommands"));
|
||||
plugins.Add(new Plugin("basevotes"));
|
||||
plugins.Add(new Plugin("funvotes"));
|
||||
plugins.Add(new Plugin("admin-sql-prefetch", true));
|
||||
plugins.Add(new Plugin("admin-sql-threaded", true));
|
||||
plugins.Add(new Plugin("sql-admin-manager", true));
|
||||
plugins.Add(new Plugin("basebans"));
|
||||
plugins.Add(new Plugin("mapchooser", true));
|
||||
plugins.Add(new Plugin("basecomm"));
|
||||
plugins.Add(new Plugin("randomcycle", true));
|
||||
plugins.Add(new Plugin("rockthevote", true));
|
||||
plugins.Add(new Plugin("adminmenu"));
|
||||
plugins.Add(new Plugin("playercommands"));
|
||||
|
||||
return (Plugin [])plugins.ToArray(typeof(Plugin));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace builder
|
||||
{
|
||||
public class Win32Builder : ABuilder
|
||||
{
|
||||
public Win32Builder(Config _cfg)
|
||||
{
|
||||
cfg = _cfg;
|
||||
}
|
||||
|
||||
public override string GetPawnCompilerName()
|
||||
{
|
||||
return "spcomp.exe";
|
||||
}
|
||||
|
||||
public override bool BuildLibrary(Package pkg, Library lib)
|
||||
{
|
||||
ProcessStartInfo info = new ProcessStartInfo();
|
||||
|
||||
string path = Config.PathFormat("{0}/{1}/msvc8",
|
||||
cfg.source_path,
|
||||
lib.source_path);
|
||||
|
||||
/* PlatformExt ignored for us */
|
||||
string binName = lib.binary_name + (lib.is_executable ? ".exe" : ".dll");
|
||||
|
||||
string config_name = "Unknown";
|
||||
|
||||
if (lib.release_mode == ReleaseMode.ReleaseMode_Release)
|
||||
{
|
||||
config_name = "Release";
|
||||
}
|
||||
else if (lib.release_mode == ReleaseMode.ReleaseMode_Debug)
|
||||
{
|
||||
config_name = "Debug";
|
||||
}
|
||||
|
||||
if (lib.build_mode == BuildMode.BuildMode_Episode1)
|
||||
{
|
||||
config_name = config_name + " - Episode 1";
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_Episode2)
|
||||
{
|
||||
config_name = config_name + " - Orange Box";
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_OldMetamod)
|
||||
{
|
||||
config_name = config_name + " - Old Metamod";
|
||||
}
|
||||
|
||||
string binpath = Config.PathFormat("{0}/{1}/{2}",
|
||||
path,
|
||||
config_name,
|
||||
binName);
|
||||
|
||||
if (File.Exists(binpath))
|
||||
{
|
||||
File.Delete(binpath);
|
||||
}
|
||||
|
||||
string project_file = null;
|
||||
if (lib.vcproj_name != null)
|
||||
{
|
||||
project_file = lib.vcproj_name + ".vcproj";
|
||||
}
|
||||
else
|
||||
{
|
||||
project_file = lib.binary_name + ".vcproj";
|
||||
}
|
||||
|
||||
info.WorkingDirectory = path;
|
||||
info.FileName = cfg.builder_path;
|
||||
info.UseShellExecute = false;
|
||||
info.RedirectStandardOutput = true;
|
||||
info.RedirectStandardError = true;
|
||||
|
||||
if (cfg.build_options != null)
|
||||
{
|
||||
info.Arguments = cfg.build_options + " ";
|
||||
}
|
||||
|
||||
info.Arguments += "/rebuild \"" + config_name + "\" " + project_file;
|
||||
|
||||
Process p = Process.Start(info);
|
||||
Console.WriteLine(p.StandardOutput.ReadToEnd());
|
||||
p.WaitForExit();
|
||||
p.Close();
|
||||
|
||||
if (!File.Exists(binpath))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
path = Config.PathFormat("{0}/{1}/{2}/{3}",
|
||||
cfg.pkg_path,
|
||||
pkg.GetBaseFolder(),
|
||||
lib.package_path,
|
||||
binName);
|
||||
File.Copy(binpath, path, true);
|
||||
|
||||
/* On Windows we optionally log the PDB path */
|
||||
if (!lib.is_executable && cfg.pdb_log_file != null)
|
||||
{
|
||||
FileStream fs = File.Open(cfg.pdb_log_file, FileMode.Append, FileAccess.Write);
|
||||
StreamWriter sw = new StreamWriter(fs);
|
||||
sw.WriteLine(binpath.Replace(".dll", ".pdb"));
|
||||
sw.Close();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
OutputBase = /home/dvander/done
|
||||
SourceBase = /home/dvander/sourcemod/trunk
|
||||
BuilderPath = /usr/bin/make
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
OutputBase = c:\real\done
|
||||
SourceBase = r:\sourcemod\trunk
|
||||
BuilderPath = C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com
|
||||
@@ -0,0 +1,130 @@
|
||||
<VisualStudioProject>
|
||||
<CSHARP
|
||||
ProjectType = "Local"
|
||||
ProductVersion = "7.10.6030"
|
||||
SchemaVersion = "2.0"
|
||||
ProjectGuid = "{BFC4EB78-4C3E-4C81-8EAD-5A1A2F126512}"
|
||||
>
|
||||
<Build>
|
||||
<Settings
|
||||
ApplicationIcon = ""
|
||||
AssemblyKeyContainerName = ""
|
||||
AssemblyName = "builder"
|
||||
AssemblyOriginatorKeyFile = ""
|
||||
DefaultClientScript = "JScript"
|
||||
DefaultHTMLPageLayout = "Grid"
|
||||
DefaultTargetSchema = "IE50"
|
||||
DelaySign = "false"
|
||||
OutputType = "Exe"
|
||||
PreBuildEvent = ""
|
||||
PostBuildEvent = ""
|
||||
RootNamespace = "builder"
|
||||
RunPostBuildEvent = "OnBuildSuccess"
|
||||
StartupObject = ""
|
||||
>
|
||||
<Config
|
||||
Name = "Debug"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "DEBUG;TRACE"
|
||||
DocumentationFile = ""
|
||||
DebugSymbols = "true"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
NoStdLib = "false"
|
||||
NoWarn = ""
|
||||
Optimize = "false"
|
||||
OutputPath = "bin\Debug\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
<Config
|
||||
Name = "Release"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "TRACE"
|
||||
DocumentationFile = ""
|
||||
DebugSymbols = "false"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
NoStdLib = "false"
|
||||
NoWarn = ""
|
||||
Optimize = "true"
|
||||
OutputPath = "bin\Release\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
</Settings>
|
||||
<References>
|
||||
<Reference
|
||||
Name = "System"
|
||||
AssemblyName = "System"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Data"
|
||||
AssemblyName = "System.Data"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.XML"
|
||||
AssemblyName = "System.XML"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
|
||||
/>
|
||||
</References>
|
||||
</Build>
|
||||
<Files>
|
||||
<Include>
|
||||
<File
|
||||
RelPath = "ABuilder.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "AssemblyInfo.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Config.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "LinuxBuilder.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Main.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Package.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "PkgCore.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Win32Builder.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
</Include>
|
||||
</Files>
|
||||
</CSHARP>
|
||||
</VisualStudioProject>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "builder", "builder.csproj", "{BFC4EB78-4C3E-4C81-8EAD-5A1A2F126512}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectDependencies) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{BFC4EB78-4C3E-4C81-8EAD-5A1A2F126512}.Debug.ActiveCfg = Debug|.NET
|
||||
{BFC4EB78-4C3E-4C81-8EAD-5A1A2F126512}.Debug.Build.0 = Debug|.NET
|
||||
{BFC4EB78-4C3E-4C81-8EAD-5A1A2F126512}.Release.ActiveCfg = Release|.NET
|
||||
{BFC4EB78-4C3E-4C81-8EAD-5A1A2F126512}.Release.Build.0 = Release|.NET
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Reference in New Issue
Block a user