Initial import of new build system (bug 3977).

This commit is contained in:
David Anderson
2009-08-29 18:45:55 -07:00
parent 4bce2a8a44
commit 20eae5e394
152 changed files with 1496 additions and 3151 deletions
+226
View File
@@ -0,0 +1,226 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
import os
import shutil
import ambuild.osutil as osutil
from ambuild.command import Command
job = AMBuild.AddJob('package')
class DestroyPath(Command):
def __init__(self, folder):
Command.__init__(self)
self.folder = folder
def destroy(self, path):
entries = os.listdir(path)
for entry in entries:
newpath = os.path.join(path, entry)
if os.path.isdir(newpath):
self.destroy(newpath)
os.rmdir(newpath)
elif os.path.isfile(newpath):
os.remove(newpath)
def run(self, runner, job):
runner.PrintOut('rm -rf {0}/*'.format(self.folder))
self.destroy(self.folder)
class CreateFolders(Command):
def __init__(self, folders):
Command.__init__(self)
self.folders = folders
def run(self, runner, job):
for folder in self.folders:
path = os.path.join(*folder)
runner.PrintOut('mkdir {0}'.format(path))
os.makedirs(path)
#Shallow folder copy
class CopyFolder(Command):
def __init__(self, fromList, toList, excludes = []):
Command.__init__(self)
self.fromPath = os.path.join(AMBuild.sourceFolder, *fromList)
self.toPath = os.path.join(*toList)
self.excludes = excludes
def run(self, runner, job):
entries = os.listdir(self.fromPath)
for entry in entries:
if entry in self.excludes:
continue
path = os.path.join(self.fromPath, entry)
if not os.path.isfile(path):
continue
runner.PrintOut('copy {0} to {1}'.format(path, self.toPath))
shutil.copy(path, self.toPath)
#Single file copy
class CopyFile(Command):
def __init__(self, fromFile, toPath):
Command.__init__(self)
self.fromFile = fromFile
self.toPath = toPath
def run(self, runner, job):
runner.PrintOut('copy {0} to {1}'.format(self.fromFile, self.toPath))
shutil.copy(self.fromFile, self.toPath)
folders = [['addons', 'sourcemod', 'bin'],
['addons', 'sourcemod', 'plugins', 'disabled'],
['addons', 'sourcemod', 'gamedata'],
['addons', 'sourcemod', 'gamedata', 'core.games'],
['addons', 'sourcemod', 'gamedata', 'sdktools.games'],
['addons', 'sourcemod', 'configs', 'geoip'],
['addons', 'sourcemod', 'translations'],
['addons', 'sourcemod', 'logs'],
['addons', 'sourcemod', 'extensions'],
['addons', 'sourcemod', 'data'],
['addons', 'sourcemod', 'scripting', 'include'],
['addons', 'sourcemod', 'scripting', 'admin-flatfile'],
['addons', 'sourcemod', 'scripting', 'adminmenu'],
['addons', 'sourcemod', 'scripting', 'testsuite'],
['cfg', 'sourcemod'],
['addons', 'sourcemod', 'configs', 'sql-init-scripts'],
['addons', 'sourcemod', 'configs', 'sql-init-scripts', 'mysql'],
['addons', 'sourcemod', 'configs', 'sql-init-scripts', 'sqlite'],
['addons', 'sourcemod', 'scripting', 'basecommands'],
['addons', 'sourcemod', 'scripting', 'basecomm'],
['addons', 'sourcemod', 'scripting', 'funvotes'],
['addons', 'sourcemod', 'scripting', 'basevotes'],
['addons', 'sourcemod', 'scripting', 'basebans'],
['addons', 'sourcemod', 'scripting', 'funcommands'],
['addons', 'sourcemod', 'scripting', 'playercommands'],
['addons', 'metamod'],
]
#Setup
job.AddCommand(DestroyPath(os.path.join(AMBuild.outputFolder, 'package')))
job.AddCommand(CreateFolders(folders))
#Copy Folders
job.AddCommand(CopyFolder(['configs'], ['addons', 'sourcemod', 'configs']))
job.AddCommand(CopyFolder(['configs', 'geoip'], ['addons', 'sourcemod', 'configs', 'geoip']))
job.AddCommand(CopyFolder(['configs', 'cfg'], ['cfg', 'sourcemod']))
job.AddCommand(CopyFolder(['configs', 'metamod'], ['addons', 'metamod']))
job.AddCommand(CopyFolder(['configs', 'sql-init-scripts'],
['addons', 'sourcemod', 'configs', 'sql-init-scripts']))
job.AddCommand(CopyFolder(['configs', 'sql-init-scripts', 'mysql'],
['addons', 'sourcemod', 'configs', 'sql-init-scripts', 'mysql']))
job.AddCommand(CopyFolder(['configs', 'sql-init-scripts', 'sqlite'],
['addons', 'sourcemod', 'configs', 'sql-init-scripts', 'sqlite']))
job.AddCommand(CopyFolder(['gamedata'], ['addons', 'sourcemod', 'gamedata']))
job.AddCommand(CopyFolder(['gamedata', 'sdktools.games'],
['addons', 'sourcemod', 'gamedata', 'sdktools.games']))
job.AddCommand(CopyFolder(['gamedata', 'core.games'],
['addons', 'sourcemod', 'gamedata', 'core.games']))
job.AddCommand(CopyFolder(['plugins'], ['addons', 'sourcemod', 'scripting'], ['AMBuilder']))
job.AddCommand(CopyFolder(['plugins', 'include'],
['addons', 'sourcemod', 'scripting', 'include']))
job.AddCommand(CopyFolder(['translations'], ['addons', 'sourcemod', 'translations']))
job.AddCommand(CopyFolder(['public', 'licenses'], ['addons', 'sourcemod']))
job.AddCommand(CopyFolder(['plugins', 'admin-flatfile'],
['addons', 'sourcemod', 'scripting', 'admin-flatfile']))
job.AddCommand(CopyFolder(['plugins', 'adminmenu'],
['addons', 'sourcemod', 'scripting', 'adminmenu']))
job.AddCommand(CopyFolder(['plugins', 'testsuite'],
['addons', 'sourcemod', 'scripting', 'testsuite']))
job.AddCommand(CopyFolder(['plugins', 'basecommands'],
['addons', 'sourcemod', 'scripting', 'basecommands']))
job.AddCommand(CopyFolder(['plugins', 'basecomm'],
['addons', 'sourcemod', 'scripting', 'basecomm']))
job.AddCommand(CopyFolder(['plugins', 'funvotes'],
['addons', 'sourcemod', 'scripting', 'funvotes']))
job.AddCommand(CopyFolder(['plugins', 'basevotes'],
['addons', 'sourcemod', 'scripting', 'basevotes']))
job.AddCommand(CopyFolder(['plugins', 'basebans'],
['addons', 'sourcemod', 'scripting', 'basebans']))
job.AddCommand(CopyFolder(['plugins', 'funcommands'],
['addons', 'sourcemod', 'scripting', 'funcommands']))
job.AddCommand(CopyFolder(['plugins', 'playercommands'],
['addons', 'sourcemod', 'scripting', 'playercommands']))
defPlugins = [
'admin-flatfile',
'adminhelp',
'antiflood',
'basecommands',
'reservedslots',
'basetriggers',
'nextmap',
'basechat',
'funcommands',
'basevotes',
'funvotes',
'basebans',
'basecomm',
'adminmenu',
'playercommands',
'clientprefs',
'sounds'
]
disPlugins = [
'admin-sql-prefetch',
'admin-sql-threaded',
'sql-admin-manager',
'mapchooser',
'randomcycle',
'rockthevote',
'nominations'
]
commands = []
for plugin in defPlugins:
commands.append(CopyFile(os.path.join('..', 'plugins', plugin + '.smx'),
os.path.join('addons', 'sourcemod', 'plugins')))
for plugin in disPlugins:
commands.append(CopyFile(os.path.join('..', 'plugins', plugin + '.smx'),
os.path.join('addons', 'sourcemod', 'plugins', 'disabled')))
job.AddCommandGroup(commands)
bincopies = []
def AddNormalLibrary(name, dest):
dest = os.path.join('addons', 'sourcemod', dest)
bincopies.append(CopyFile(os.path.join('..', name, name + osutil.SharedLibSuffix()), dest))
def AddHL2Library(name, dest):
for i in SM.sdkInfo:
sdk = SM.sdkInfo[i]
AddNormalLibrary(name + '.' + sdk['ext'], dest)
if AMBuild.target['platform'] == 'linux':
bincopies.append(CopyFile(os.path.join('..', 'loader', 'sourcemod_mm_i486.so'),
os.path.join('addons', 'sourcemod', 'bin')))
elif AMBuild.target['platform'] == 'windows':
bincopies.append(CopyFile(os.path.join('..', 'loader', 'sourcemod_mm.dll'),
os.path.join('addons', 'sourcemod', 'bin')))
AddHL2Library('sourcemod', 'bin')
AddNormalLibrary('sourcepawn.jit.x86', 'bin')
AddNormalLibrary('geoip.ext', 'extensions')
AddNormalLibrary('dbi.mysql.ext', 'extensions')
AddNormalLibrary('dbi.sqlite.ext', 'extensions')
AddNormalLibrary('game.cstrike.ext.1.ep1', 'extensions')
AddNormalLibrary('game.tf2.ext.2.ep2v', 'extensions')
AddNormalLibrary('topmenus.ext', 'extensions')
AddNormalLibrary('regex.ext', 'extensions')
AddNormalLibrary('webternet.ext', 'extensions')
AddNormalLibrary('clientprefs.ext', 'extensions')
AddNormalLibrary('updater.ext', 'extensions')
AddHL2Library('bintools.ext', 'extensions')
AddHL2Library('sdktools.ext', 'extensions')
bincopies.append(CopyFile(os.path.join('..', 'spcomp', 'spcomp' + osutil.ExecutableSuffix()),
os.path.join('addons', 'sourcemod', 'scripting')))
job.AddCommandGroup(bincopies)
if AMBuild.target['platform'] == 'windows':
job.AddCommand(CopyFile(
os.path.join(AMBuild.sourceFolder, 'sourcepawn', 'batchtool', 'compile.exe'),
os.path.join('addons', 'sourcemod', 'scripting')))
-202
View File
@@ -1,202 +0,0 @@
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(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 ((libs[i].platform & cfg.Platform) != cfg.Platform)
{
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);
}
}
}
}
}
}
-58
View File
@@ -1,58 +0,0 @@
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("")]
-111
View File
@@ -1,111 +0,0 @@
using System;
using System.IO;
using System.Text;
namespace builder
{
[Flags]
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;
}
}
}
-133
View File
@@ -1,133 +0,0 @@
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_Episode2Valve)
{
output_folder += ".orangeboxvalve";
}
else if (lib.build_mode == BuildMode.BuildMode_OldMetamod)
{
output_folder += ".original";
}
else if (lib.build_mode == BuildMode.BuildMode_Left4Dead)
{
output_folder += ".left4dead";
}
string binpath = Config.PathFormat("{0}/{1}/{2}",
path,
output_folder,
binName);
if (File.Exists(binpath))
{
File.Delete(binpath);
}
string makefile_args = "CPP=gcc-4.1 ";
if (lib.build_mode == BuildMode.BuildMode_Episode1)
{
}
else if (lib.build_mode == BuildMode.BuildMode_Episode2)
{
makefile_args += "ENGINE=\"orangebox\" ";
}
else if (lib.build_mode == BuildMode.BuildMode_Episode2Valve)
{
makefile_args += "ENGINE=\"orangeboxvalve\" ";
}
else if (lib.build_mode == BuildMode.BuildMode_OldMetamod)
{
makefile_args += "ENGINE=\"original\"";
}
else if (lib.build_mode == BuildMode.BuildMode_Left4Dead)
{
makefile_args += "ENGINE=\"left4dead\"";
}
/* 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;
}
}
}
-56
View File
@@ -1,56 +0,0 @@
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);
/* Do not delete this file anymore. We don't support rebuilds, and thus the file
* is guaranteed to be wiped by buildbot.
*/
/*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, exception: " + e.Message);
Environment.Exit(1);
}
Environment.Exit(0);
}
}
}
-15
View File
@@ -1,15 +0,0 @@
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)
-108
View File
@@ -1,108 +0,0 @@
using System;
namespace builder
{
public enum ReleaseMode : int
{
ReleaseMode_Release,
ReleaseMode_Debug,
};
public enum BuildMode : int
{
BuildMode_Simple,
BuildMode_OldMetamod,
BuildMode_DarkMessiah,
BuildMode_Episode1,
BuildMode_Episode2,
BuildMode_Episode2Valve,
BuildMode_Left4Dead
};
public class Library
{
public Library()
{
has_platform_ext = false;
is_executable = false;
release_mode = ReleaseMode.ReleaseMode_Release;
build_mode = BuildMode.BuildMode_Simple;
platform = BasePlatform.Platform_Linux | BasePlatform.Platform_Windows;
}
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 BasePlatform platform; /* Platforms for which the binary should be built */
};
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();
}
}
-403
View File
@@ -1,403 +0,0 @@
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/gamedata/core.games");
folders.Add("addons/sourcemod/gamedata/sdktools.games");
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/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/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, "gamedata/sdktools.games", "addons/sourcemod/gamedata/sdktools.games", null);
builder.CopyFolder(this, "gamedata/core.games", "addons/sourcemod/gamedata/core.games", 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.darkm";
lib.vcproj_name = "sourcemod_mm";
lib.build_mode = BuildMode.BuildMode_DarkMessiah;
lib.platform = BasePlatform.Platform_Windows;
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 = "core";
lib.binary_name = "sourcemod.2.ep2v";
lib.vcproj_name = "sourcemod_mm";
lib.build_mode = BuildMode.BuildMode_Episode2Valve;
libraries.Add(lib);
lib = new Library();
lib.package_path = "addons/sourcemod/bin";
lib.source_path = "core";
lib.binary_name = "sourcemod.2.l4d";
lib.vcproj_name = "sourcemod_mm";
lib.build_mode = BuildMode.BuildMode_Left4Dead;
libraries.Add(lib);
lib = new Library();
lib.package_path = "addons/sourcemod/bin";
lib.source_path = "sourcepawn/jit";
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.1.ep1";
lib.vcproj_name = "bintools";
lib.build_mode = BuildMode.BuildMode_OldMetamod;
libraries.Add(lib);
lib = new Library();
lib.package_path = "addons/sourcemod/extensions";
lib.source_path = "extensions/bintools";
lib.binary_name = "bintools.ext.2.darkm";
lib.vcproj_name = "bintools";
lib.build_mode = BuildMode.BuildMode_DarkMessiah;
lib.platform = BasePlatform.Platform_Windows;
libraries.Add(lib);
lib = new Library();
lib.package_path = "addons/sourcemod/extensions";
lib.source_path = "extensions/bintools";
lib.binary_name = "bintools.ext.2.ep2";
lib.vcproj_name = "bintools";
lib.build_mode = BuildMode.BuildMode_Episode2;
libraries.Add(lib);
lib = new Library();
lib.package_path = "addons/sourcemod/extensions";
lib.source_path = "extensions/bintools";
lib.binary_name = "bintools.ext.2.ep2v";
lib.vcproj_name = "bintools";
lib.build_mode = BuildMode.BuildMode_Episode2Valve;
libraries.Add(lib);
lib = new Library();
lib.package_path = "addons/sourcemod/extensions";
lib.source_path = "extensions/bintools";
lib.binary_name = "bintools.ext.2.l4d";
lib.vcproj_name = "bintools";
lib.build_mode = BuildMode.BuildMode_Left4Dead;
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";
lib.source_path = "extensions/sdktools";
lib.binary_name = "sdktools.ext.1.ep1";
lib.vcproj_name = "sdktools";
lib.build_mode = BuildMode.BuildMode_OldMetamod;
libraries.Add(lib);
lib = new Library();
lib.package_path = "addons/sourcemod/extensions";
lib.source_path = "extensions/sdktools";
lib.binary_name = "sdktools.ext.2.darkm";
lib.vcproj_name = "sdktools";
lib.build_mode = BuildMode.BuildMode_DarkMessiah;
lib.platform = BasePlatform.Platform_Windows;
libraries.Add(lib);
lib = new Library();
lib.package_path = "addons/sourcemod/extensions";
lib.source_path = "extensions/sdktools";
lib.binary_name = "sdktools.ext.2.ep2";
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/sdktools";
lib.binary_name = "sdktools.ext.2.ep2v";
lib.vcproj_name = "sdktools";
lib.build_mode = BuildMode.BuildMode_Episode2Valve;
libraries.Add(lib);
lib = new Library();
lib.package_path = "addons/sourcemod/extensions";
lib.source_path = "extensions/sdktools";
lib.binary_name = "sdktools.ext.2.l4d";
lib.vcproj_name = "sdktools";
lib.build_mode = BuildMode.BuildMode_Left4Dead;
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";
lib.source_path = "extensions/cstrike";
lib.binary_name = "game.cstrike.ext.1.ep1";
lib.vcproj_name = "cstrike";
lib.build_mode = BuildMode.BuildMode_OldMetamod;
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);
lib = new Library();
lib.package_path = "addons/sourcemod/extensions";
lib.source_path = "extensions/tf2";
lib.binary_name = "game.tf2.ext.2.ep2v";
lib.vcproj_name = "tf2";
lib.build_mode = BuildMode.BuildMode_Episode2Valve;
libraries.Add(lib);
lib = new Library();
lib.package_path = "addons/sourcemod/extensions";
lib.source_path = "extensions/regex";
lib.binary_name = "regex.ext";
lib.vcproj_name = "regex";
libraries.Add(lib);
lib = new Library();
lib.package_path = "addons/sourcemod/extensions";
lib.source_path = "extensions/clientprefs";
lib.binary_name = "clientprefs.ext";
lib.vcproj_name = "clientprefs";
libraries.Add(lib);
lib = new Library();
lib.package_path = "addons/sourcemod/extensions";
lib.source_path = "extensions/curl";
lib.binary_name = "webternet.ext";
lib.vcproj_name = "curl";
libraries.Add(lib);
lib = new Library();
lib.package_path = "addons/sourcemod/extensions";
lib.source_path = "extensions/updater";
lib.binary_name = "updater.ext";
lib.vcproj_name = "updater";
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"));
plugins.Add(new Plugin("clientprefs"));
plugins.Add(new Plugin("nominations", true));
plugins.Add(new Plugin("sounds"));
return (Plugin [])plugins.ToArray(typeof(Plugin));
}
}
}
-128
View File
@@ -1,128 +0,0 @@
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}/msvc9",
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_DarkMessiah)
{
config_name = config_name + " - Dark Messiah";
}
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_Episode2Valve)
{
config_name = config_name + " - Orange Box Valve";
}
else if (lib.build_mode == BuildMode.BuildMode_OldMetamod)
{
config_name = config_name + " - Old Metamod";
}
else if (lib.build_mode == BuildMode.BuildMode_Left4Dead)
{
config_name = config_name + " - Left 4 Dead";
}
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 \"" + project_file + "\" \"" + config_name + "\"";
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;
}
}
}
-4
View File
@@ -1,4 +0,0 @@
OutputBase = /home/dvander/bin
SourceBase = /home/dvander/sourcemod/trunk
BuilderPath = /usr/bin/make
-3
View File
@@ -1,3 +0,0 @@
OutputBase = c:\real\done
SourceBase = r:\sourcemod\trunk
BuilderPath = C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com
-121
View File
@@ -1,121 +0,0 @@
<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{BFC4EB78-4C3E-4C81-8EAD-5A1A2F126512}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>builder</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Exe</OutputType>
<RootNamespace>builder</RootNamespace>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>0.0</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>true</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>full</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>false</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>true</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>none</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.XML">
<Name>System.XML</Name>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ABuilder.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Config.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="LinuxBuilder.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Main.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Package.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="PkgCore.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Win32Builder.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
-19
View File
@@ -1,19 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "builder", "builder.csproj", "{BFC4EB78-4C3E-4C81-8EAD-5A1A2F126512}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BFC4EB78-4C3E-4C81-8EAD-5A1A2F126512}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BFC4EB78-4C3E-4C81-8EAD-5A1A2F126512}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BFC4EB78-4C3E-4C81-8EAD-5A1A2F126512}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BFC4EB78-4C3E-4C81-8EAD-5A1A2F126512}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
-140
View File
@@ -1,140 +0,0 @@
#!/usr/bin/perl
our %arguments =
(
'config' => 'modules.versions',
'major' => '1',
'minor' => '0',
'revision' => '0',
'build' => undef,
'path' => '',
'buildstring' => '',
);
my $arg;
foreach $arg (@ARGV)
{
$arg =~ s/--//;
@arg = split(/=/, $arg);
$arguments{$arg[0]} = $arg[1];
}
#Set up path info
if ($arguments{'path'} ne "")
{
if (!(-d $arguments{'path'}))
{
die "Unable to find path: " . $arguments{'path'} ."\n";
}
chdir($arguments{'path'});
}
if (!open(CONFIG, $arguments{'config'}))
{
die "Unable to open config file for reading: " . $arguments{'config'} . "\n";
}
our %modules;
my $cur_module = undef;
my $line;
while (<CONFIG>)
{
chomp;
$line = $_;
if ($line =~ /^\[([^\]]+)\]$/)
{
$cur_module = $1;
next;
}
if (!$cur_module)
{
next;
}
if ($line =~ /^([^=]+) = (.+)$/)
{
$modules{$cur_module}{$1} = $2;
}
}
close(CONFIG);
#Copy global configuration options...
if (exists($modules{'PRODUCT'}))
{
if (exists($modules{'PRODUCT'}{'major'}))
{
$arguments{'major'} = $modules{'PRODUCT'}{'major'};
}
if (exists($modules{'PRODUCT'}{'minor'}))
{
$arguments{'minor'} = $modules{'PRODUCT'}{'minor'};
}
if (exists($modules{'PRODUCT'}{'revision'}))
{
$arguments{'revision'} = $modules{'PRODUCT'}{'revision'};
}
}
#Get the global SVN revision if we have none
my $rev;
if ($arguments{'build'} == undef)
{
my ($text);
$text = `hg identif -n -i`;
chomp $text;
$text =~ s/\+//g;
my ($id,$num) = split(/ /, $text);
$rev = "$num:$id";
}
else
{
$rev = int($arguments{'build'});
}
my $major = $arguments{'major'};
my $minor = $arguments{'minor'};
my $revision = $arguments{'revision'};
my $buildstr = $arguments{'buildstring'};
#Go through everything now
my $mod_i;
while ( ($cur_module, $mod_i) = each(%modules) )
{
#Skip the magic one
if ($cur_module eq "PRODUCT")
{
next;
}
#Prepare path
my %mod = %{$mod_i};
my $infile = $mod{'in'};
my $outfile = $mod{'out'};
if ($mod{'folder'})
{
if (!(-d $mod{'folder'}))
{
die "Folder " . $mod{'folder'} . " not found.\n";
}
$infile = $mod{'folder'} . '/' . $infile;
$outfile = $mod{'folder'} . '/' . $outfile;
}
if (!(-f $infile))
{
die "File $infile is not a file.\n";
}
#Start rewriting
open(INFILE, $infile) or die "Could not open file for reading: $infile\n";
open(OUTFILE, '>'.$outfile) or die "Could not open file for writing: $outfile\n";
while (<INFILE>)
{
s/\$PMAJOR\$/$major/g;
s/\$PMINOR\$/$minor/g;
s/\$PREVISION\$/$revision/g;
s/\$BUILD_ID\$/$rev/g;
s/\$BUILD_STRING\$/$buildstr/g;
print OUTFILE $_;
}
close(OUTFILE);
close(INFILE);
}