Remove the C# builder - the last vestige of the Old Republic.

Former-commit-id: ff7277048f
This commit is contained in:
David Anderson 2014-02-08 14:35:11 -08:00
parent 8f51d87826
commit 0748a05bf0
25 changed files with 0 additions and 1581 deletions

View File

@ -1,249 +0,0 @@
using System;
using System.Diagnostics;
using System.IO;
namespace AMXXRelease
{
//This class specifies the process that builds a release.
//It also implements the functions that are unlikely to change from mod to mod.
public abstract class ABuilder
{
protected Config m_Cfg;
public virtual void OnBuild()
{
}
public virtual void CreateDir(string dir)
{
Directory.CreateDirectory(dir);
}
public virtual bool Build(Config cfg, Build build)
{
m_Cfg = cfg;
OnBuild();
int num = build.GetMods();
AMod mod;
for (int i=0; i<num; i++)
{
mod = build.GetMod(i);
if (!BuildMod(mod))
{
System.Console.WriteLine("Mod failed to build: " + mod.GetName());
return false;
}
if (m_Cfg.CompressPath() != null)
{
CompressDir(
PropSlashes(m_Cfg.OutputPath() + "\\" + m_Cfg.GetReleaseName() + "-" + mod.GetName()),
PropSlashes(m_Cfg.OutputPath() + "\\" + mod.GetName())
);
}
}
return true;
}
public virtual bool BuildMod(AMod mod)
{
CopyConfigs(mod);
if (!BuildModModules(mod))
return false;
if (!BuildModPlugins(mod))
return false;
string basedir = PropSlashes(m_Cfg.OutputPath() + "\\" + mod.GetModPath());
string sourcetree = m_Cfg.GetSourceTree();
if (!mod.CopyExtraFiles(this, basedir, sourcetree))
return false;
return true;
}
public virtual void CopyConfigs(AMod mod)
{
string basedir = PropSlashes(m_Cfg.OutputPath() + "\\" + mod.GetModPath() + "\\configs");
if (!Directory.Exists(basedir))
CreateDir(basedir);
string srcdir = PropSlashes(m_Cfg.GetSourceTree() + "\\configs");
if (!Directory.Exists(srcdir))
return;
if (mod.GetPluginDir() != null)
srcdir += "\\" + mod.GetBaseName();
srcdir = PropSlashes(srcdir);
CopyNormal(this, srcdir, basedir);
}
public static void CopyNormal(ABuilder ab, string src, string dest)
{
string[] files = Directory.GetFiles(src);
if (!Directory.Exists(dest))
ab.CreateDir(dest);
for (int i=0; i<files.Length; i++)
{
File.Copy(files[i],
PropSlashes(dest + "\\" + GetFileName(files[i])),
true);
}
}
public virtual bool BuildModPlugins(AMod mod)
{
int num = mod.GetPlugins();
Plugin plugin;
string binary, basedir;
basedir = m_Cfg.OutputPath();
basedir += "\\" + mod.GetModPath();
basedir = PropSlashes(basedir);
string dir, file, target;
for (int i=0; i<num; i++)
{
plugin = mod.GetPlugin(i);
binary = BuildPlugin(mod, plugin);
file = PropSlashes(m_Cfg.GetSourceTree() + "\\plugins\\" + GetFileName(binary));
if (!File.Exists(file))
{
System.Console.WriteLine("Plugin failed to compile: " +
mod.GetName() + "::" + plugin.name);
return false;
}
dir = PropSlashes(basedir + "\\" + plugin.outdir);
if (!Directory.Exists(dir))
CreateDir(dir);
target = PropSlashes(dir + "\\" + plugin.name + ".amxx");
if (File.Exists(target))
File.Delete(target);
File.Move(file,
target);
}
//Copy all files from the plugins dir to scripting
string search_dir = m_Cfg.GetSourceTree() + "\\plugins";
if (mod.GetPluginDir() != null)
search_dir += "\\" + mod.GetPluginDir();
search_dir = PropSlashes(search_dir);
string dest;
if (Directory.Exists(search_dir))
{
string[] files = Directory.GetFiles(search_dir);
if (!Directory.Exists(PropSlashes(basedir + "\\scripting")))
CreateDir(PropSlashes(basedir + "\\scripting"));
for (int i=0; i<files.Length; i++)
{
dest = PropSlashes(basedir + "\\scripting\\" + GetFileName(files[i]));
if (mod.ExcludeCopy(files[i]))
continue;
File.Copy(files[i], dest, true);
}
}
return true;
}
public static string GetFileName(string input)
{
for (int i=input.Length-1; i>=0; i--)
{
if ((input[i] == '\\' || input[i] == '/') && i != input.Length-1)
{
return input.Substring(i+1, input.Length-i-1);
}
}
return input;
}
public virtual bool BuildModModules(AMod mod)
{
int num = mod.GetModules();
Module module;
string binary, basedir;
basedir = m_Cfg.OutputPath();
basedir += "\\" + mod.GetModPath();
basedir = PropSlashes(basedir);
string dir;
for (int i=0; i<num; i++)
{
module = mod.GetModule(i);
binary = BuildModule(module);
if (binary == null)
{
System.Console.WriteLine("Module failed to compile: " +
mod.GetName() + "::" + module.projname + GetLibExt());
return false;
}
dir = PropSlashes(basedir + "\\" + module.outdir);
if (!Directory.Exists(dir))
CreateDir(dir);
File.Copy(binary,
PropSlashes(dir + "\\" + module.projname + GetLibExt()),
true);
}
return true;
}
public virtual string BuildPlugin(AMod mod, Plugin pl)
{
string modoffs = mod.GetPluginDir();
string pldir;
if (modoffs != null)
pldir = modoffs + "\\";
else
pldir = "";
AmxxPc(PropSlashes(pldir + pl.source), pl.options);
string outfile = pldir + pl.name + ".amxx";
return outfile;
}
public abstract void AmxxPc(string inpath, string args);
public abstract string BuildModule(Module module);
public abstract string GetLibExt();
public abstract void CompressDir(string target, string dir);
public static string PropSlashes(string path)
{
char sep;
char alt;
if (Releaser.IsWindows)
{
sep = '\\';
alt = '/';
} else {
sep = '/';
alt = '\\';
}
return path.Replace(alt,sep);
}
}
}

