Full packaging and buildbot support.
Full packaging and buildbot support.
1.1 --- a/AMBuildScript Sat Apr 16 00:41:25 2011 -0700
1.2 +++ b/AMBuildScript Sat Apr 16 01:16:39 2011 -0700
1.3 @@ -9,7 +9,7 @@
1.4
1.5 #Build SDK info
1.6 self.sdkInfo = { }
1.7 - self.sdkInfo['ep2v'] = {'sdk': 'HL2SDKOBVALVE', 'ext': '16.ep2v', 'def': '5',
1.8 + self.sdkInfo['ep2v'] = {'sdk': 'HL2SDKOBVALVE', 'ext': '', 'def': '5',
1.9 'name': 'ORANGEBOXVALVE', 'platform': ['windows', 'linux', 'darwin']}
1.10
1.11 if AMBuild.mode == 'config':
1.12 @@ -314,7 +314,9 @@
1.13 AMBuild.Include(os.path.join('buildbot', 'Versioning'), globals)
1.14
1.15 FileList = [
1.16 - ['AMBuilder'],
1.17 + ['ExtensionBuilder'],
1.18 + ['PluginBuilder'],
1.19 + ['PackageScript']
1.20 ]
1.21
1.22 for parts in FileList:
2.1 --- a/AMBuilder Sat Apr 16 00:41:25 2011 -0700
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,28 +0,0 @@
2.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
2.5 -import os
2.6 -
2.7 -sdk = CSSDM.sdkInfo['ep2v']
2.8 -
2.9 -compiler = CSSDM.DefaultHL2Compiler('.', 'ep2v')
2.10 -compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'sdk'))
2.11 -
2.12 -name = 'cssdm.ext.' + sdk['ext']
2.13 -extension = AMBuild.AddJob(name)
2.14 -binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
2.15 -CSSDM.PreSetupHL2Job(extension, binary, 'ep2v')
2.16 -binary.AddSourceFiles('.', [
2.17 - 'cssdm_callbacks.cpp',
2.18 - 'cssdm_config.cpp',
2.19 - 'cssdm_ctrl.cpp',
2.20 - 'cssdm_detours.cpp',
2.21 - 'cssdm_events.cpp',
2.22 - 'cssdm_ffa.cpp',
2.23 - 'cssdm_main.cpp',
2.24 - 'cssdm_players.cpp',
2.25 - 'cssdm_utils.cpp',
2.26 - 'cssdm_weapons.cpp',
2.27 - ])
2.28 -CSSDM.PostSetupHL2Job(extension, binary, 'ep2v')
2.29 -CSSDM.AutoVersion('.', binary)
2.30 -binary.SendToJob()
2.31 -
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/ExtensionBuilder Sat Apr 16 01:16:39 2011 -0700
3.3 @@ -0,0 +1,28 @@
3.4 +# vim: set ts=2 sw=2 tw=99 noet ft=python:
3.5 +import os
3.6 +
3.7 +sdk = CSSDM.sdkInfo['ep2v']
3.8 +
3.9 +compiler = CSSDM.DefaultHL2Compiler('.', 'ep2v')
3.10 +compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'sdk'))
3.11 +
3.12 +name = 'cssdm.ext' + sdk['ext']
3.13 +extension = AMBuild.AddJob(name)
3.14 +binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
3.15 +CSSDM.PreSetupHL2Job(extension, binary, 'ep2v')
3.16 +binary.AddSourceFiles('.', [
3.17 + 'cssdm_callbacks.cpp',
3.18 + 'cssdm_config.cpp',
3.19 + 'cssdm_ctrl.cpp',
3.20 + 'cssdm_detours.cpp',
3.21 + 'cssdm_events.cpp',
3.22 + 'cssdm_ffa.cpp',
3.23 + 'cssdm_main.cpp',
3.24 + 'cssdm_players.cpp',
3.25 + 'cssdm_utils.cpp',
3.26 + 'cssdm_weapons.cpp',
3.27 + ])
3.28 +CSSDM.PostSetupHL2Job(extension, binary, 'ep2v')
3.29 +CSSDM.AutoVersion('.', binary)
3.30 +binary.SendToJob()
3.31 +
4.1 --- a/PackageScript Sat Apr 16 00:41:25 2011 -0700
4.2 +++ b/PackageScript Sat Apr 16 01:16:39 2011 -0700
4.3 @@ -67,34 +67,48 @@
4.4 shutil.copy(self.fromFile, self.toPath)
4.5
4.6
4.7 -folders = [['addons', 'metamod'],
4.8 - ['addons', 'stripper'],
4.9 - ['addons', 'stripper', 'bin'],
4.10 - ['addons', 'stripper', 'dumps'],
4.11 - ['addons', 'stripper', 'maps']]
4.12 +folders = [['addons', 'cfg'],
4.13 + ['addons', 'cfg', 'cssdm'],
4.14 + ['addons', 'cfg', 'cssdm', 'extra'],
4.15 + ['addons', 'cfg', 'cssdm', 'maps'],
4.16 + ['addons', 'cfg', 'cssdm', 'spawns'],
4.17 + ['addons', 'sourcemod'],
4.18 + ['addons', 'sourcemod', 'extensions'],
4.19 + ['addons', 'sourcemod', 'gamedata'],
4.20 + ['addons', 'sourcemod', 'plugins'],
4.21 + ['addons', 'sourcemod', 'plugins', 'cssdm'],
4.22 + ['addons', 'sourcemod', 'scripting'],
4.23 + ['addons', 'sourcemod', 'scripting', 'include'],
4.24 + ['addons', 'sourcemod', 'translations']]
4.25
4.26 #Setup
4.27 job.AddCommand(DestroyPath(os.path.join(AMBuild.outputFolder, 'package')))
4.28 job.AddCommand(CreateFolders(folders))
4.29
4.30 -#Copiy Files
4.31 -job.AddCommand(CopyFile(os.path.join(AMBuild.sourceFolder, 'de_dust.cfg'),
4.32 - os.path.join('addons', 'stripper', 'maps')))
4.33 -job.AddCommand(CopyFile(os.path.join(AMBuild.sourceFolder, 'global_filters.cfg'),
4.34 - os.path.join('addons', 'stripper')))
4.35 -job.AddCommand(CopyFile(os.path.join(AMBuild.sourceFolder, 'stripper.vdf'),
4.36 - os.path.join('addons', 'metamod')))
4.37 +#Copy Files
4.38 +job.AddCommand(CopyFolder(['gamedata'], ['addons', 'sourcemod', 'gamedata']))
4.39 +job.AddCommand(CopyFolder(['scripting'], ['addons', 'sourcemod', 'scripting']))
4.40 +job.AddCommand(CopyFolder(['scripting', 'include'], ['addons', 'sourcemod', 'scripting', 'include']))
4.41 +job.AddCommand(CopyFolder(['translations'], ['addons', 'sourcemod', 'translations']))
4.42 +job.AddCommand(CopyFolder(['cfg'], ['addons', 'cfg', 'cssdm']))
4.43 +job.AddCommand(CopyFolder(['cfg', 'spawns'], ['addons', 'cfg', 'cssdm', 'spawns']))
4.44 +job.AddCommand(CopyFile(os.path.join(AMBuild.sourceFolder, 'license.txt'),
4.45 + os.path.join('addons', 'cfg', 'extra')))
4.46 +job.AddCommand(CopyFile(os.path.join(AMBuild.sourceFolder, 'changelog.txt'),
4.47 + os.path.join('addons', 'cfg', 'extra')))
4.48 +job.AddCommand(CopyFile(os.path.join(AMBuild.sourceFolder, 'credits.txt'),
4.49 + os.path.join('addons', 'cfg', 'extra')))
4.50
4.51 bincopies = []
4.52
4.53 def AddNormalLibrary(name, dest):
4.54 - dest = os.path.join('addons', 'stripper', dest)
4.55 + dest = os.path.join('addons', 'sourcemod', dest)
4.56 bincopies.append(CopyFile(os.path.join('..', name, name + osutil.SharedLibSuffix()), dest))
4.57 pdb_list.append(name + '\\' + name + '.pdb')
4.58
4.59 def AddHL2Library(name, dest):
4.60 - for i in Stripper.sdkInfo:
4.61 - sdk = Stripper.sdkInfo[i]
4.62 + for i in CSSDM.sdkInfo:
4.63 + sdk = CSSDM.sdkInfo[i]
4.64 if AMBuild.target['platform'] not in sdk['platform']:
4.65 continue
4.66 AddNormalLibrary(name + '.' + sdk['ext'], dest)
4.67 @@ -102,12 +116,7 @@
4.68 pdb_list = []
4.69
4.70 # Copy loader binaries
4.71 -if AMBuild.target['platform'] == 'linux':
4.72 - AddNormalLibrary('stripper_mm_i486', 'bin')
4.73 -else:
4.74 - AddNormalLibrary('stripper_mm', 'bin')
4.75 -AddNormalLibrary('stripper.core', 'bin')
4.76 -AddHL2Library('stripper', 'bin')
4.77 +AddNormalLibrary('cssdm.ext', 'extensions')
4.78
4.79 job.AddCommandGroup(bincopies)
4.80
4.81 @@ -117,4 +126,18 @@
4.82 pdblog.write(pdb + '\n')
4.83 pdblog.close()
4.84
4.85 +# Copy plugins
4.86 +plugins = [
4.87 + 'dm_basics',
4.88 + 'dm_bot_quotas',
4.89 + 'dm_equipment',
4.90 + 'dm_preset_spawns',
4.91 + 'dm_spawn_protection'
4.92 +]
4.93
4.94 +commands = []
4.95 +for plugin in plugins:
4.96 + commands.append(CopyFile(os.path.join('..', 'plugins', plugin + '.smx'),
4.97 + os.path.join('addons', 'sourcemod', 'plugins', 'cssdm')))
4.98 +job.AddCommandGroup(commands)
4.99 +
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/PluginBuilder Sat Apr 16 01:16:39 2011 -0700
5.3 @@ -0,0 +1,27 @@
5.4 +# vim: set ts=2 sw=2 tw=99 noet ft=python:
5.5 +import os
5.6 +import os.path
5.7 +import ambuild.osutil as osutil
5.8 +import ambuild.command as command
5.9 +
5.10 +files = [
5.11 + 'dm_basics.sp',
5.12 + 'dm_bot_quotas.sp',
5.13 + 'dm_equipment.sp',
5.14 + 'dm_preset_spawns.sp',
5.15 + 'dm_spawn_protection.sp'
5.16 +]
5.17 +
5.18 +plugins = AMBuild.AddJob('plugins')
5.19 +
5.20 +spcomp = os.path.join(CSSDM.smBinPath, 'addons', 'sourcemod', 'scripting', 'spcomp')
5.21 +includes = os.path.relpath(os.path.join(AMBuild.sourceFolder, 'scripting', 'include'),
5.22 + os.path.join(AMBuild.outputFolder, 'scripting'))
5.23 +
5.24 +#Do the normal ones
5.25 +for file in files:
5.26 + sp = os.path.join(AMBuild.sourceFolder, 'scripting', file)
5.27 + args = [spcomp, '-i' + includes, sp]
5.28 + plugins.AddCommand(command.DirectCommand(args))
5.29 +
5.30 +
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/buildbot/bootstrap.pl Sat Apr 16 01:16:39 2011 -0700
6.3 @@ -0,0 +1,75 @@
6.4 +#!/usr/bin/perl
6.5 +# vim: set ts=2 sw=2 tw=99 noet:
6.6 +
6.7 +use strict;
6.8 +use Cwd;
6.9 +use File::Basename;
6.10 +use File::Path;
6.11 +
6.12 +my ($myself, $path) = fileparse($0);
6.13 +chdir($path);
6.14 +
6.15 +require 'helpers.pm';
6.16 +
6.17 +#Go back above build dir
6.18 +chdir(Build::PathFormat('../..'));
6.19 +
6.20 +#Get the source path.
6.21 +our ($root) = getcwd();
6.22 +
6.23 +my $reconf = 0;
6.24 +
6.25 +#Create output folder if it doesn't exist.
6.26 +if (!(-d 'OUTPUT')) {
6.27 + $reconf = 1;
6.28 +} else {
6.29 + if (-f 'OUTPUT/sentinel') {
6.30 + my @s = stat('OUTPUT/sentinel');
6.31 + my $mtime = $s[9];
6.32 + my @files = ('build/pushbuild.txt', 'build/AMBuildScript', 'build/product.version');
6.33 + my ($i);
6.34 + for ($i = 0; $i <= $#files; $i++) {
6.35 + if (IsNewer($files[$i], $mtime)) {
6.36 + $reconf = 1;
6.37 + last;
6.38 + }
6.39 + }
6.40 + } else {
6.41 + $reconf = 1;
6.42 + }
6.43 +}
6.44 +
6.45 +if ($reconf) {
6.46 + rmtree('OUTPUT');
6.47 + mkdir('OUTPUT') or die("Failed to create output folder: $!\n");
6.48 + chdir('OUTPUT');
6.49 + my ($result);
6.50 + print "Attempting to reconfigure...\n";
6.51 + if ($^O eq "linux") {
6.52 + $result = `CC=gcc-4.1 CXX=gcc-4.1 python3.1 ../build/configure.py --enable-optimize`;
6.53 + } elsif ($^O eq "darwin") {
6.54 + $result = `CC=gcc-4.2 CXX=gcc-4.2 python3.1 ../build/configure.py --enable-optimize`;
6.55 + } else {
6.56 + $result = `C:\\Python31\\Python.exe ..\\build\\configure.py --enable-optimize`;
6.57 + }
6.58 + print "$result\n";
6.59 + if ($? != 0) {
6.60 + die('Could not configure!');
6.61 + }
6.62 + open(FILE, '>sentinel');
6.63 + print FILE "this is nothing.\n";
6.64 + close(FILE);
6.65 +}
6.66 +
6.67 +sub IsNewer
6.68 +{
6.69 + my ($file, $time) = (@_);
6.70 +
6.71 + my @s = stat($file);
6.72 + my $mtime = $s[9];
6.73 + return $mtime > $time;
6.74 +}
6.75 +
6.76 +exit(0);
6.77 +
6.78 +
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/buildbot/build_type Sat Apr 16 01:16:39 2011 -0700
7.3 @@ -0,0 +1,1 @@
7.4 +dev
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/buildbot/package.pl Sat Apr 16 01:16:39 2011 -0700
8.3 @@ -0,0 +1,93 @@
8.4 +#!/usr/bin/perl
8.5 +
8.6 +use strict;
8.7 +use Cwd;
8.8 +use File::Basename;
8.9 +use Net::FTP;
8.10 +
8.11 +my ($ftp_file, $ftp_host, $ftp_user, $ftp_pass, $ftp_path);
8.12 +
8.13 +$ftp_file = shift;
8.14 +
8.15 +open(FTP, $ftp_file) or die "Unable to read FTP config file $ftp_file: $!\n";
8.16 +$ftp_host = <FTP>;
8.17 +$ftp_user = <FTP>;
8.18 +$ftp_pass = <FTP>;
8.19 +$ftp_path = <FTP>;
8.20 +close(FTP);
8.21 +
8.22 +chomp $ftp_host;
8.23 +chomp $ftp_user;
8.24 +chomp $ftp_pass;
8.25 +chomp $ftp_path;
8.26 +
8.27 +my ($myself, $path) = fileparse($0);
8.28 +chdir($path);
8.29 +
8.30 +require 'helpers.pm';
8.31 +
8.32 +#Switch to the output folder.
8.33 +chdir(Build::PathFormat('../../OUTPUT/package'));
8.34 +
8.35 +my ($version);
8.36 +
8.37 +$version = Build::ProductVersion(Build::PathFormat('../../build/product.version'));
8.38 +$version =~ s/-dev//g;
8.39 +$version .= '-hg' . Build::HgRevNum('../../build');
8.40 +
8.41 +# Append OS to package version
8.42 +if ($^O eq "darwin")
8.43 +{
8.44 + $version .= '-mac';
8.45 +}
8.46 +elsif ($^O =~ /MSWin/)
8.47 +{
8.48 + $version .= '-windows';
8.49 +}
8.50 +else
8.51 +{
8.52 + $version .= '-' . $^O;
8.53 +}
8.54 +
8.55 +my ($filename);
8.56 +$filename = 'cssdm-' . $version;
8.57 +if ($^O eq "linux")
8.58 +{
8.59 + $filename .= '.tar.gz';
8.60 + print "tar zcvf $filename addons\n";
8.61 + system("tar zcvf $filename addons");
8.62 +}
8.63 +else
8.64 +{
8.65 + $filename .= '.zip';
8.66 + print "zip -r $filename addons\n";
8.67 + system("zip -r $filename addons");
8.68 +}
8.69 +
8.70 +my ($major,$minor) = ($version =~ /^(\d+)\.(\d+)/);
8.71 +$ftp_path .= "/cssdm/$major.$minor";
8.72 +
8.73 +my ($ftp);
8.74 +
8.75 +$ftp = Net::FTP->new($ftp_host, Debug => 0)
8.76 + or die "Cannot connect to host $ftp_host: $@";
8.77 +
8.78 +$ftp->login($ftp_user, $ftp_pass)
8.79 + or die "Cannot connect to host $ftp_host as $ftp_user: " . $ftp->message . "\n";
8.80 +
8.81 +if ($ftp_path ne '')
8.82 +{
8.83 + $ftp->cwd($ftp_path)
8.84 + or die "Cannot change to folder $ftp_path: " . $ftp->message . "\n";
8.85 +}
8.86 +
8.87 +$ftp->binary();
8.88 +$ftp->put($filename)
8.89 + or die "Cannot drop file $filename ($ftp_path): " . $ftp->message . "\n";
8.90 +
8.91 +$ftp->close();
8.92 +
8.93 +print "File sent to drop site as $filename -- build succeeded.\n";
8.94 +
8.95 +exit(0);
8.96 +
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/buildbot/startbuild.pl Sat Apr 16 01:16:39 2011 -0700
9.3 @@ -0,0 +1,27 @@
9.4 +#!/usr/bin/perl
9.5 +# vim: set ts=2 sw=2 tw=99 noet:
9.6 +
9.7 +use File::Basename;
9.8 +
9.9 +my ($myself, $path) = fileparse($0);
9.10 +chdir($path);
9.11 +
9.12 +require 'helpers.pm';
9.13 +
9.14 +chdir('../../OUTPUT');
9.15 +
9.16 +if ($^O eq "linux" || $^O eq "darwin") {
9.17 + system("python3.1 build.py 2>&1");
9.18 +} else {
9.19 + system("C:\\Python31\\python.exe build.py 2>&1");
9.20 +}
9.21 +
9.22 +if ($? != 0)
9.23 +{
9.24 + die "Build failed: $!\n";
9.25 +}
9.26 +else
9.27 +{
9.28 + exit(0);
9.29 +}
9.30 +
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/buildbot/symstore.pl Sat Apr 16 01:16:39 2011 -0700
10.3 @@ -0,0 +1,64 @@
10.4 +#!/usr/bin/perl
10.5 +
10.6 +use File::Basename;
10.7 +
10.8 +my ($myself, $path) = fileparse($0);
10.9 +chdir($path);
10.10 +
10.11 +require 'helpers.pm';
10.12 +
10.13 +chdir('..');
10.14 +
10.15 +open(PDBLOG, '../OUTPUT/pdblog.txt') or die "Could not open pdblog.txt: $!\n";
10.16 +
10.17 +#Get version info
10.18 +my ($version);
10.19 +$version = Build::ProductVersion(Build::PathFormat('product.version'));
10.20 +$version =~ s/-dev//g;
10.21 +$version .= '-hg' . Build::HgRevNum('.');
10.22 +
10.23 +my ($build_type);
10.24 +$build_type = Build::GetBuildType(Build::PathFormat('buildbot/build_type'));
10.25 +
10.26 +if ($build_type eq "dev")
10.27 +{
10.28 + $build_type = "buildbot";
10.29 +}
10.30 +elsif ($build_type eq "rel")
10.31 +{
10.32 + $build_type = "release";
10.33 +}
10.34 +
10.35 +my ($line);
10.36 +while (<PDBLOG>)
10.37 +{
10.38 + $line = $_;
10.39 + $line =~ s/\.pdb/\*/;
10.40 + chomp $line;
10.41 + Build::Command("symstore add /r /f \"..\\OUTPUT\\$line\" /s \"S:\\cssdm\" /t \"Stripper\" /v \"$version\" /c \"$build_type\"");
10.42 +}
10.43 +
10.44 +close(PDBLOG);
10.45 +
10.46 +#Lowercase DLLs. Sigh.
10.47 +my (@files);
10.48 +opendir(DIR, "S:\\cssdm");
10.49 +@files = readdir(DIR);
10.50 +closedir(DIR);
10.51 +
10.52 +my ($i, $j, $file, @subdirs);
10.53 +for ($i = 0; $i <= $#files; $i++)
10.54 +{
10.55 + $file = $files[$i];
10.56 + next unless ($file =~ /\.dll$/);
10.57 + next unless (-d "S:\\cssdm\\$file");
10.58 + opendir(DIR, "S:\\cssdm\\$file");
10.59 + @subdirs = readdir(DIR);
10.60 + closedir(DIR);
10.61 + for ($j = 0; $j <= $#subdirs; $j++)
10.62 + {
10.63 + next unless ($subdirs[$j] =~ /[A-Z]/);
10.64 + Build::Command("rename S:\\cssdm\\$file\\" . $subdirs[$j] . " " . lc($subdirs[$j]));
10.65 + }
10.66 +}
10.67 +