View File

@ -1,123 +0,0 @@
using System;
using System.Diagnostics;
using System.Collections;
namespace AMXXRelease
{
//Holds information about a plugin
public class Plugin
{
public string name; //Plugin output file name
public string source; //Source code file
public string options; //Compile-time options
public string outdir; //Output folder
public Plugin(string Name)
{
name = (string)Name.Clone();
source = (string)Name.Clone();
outdir = "plugins";
}
}
//Holds information necessary to compile a module/C++ program
public class Module
{
public string sourcedir; //Source directory
public string projname; //Output binary name (such as amxmodx_mm)
public string build; //Build configuration
public string bindir; //Binary directory
public string vcproj; //VCProj file name
public string outdir; //Output directory
public Module()
{
build = "Release";
outdir = "modules";
bindir = "msvc10";
}
public Module(string name)
{
build = "Release";
outdir = "modules";
sourcedir = "dlls\\" + name;
bindir = "msvc10";
projname = name + "_amxx";
vcproj = name;
}
}
//Class that represents how a mod wants to be built.
//It exports a list of functions, mods, and a few
// tidbits of information. It can also hook an extra
// step for copying miscellanious files.
public abstract class AMod
{
protected ArrayList m_Modules;
protected ArrayList m_Plugins;
public abstract string GetName();
public virtual string GetBaseName()
{
return GetName();
}
public AMod()
{
m_Modules = new ArrayList();
m_Plugins = new ArrayList();
}
//called when it's okay to build an extra dir structure
// and copy files to it
public virtual bool CopyExtraFiles(ABuilder ab, string basedir, string sourcedir)
{
return true;
}
//defines a copy prevention filter
public virtual bool ExcludeCopy(string file)
{
return false;
}
public virtual string GetPluginDir()
{
return GetName();
}
public virtual int GetModules()
{
return m_Modules.Count;
}
public virtual Module GetModule(int i)
{
return (Module)m_Modules[i];
}
public virtual int GetPlugins()
{
return m_Plugins.Count;
}
public virtual string GetModPath()
{
return GetName() + "\\addons\\amxmodx";
}
public virtual Plugin GetPlugin(int i)
{
return (Plugin)m_Plugins[i];
}
public virtual Plugin AddPlugin(string name)
{
Plugin pl = new Plugin(name);
m_Plugins.Add(pl);
return pl;
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,52 +0,0 @@
using System;
using System.Collections;
namespace AMXXRelease
{
//Class that iterates the different pieces
// to be completed over for the build
public class Build
{
protected ArrayList m_Mods;
protected Config m_Cfg;
public Build(Config cfg)
{
m_Mods = new ArrayList();
m_Cfg = cfg;
CoreMod core = new CoreMod();
ModCstrike cstrike = new ModCstrike();
ModDoD dod = new ModDoD();
ModTFC tfc = new ModTFC();
m_Mods.Add(core);
m_Mods.Add(cstrike);
m_Mods.Add(dod);
m_Mods.Add(tfc);
// These mods don't have OS X builds
if (!Releaser.IsOSX)
{
ModEsf esf = new ModEsf();
ModNs ns = new ModNs();
ModTs ts = new ModTs();
m_Mods.Add(esf);
m_Mods.Add(ns);
m_Mods.Add(ts);
}
}
public virtual int GetMods()
{
return m_Mods.Count;
}
public virtual AMod GetMod(int i)
{
return (AMod)m_Mods[i];
}
}
}

View File

@ -1,100 +0,0 @@
using System;
using System.IO;
namespace AMXXRelease
{
//Reads in config file info
public class Config
{
private string m_SourceTree;
private string m_OutputPath;
private string m_DevenvPath;
private string m_PathToCompress;
private string m_ReleaseName;
private string m_MakeOpts;
public Config()
{
}
public string GetSourceTree()
{
return m_SourceTree;
}
public string OutputPath()
{
return m_OutputPath;
}
public string DevenvPath()
{
return m_DevenvPath;
}
public string CompressPath()
{
return m_PathToCompress;
}
public string GetReleaseName()
{
return m_ReleaseName;
}
public string MakeOpts()
{
return m_MakeOpts;
}
public bool ReadFromFile(string file)
{
try
{
StreamReader sr = new StreamReader(file);
string line;
string delim = "\t \n\r\v";
string splt = "=";
while ( (line = sr.ReadLine()) != null )
{
line = line.Trim(delim.ToCharArray());
if (line.Length < 1 || line[0] == ';')
continue;
string [] s = line.Split(splt.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("compress")==0)
m_PathToCompress = val;
if (key.CompareTo("devenv")==0)
m_DevenvPath = val;
if (key.CompareTo("output")==0)
m_OutputPath = val;
if (key.CompareTo("source")==0)
m_SourceTree = val;
if (key.CompareTo("release")==0)
m_ReleaseName = val;
if (key.CompareTo("makeopts")==0)
m_MakeOpts = val;
}
}
return true;
} catch {
Console.WriteLine("Unable to read file: " + file);
}
return false;
}
}
}

View File

@ -1,165 +0,0 @@
using System;
using System.IO;
namespace AMXXRelease
{
//AMX Mod X core distribution
public class CoreMod : AMod
{
public CoreMod()
{
AddModules();
AddPlugins();
}
public override sealed string GetName()
{
return "base";
}
public override sealed string GetPluginDir()
{
return null;
}
public override sealed string GetBaseName()
{
return null;
}
//annoyingly complicated file exclusion filter
public override sealed bool ExcludeCopy(string file)
{
if ( ((file.IndexOf(".so")!=-1) || (ABuilder.GetFileName(file).CompareTo("amxxpc")==0))
&& (Releaser.IsWindows || Releaser.IsOSX) )
return true;
if ( ((file.IndexOf(".dylib")!=-1) || (ABuilder.GetFileName(file).CompareTo("amxxpc_osx")==0))
&& (!Releaser.IsOSX) )
return true;
if ( (file.IndexOf(".sh")!=-1) && Releaser.IsWindows )
return true;
if ( ((file.IndexOf(".exe")!=-1) || (file.IndexOf(".dll")!=-1))
&& (!Releaser.IsWindows) )
return true;
if (file.IndexOf("dlsym")!=-1)
return true;
if (ABuilder.GetFileName(file).CompareTo("svn_version.tpl") == 0)
{
return true;
}
return base.ExcludeCopy(file);
}
public override sealed bool CopyExtraFiles(ABuilder ab, string basedir, string source)
{
//Create directory structures
string datadir = basedir + "\\data";
if (!Directory.Exists(ABuilder.PropSlashes(datadir)))
ab.CreateDir(ABuilder.PropSlashes(datadir));
File.Copy(ABuilder.PropSlashes(source + "\\dlls\\geoip\\GeoIP.dat"),
ABuilder.PropSlashes(datadir + "\\GeoIP.dat"),
true);
ABuilder.CopyNormal(ab,
ABuilder.PropSlashes(source + "\\plugins\\lang"),
ABuilder.PropSlashes(datadir + "\\lang")
);
if (!Directory.Exists(ABuilder.PropSlashes(basedir + "\\logs")))
ab.CreateDir(ABuilder.PropSlashes(basedir + "\\logs"));
ABuilder.CopyNormal(ab,
ABuilder.PropSlashes(source + "\\plugins\\include"),
ABuilder.PropSlashes(basedir + "\\scripting\\include"));
ABuilder.CopyNormal(ab,
ABuilder.PropSlashes(source + "\\plugins\\include\\amxmod_compat"),
ABuilder.PropSlashes(basedir + "\\scripting\\include\\amxmod_compat"));
ABuilder.CopyNormal(ab,
ABuilder.PropSlashes(source + "\\plugins\\amxmod_compat"),
ABuilder.PropSlashes(basedir + "\\scripting\\amxmod_compat"));
ABuilder.CopyNormal(ab,
ABuilder.PropSlashes(source + "\\plugins\\testsuite"),
ABuilder.PropSlashes(basedir + "\\scripting\\testsuite"));
return true;
}
private void AddPlugins()
{
AddPlugin("admin");
Plugin admin_sql = new Plugin("admin_sql");
admin_sql.source = "admin";
admin_sql.options = "USING_SQL=1 -oadmin_sql.amx";
m_Plugins.Add(admin_sql);
Plugin bcompat = new Plugin("amxmod_compat");
bcompat.source = "amxmod_compat/amxmod_compat";
m_Plugins.Add(bcompat);
AddPlugin("adminchat");
AddPlugin("admincmd");
AddPlugin("adminhelp");
AddPlugin("adminslots");
AddPlugin("adminvote");
AddPlugin("antiflood");
AddPlugin("imessage");
AddPlugin("mapchooser");
AddPlugin("mapsmenu");
AddPlugin("menufront");
AddPlugin("multilingual");
AddPlugin("nextmap");
AddPlugin("pausecfg");
AddPlugin("plmenu");
AddPlugin("scrollmsg");
AddPlugin("statscfg");
AddPlugin("telemenu");
AddPlugin("timeleft");
AddPlugin("cmdmenu");
AddPlugin("pluginmenu");
}
private void AddModules()
{
Module core = new Module();
core.sourcedir = "amxmodx";
core.vcproj = "amxmodx_mm";
core.build = "JITRelease";
core.projname = "amxmodx_mm";
core.outdir = "dlls";
Module mysqlx = new Module("mysqlx");
mysqlx.projname = "mysql_amxx";
Module sqlitex = new Module("sqlite");
Module engine = new Module("engine");
Module fun = new Module("fun");
Module geoip = new Module("geoip");
Module fakemeta = new Module("fakemeta");
Module sockets = new Module("sockets");
Module regex = new Module("regex");
Module nvault = new Module("nvault");
Module sammich = new Module("hamsandwich");
m_Modules.Add(core);
m_Modules.Add(mysqlx);
m_Modules.Add(engine);
m_Modules.Add(fun);
m_Modules.Add(geoip);
m_Modules.Add(fakemeta);
m_Modules.Add(sockets);
m_Modules.Add(regex);
m_Modules.Add(nvault);
m_Modules.Add(sqlitex);
m_Modules.Add(sammich);
}
}
}

View File

@ -1,131 +0,0 @@
using System;
using System.Diagnostics;
using System.IO;
namespace AMXXRelease
{
//Build process for any Linux
public class LinuxBuilder : ABuilder
{
private string m_AmxxPc;
public override void OnBuild()
{
m_AmxxPc = PropSlashes(m_Cfg.GetSourceTree() + "/plugins/amxxpc");
}
public override void CompressDir(string target, string dir)
{
ProcessStartInfo info = new ProcessStartInfo();
info.FileName = m_Cfg.CompressPath();
info.WorkingDirectory = dir;
string [] files = Directory.GetFiles(dir);
string file_list = "";
for (int i=0; i<files.Length; i++)
file_list += GetFileName(files[i]) + " ";
files = Directory.GetDirectories(dir);
for (int i=0; i<files.Length; i++)
file_list += GetFileName(files[i]) + " ";
ProcessStartInfo chmod = new ProcessStartInfo();
chmod.FileName = "/bin/chmod";
chmod.WorkingDirectory = dir;
chmod.Arguments = "-R 755 " + file_list;
chmod.UseShellExecute = false;
Process c = Process.Start(chmod);
c.WaitForExit();
c.Close();
info.Arguments = "zcvf \"" + target + "-linux.tar.gz\" " + file_list;
info.UseShellExecute = false;
Process p = Process.Start(info);
p.WaitForExit();
p.Close();
}
public override void AmxxPc(string inpath, string args)
{
ProcessStartInfo info = new ProcessStartInfo();
info.WorkingDirectory = PropSlashes(m_Cfg.GetSourceTree() + "\\plugins");
info.FileName = (string)m_AmxxPc.Clone();
info.Arguments = inpath + ".sma";
if (args != null)
info.Arguments += " " + args;
info.UseShellExecute = false;
Process p = Process.Start(info);
p.WaitForExit();
p.Close();
}
public override string GetLibExt()
{
return "_i386.so";
}
public override string BuildModule(Module module)
{
ProcessStartInfo info = new ProcessStartInfo();
string dir = m_Cfg.GetSourceTree() + "\\" + module.sourcedir;
string file = dir;
file += "\\" + "Release" + "\\" + module.projname + GetLibExt();
file = PropSlashes(file);
if (File.Exists(file))
File.Delete(file);
Console.WriteLine(PropSlashes(dir));
info.WorkingDirectory = PropSlashes(dir);
info.FileName = m_Cfg.DevenvPath();
info.Arguments = "clean";
info.UseShellExecute = false;
Process p = Process.Start(info);
p.WaitForExit();
p.Close();
info.WorkingDirectory = PropSlashes(dir);
info.FileName = m_Cfg.DevenvPath();
info.Arguments = m_Cfg.MakeOpts();
info.UseShellExecute = false;
p = Process.Start(info);
p.WaitForExit();
p.Close();
if (!File.Exists(file))
{
Console.WriteLine("Output file failed: " + file);
return null;
}
//Now we need to see if the DL handle is valid!
string dlsym_dir = m_Cfg.GetSourceTree() + "\\plugins";
string dlsym = dlsym_dir + "\\dlsym";
dlsym = PropSlashes(dlsym);
dlsym_dir = PropSlashes(dlsym_dir);
info.WorkingDirectory = dlsym_dir;
info.FileName = dlsym;
info.Arguments = file;
info.UseShellExecute = false;
info.RedirectStandardOutput = true;
p = Process.Start(info);
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
p.Close();
if (output.IndexOf("Handle:") == -1)
return null;
return file;
}
}
}

View File

@ -1,111 +0,0 @@
using System;
using System.Diagnostics;
using System.IO;
namespace AMXXRelease
{
//Build process for Mac OS X
public class MacBuilder : ABuilder
{
private string m_AmxxPc;
public override void OnBuild()
{
m_AmxxPc = PropSlashes(m_Cfg.GetSourceTree() + "/plugins/amxxpc_osx");
}
public override void CompressDir(string target, string dir)
{
ProcessStartInfo info = new ProcessStartInfo();
info.FileName = m_Cfg.CompressPath();
info.WorkingDirectory = dir;
string [] files = Directory.GetFiles(dir);
string file_list = "";
for (int i=0; i<files.Length; i++)
file_list += GetFileName(files[i]) + " ";
files = Directory.GetDirectories(dir);
for (int i=0; i<files.Length; i++)
file_list += GetFileName(files[i]) + " ";
ProcessStartInfo chmod = new ProcessStartInfo();
chmod.FileName = "/bin/chmod";
chmod.WorkingDirectory = dir;
chmod.Arguments = "-R 755 " + file_list;
chmod.UseShellExecute = false;
Process c = Process.Start(chmod);
c.WaitForExit();
c.Close();
info.Arguments = "-r \"" + target + "-mac.zip\" " + ".";
info.UseShellExecute = false;
Process p = Process.Start(info);
p.WaitForExit();
p.Close();
}
public override void AmxxPc(string inpath, string args)
{
ProcessStartInfo info = new ProcessStartInfo();
info.WorkingDirectory = PropSlashes(m_Cfg.GetSourceTree() + "\\plugins");
info.FileName = (string)m_AmxxPc.Clone();
info.Arguments = inpath + ".sma";
if (args != null)
info.Arguments += " " + args;
info.UseShellExecute = false;
Process p = Process.Start(info);
p.WaitForExit();
p.Close();
}
public override string GetLibExt()
{
return ".dylib";
}
public override string BuildModule(Module module)
{
ProcessStartInfo info = new ProcessStartInfo();
string dir = m_Cfg.GetSourceTree() + "\\" + module.sourcedir;
string file = dir;
file += "\\" + "Release" + "\\" + module.projname + GetLibExt();
file = PropSlashes(file);
if (File.Exists(file))
File.Delete(file);
Console.WriteLine(PropSlashes(dir));
info.WorkingDirectory = PropSlashes(dir);
info.FileName = m_Cfg.DevenvPath();
info.Arguments = "clean";
info.UseShellExecute = false;
Process p = Process.Start(info);
p.WaitForExit();
p.Close();
info.WorkingDirectory = PropSlashes(dir);
info.FileName = m_Cfg.DevenvPath();
info.Arguments = m_Cfg.MakeOpts();
info.UseShellExecute = false;
p = Process.Start(info);
p.WaitForExit();
p.Close();
if (!File.Exists(file))
{
Console.WriteLine("Output file failed: " + file);
return null;
}
return file;
}
}
}

View File

@ -1,145 +0,0 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
namespace AMXXRelease
{
//Entry point for application.
//1. Reads config file
//2. Instantiates correct build process (ABuilder)
//3. Instantiates the build (Build)
//4. Passes configuration and build to the Builder
public class Releaser
{
private Config m_Cfg;
public static bool IsWindows;
public static bool IsOSX;
[STAThread]
static void Main(string[] args)
{
string file;
if (args.GetLength(0) < 1)
file = "release.info";
else
file = args[0];
Releaser r = new Releaser();
r.Release(file);
}
public void Release(string file)
{
m_Cfg = new Config();
file = ABuilder.PropSlashes(file);
if (!m_Cfg.ReadFromFile(file))
{
Console.WriteLine("Failed to read config, aborting.");
Console.WriteLine("Build failed!");
return;
}
if (!ValidateConfigPaths())
{
Console.WriteLine("Build failed!");
return;
}
ABuilder builder = null;
if (IsMacOSX())
{
builder = new MacBuilder();
Releaser.IsWindows = false;
Releaser.IsOSX = true;
}
else if (System.Environment.OSVersion.Platform == System.PlatformID.Unix)
{
builder = new LinuxBuilder();
Releaser.IsWindows = false;
Releaser.IsOSX = false;
} else {
builder = new Win32Builder();
Releaser.IsWindows = true;
Releaser.IsOSX = false;
}
Build build = new Build(m_Cfg);
if (!builder.Build(m_Cfg, build))
{
throw new Exception("Build failed!");
}
else
{
Console.WriteLine("Build succeeded!");
}
}
private bool ValidateConfigPaths()
{
string source = ABuilder.PropSlashes(m_Cfg.GetSourceTree());
if (!Directory.Exists(source))
{
Console.WriteLine("Failed to find source tree! Check 'source' option in config.");
return false;
} else {
// Check subdirectories of source tree to make sure they contain necessary directories
if (!Directory.Exists(ABuilder.PropSlashes(source + "\\amxmodx")) ||
!Directory.Exists(ABuilder.PropSlashes(source + "\\configs")) ||
!Directory.Exists(ABuilder.PropSlashes(source + "\\dlls")) ||
!Directory.Exists(ABuilder.PropSlashes(source + "\\plugins")))
{
Console.WriteLine("Source tree appears invalid! Check 'source' option in config.");
return false;
}
}
if ( !File.Exists( ABuilder.PropSlashes(m_Cfg.DevenvPath()) ) )
{
Console.WriteLine("Failed to find compilation program! Check 'devenv' option in config.");
return false;
}
return true;
}
[DllImport("libc")]
static extern int uname(IntPtr buf);
// Environment.OSVersion.Platform returns PlatformID.Unix under Mono on OS X
// Code adapted from Mono: mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
private bool IsMacOSX()
{
IntPtr buf = IntPtr.Zero;
try
{
// The size of the utsname struct varies from system to system, but this _seems_ more than enough
buf = Marshal.AllocHGlobal(4096);
if (uname(buf) == 0)
{
string sys = Marshal.PtrToStringAnsi(buf);
if (sys == "Darwin")
return true;
}
}
catch
{
// Do nothing
}
finally
{
if (buf != IntPtr.Zero)
Marshal.FreeHGlobal(buf);
}
return false;
}
}
}

View File

@ -1,20 +0,0 @@
#(C)2004-2013 AMX Mod X Development Team
# Makefile written by David "BAILOPAN" Anderson
### EDIT BELOW FOR OTHER PROJECTS ###
CS = gmcs
NAME = builder
BINARY = $(NAME).exe
OBJECTS = Main.cs Config.cs ABuilder.cs AMod.cs Build.cs Win32Builder.cs LinuxBuilder.cs \
CoreMod.cs ModDoD.cs ModEsf.cs ModCstrike.cs ModTFC.cs \
ModTs.cs ModNs.cs MacBuilder.cs
default: all
all: $(OBJECTS)
$(CS) $(OBJECTS) -out:$(BINARY)
clean:
rm -rf $(BINARY)

View File

@ -1,60 +0,0 @@
using System;
using System.IO;
namespace AMXXRelease
{
/// <summary>
/// Summary description for ModCstrike.
/// </summary>
public class ModCstrike : AMod
{
public ModCstrike()
{
AddModules();
AddPlugins();
}
public override sealed string GetName()
{
return "cstrike";
}
private void AddPlugins()
{
AddPlugin("miscstats");
AddPlugin("stats_logging");
AddPlugin("statsx");
AddPlugin("restmenu");
Plugin csstats = new Plugin("csstats");
csstats.outdir = "data";
m_Plugins.Add(csstats);
}
public override sealed bool CopyExtraFiles(ABuilder ab, string basedir, string source)
{
if (System.Environment.OSVersion.Platform == System.PlatformID.Unix)
{
} else {
File.Copy(source + "\\dlls\\cstrike\\csx\\msvc10\\Release\\WinCSX.exe",
basedir + "\\data\\WinCSX.exe",
true);
}
return true;
}
private void AddModules()
{
Module csx = new Module("csx");
csx.sourcedir = "dlls\\cstrike\\csx";
Module cstrike = new Module("cstrike");
cstrike.sourcedir = "dlls\\cstrike\\cstrike";
m_Modules.Add(csx);
m_Modules.Add(cstrike);
}
}
}

View File

@ -1,43 +0,0 @@
using System;
namespace AMXXRelease
{
//Day of Defeat
public class ModDoD : AMod
{
public ModDoD()
{
AddModules();
AddPlugins();
}
public override sealed string GetName()
{
return "dod";
}
private void AddPlugins()
{
AddPlugin("stats");
AddPlugin("plmenu");
AddPlugin("stats_logging");
AddPlugin("statssounds");
Plugin pl = AddPlugin("dodstats");
pl.outdir = "data";
}
private void AddModules()
{
Module dodx = new Module("dodx");
dodx.sourcedir = "dlls\\dod\\dodx";
Module dodfun = new Module("dodfun");
dodfun.sourcedir = "dlls\\dod\\dodfun";
m_Modules.Add(dodx);
m_Modules.Add(dodfun);
}
}
}

View File

@ -1,23 +0,0 @@
using System;
namespace AMXXRelease
{
//Earth's Special Forces
public class ModEsf : AMod
{
public ModEsf()
{
AddPlugins();
}
public override sealed string GetName()
{
return "esf";
}
private void AddPlugins()
{
AddPlugin("EvolutionX.Core");
}
}
}

View File

@ -1,37 +0,0 @@
using System;
namespace AMXXRelease
{
//Natural Selection
public class ModNs : AMod
{
public ModNs()
{
AddModules();
AddPlugins();
}
public override sealed string GetName()
{
return "ns";
}
private void AddPlugins()
{
AddPlugin("mapchooser");
AddPlugin("nextmap");
AddPlugin("timeleft");
AddPlugin("idlekicker");
AddPlugin("nscommands");
AddPlugin("unstuck");
AddPlugin("plmenu");
}
private void AddModules()
{
Module ns = new Module("ns");
m_Modules.Add(ns);
}
}
}

View File

@ -1,36 +0,0 @@
using System;
namespace AMXXRelease
{
//Team Fortress Classic
public class ModTFC : AMod
{
public ModTFC()
{
AddModules();
AddPlugins();
}
public override sealed string GetName()
{
return "tfc";
}
private void AddPlugins()
{
AddPlugin("plmenu");
AddPlugin("stats_logging");
AddPlugin("statssounds");
AddPlugin("stats");
Plugin pl = AddPlugin("tfcstats");
pl.outdir = "data";
}
private void AddModules()
{
Module tfcx = new Module("tfcx");
m_Modules.Add(tfcx);
}
}
}

View File

@ -1,40 +0,0 @@
using System;
namespace AMXXRelease
{
//The Specialists
public class ModTs : AMod
{
public ModTs()
{
AddModules();
AddPlugins();
}
public override sealed string GetName()
{
return "ts";
}
private void AddPlugins()
{
AddPlugin("stats");
AddPlugin("stats_logging");
AddPlugin("statssounds");
Plugin pl = AddPlugin("tsstats");
pl.outdir = "data";
}
private void AddModules()
{
Module tsx = new Module("tsx");
tsx.sourcedir = "dlls\\ts\\tsx";
Module tsfun = new Module("tsfun");
tsfun.sourcedir = "dlls\\ts\\tsfun";
m_Modules.Add(tsx);
m_Modules.Add(tsfun);
}
}
}

View File

@ -1,33 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 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("AMXX Build Tool")]
[assembly: AssemblyDescription("Build scripts for AMX Mod X")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("AlliedModders, LLC")]
[assembly: AssemblyProduct("AMXX Build Tool")]
[assembly: AssemblyCopyright("(C)Copyright 2004-2008 AlliedModders, LLC")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("83e54c68-616e-4392-9a12-7ff5a27865d4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,100 +0,0 @@
using System;
using System.Diagnostics;
using System.IO;
namespace AMXXRelease
{
//Build process for Windows (32bit)
public class Win32Builder : ABuilder
{
private string m_AmxxPc;
public override void OnBuild()
{
m_AmxxPc = PropSlashes(m_Cfg.GetSourceTree() + "\\plugins\\amxxpc.exe");
}
public override void CompressDir(string target, string dir)
{
ProcessStartInfo info = new ProcessStartInfo();
info.FileName = m_Cfg.CompressPath();
info.WorkingDirectory = dir;
info.Arguments = "-r \"" + target + "-windows.zip\" " + "*.*";
info.UseShellExecute = false;
Process p = Process.Start(info);
p.WaitForExit();
}
public override void AmxxPc(string inpath, string args)
{
ProcessStartInfo info = new ProcessStartInfo();
info.WorkingDirectory = PropSlashes(m_Cfg.GetSourceTree() + "\\plugins");
info.FileName = (string)m_AmxxPc.Clone();
info.Arguments = inpath + ".sma";
if (args != null)
info.Arguments += " " + args;
info.UseShellExecute = false;
info.RedirectStandardOutput = true;
info.RedirectStandardError = true;
Process p = Process.Start(info);
Console.WriteLine(p.StandardOutput.ReadToEnd() + "\n");
p.WaitForExit();
}
public override string GetLibExt()
{
return ".dll";
}
public override string BuildModule(Module module)
{
ProcessStartInfo info = new ProcessStartInfo();
string dir = m_Cfg.GetSourceTree() + "\\" + module.sourcedir;
if (module.bindir != null)
dir += "\\" + module.bindir;
string file = dir;
if (module.bindir == null)
file += "\\" + module.bindir;
file += "\\" + module.build + "\\" + module.projname + ".dll";
file = PropSlashes(file);
if (File.Exists(file))
File.Delete(file);
string args = m_Cfg.MakeOpts();
if (args != null)
{
info.Arguments = args + " ";
}
else
{
info.Arguments = "";
}
info.WorkingDirectory = PropSlashes(dir);
info.FileName = m_Cfg.DevenvPath();
info.Arguments += module.vcproj + ".sln" + " /p:Configuration=" + module.build + " /t:Rebuild";
info.UseShellExecute = false;
info.RedirectStandardOutput = true;
info.RedirectStandardError = true;
Process p = Process.Start(info);
Console.WriteLine(p.StandardOutput.ReadToEnd());
p.WaitForExit();
p.Close();
if (!File.Exists(file))
{
return null;
}
return file;
}
}
}

View File

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{93EF9F0C-2C25-428C-A13F-B7B7E46B22BB}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>builder</RootNamespace>
<AssemblyName>builder</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ABuilder.cs" />
<Compile Include="AMod.cs" />
<Compile Include="Build.cs" />
<Compile Include="Config.cs" />
<Compile Include="CoreMod.cs" />
<Compile Include="LinuxBuilder.cs" />
<Compile Include="Main.cs" />
<Compile Include="MacBuilder.cs" />
<Compile Include="ModCstrike.cs" />
<Compile Include="ModDoD.cs" />
<Compile Include="ModEsf.cs" />
<Compile Include="ModNs.cs" />
<Compile Include="ModTFC.cs" />
<Compile Include="ModTs.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Win32Builder.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Binary file not shown.

View File

@ -1,20 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "builder", "builder.csproj", "{93EF9F0C-2C25-428C-A13F-B7B7E46B22BB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{93EF9F0C-2C25-428C-A13F-B7B7E46B22BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{93EF9F0C-2C25-428C-A13F-B7B7E46B22BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{93EF9F0C-2C25-428C-A13F-B7B7E46B22BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{93EF9F0C-2C25-428C-A13F-B7B7E46B22BB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,6 +0,0 @@
compress = /bin/tar
source = /home/users/dvander/amxmodx/trunk
makeopts =
output = /home/users/dvander/done
devenv = /usr/bin/make
release = amxmodx-1.8.1

View File

@ -1,6 +0,0 @@
compress = /bin/tar
source = /home/dvander/code/amxx
makeopts = amd64
output = /home/dvander/done
devenv = /usr/bin/make
release = amxmodx-1.8.1

View File

@ -1,6 +0,0 @@
compress = /usr/bin/zip
source = /Users/Scott/Code/hl/amxmodx-central
makeopts =
output = /Users/Scott/Code/hl/amxmodx-bin
devenv = /usr/bin/make
release = amxmodx-1.8.2

View File

@ -1,6 +0,0 @@
compress = C:\WINDOWS\zip.exe
source = c:\temp\amxmodx
makeopts =
output = c:\temp\done
devenv = C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
release = amxmodx-1.8.1