Port plugin build scripts to AMBuild 2 (bug 5997 part 5, r=ds).
Port plugin build scripts to AMBuild 2 (
bug 5997 part 5, r=ds).
1.1 --- a/AMBuildScript Mon Dec 30 17:50:58 2013 -0500
1.2 +++ b/AMBuildScript Mon Dec 30 17:50:58 2013 -0500
1.3 @@ -64,6 +64,8 @@
1.4 self.binaries = []
1.5 self.mms_root = None
1.6 self.mysql_root = None
1.7 + self.spcomp = None
1.8 + self.smx_files = {}
1.9
1.10 def detectSDKs(self):
1.11 sdk_list = builder.options.sdks.split(',')
1.12 @@ -409,6 +411,7 @@
1.13 'extensions/updater/AMBuilder',
1.14 'sourcepawn/compiler/AMBuilder',
1.15 'sourcepawn/jit/AMBuilder',
1.16 + 'plugins/AMBuilder',
1.17 ],
1.18 {
1.19 'SM': SM
2.1 --- a/plugins/AMBuilder Mon Dec 30 17:50:58 2013 -0500
2.2 +++ b/plugins/AMBuilder Mon Dec 30 17:50:58 2013 -0500
2.3 @@ -1,53 +1,62 @@
2.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
2.5 +# vim: set ts=8 sts=2 sw=2 tw=99 et ft=python:
2.6 import os
2.7 -import os.path
2.8 -import ambuild.osutil as osutil
2.9 -import ambuild.command as command
2.10
2.11 files = [
2.12 - 'adminhelp.sp',
2.13 - 'antiflood.sp',
2.14 - 'basecomm.sp',
2.15 - 'clientprefs.sp',
2.16 - 'nextmap.sp',
2.17 - 'reservedslots.sp',
2.18 - 'adminmenu.sp',
2.19 - 'basebans.sp',
2.20 - 'basetriggers.sp',
2.21 - 'funcommands.sp',
2.22 - 'nominations.sp',
2.23 - 'rockthevote.sp',
2.24 - 'admin-sql-prefetch.sp',
2.25 - 'basechat.sp',
2.26 - 'basevotes.sp',
2.27 - 'funvotes.sp',
2.28 - 'playercommands.sp',
2.29 - 'sounds.sp',
2.30 - 'admin-sql-threaded.sp',
2.31 - 'basecommands.sp',
2.32 - 'mapchooser.sp',
2.33 - 'randomcycle.sp',
2.34 - 'sql-admin-manager.sp'
2.35 - ]
2.36 + 'adminhelp.sp',
2.37 + 'antiflood.sp',
2.38 + 'basecomm.sp',
2.39 + 'clientprefs.sp',
2.40 + 'nextmap.sp',
2.41 + 'reservedslots.sp',
2.42 + 'adminmenu.sp',
2.43 + 'basebans.sp',
2.44 + 'basetriggers.sp',
2.45 + 'funcommands.sp',
2.46 + 'nominations.sp',
2.47 + 'rockthevote.sp',
2.48 + 'admin-sql-prefetch.sp',
2.49 + 'basechat.sp',
2.50 + 'basevotes.sp',
2.51 + 'funvotes.sp',
2.52 + 'playercommands.sp',
2.53 + 'sounds.sp',
2.54 + 'admin-sql-threaded.sp',
2.55 + 'basecommands.sp',
2.56 + 'mapchooser.sp',
2.57 + 'randomcycle.sp',
2.58 + 'sql-admin-manager.sp'
2.59 +]
2.60
2.61 -plugins = AMBuild.AddJob('plugins')
2.62 -
2.63 -spcomp = os.path.join(AMBuild.outputFolder, 'spcomp', 'spcomp')
2.64 -includes = os.path.relpath(os.path.join(AMBuild.sourceFolder, 'plugins', 'include'),
2.65 - os.path.join(AMBuild.outputFolder, 'plugins'))
2.66 -
2.67 -versioninc = os.path.relpath(os.path.join(AMBuild.outputFolder, 'includes'),
2.68 - os.path.join(AMBuild.outputFolder, 'plugins'))
2.69 +spcomp_argv = [
2.70 + os.path.join(builder.buildPath, SM.spcomp.binary.path),
2.71 + 'SM_GENERATED_BUILD=',
2.72 + '-i' + os.path.relpath(os.path.join(builder.sourcePath, 'plugins', 'include'),
2.73 + os.path.join(builder.buildPath, builder.buildFolder)),
2.74 + '-h',
2.75 +]
2.76
2.77 -#This one has to be special
2.78 -sp = os.path.join(AMBuild.sourceFolder, 'plugins', 'admin-flatfile', 'admin-flatfile.sp')
2.79 -args = [spcomp, 'SM_GENERATED_BUILD=', '-i' + versioninc, '-i' + includes, sp]
2.80 -plugins.AddCommand(command.DirectCommand(args))
2.81 +def build_plugin(script_path, smx_file):
2.82 + inputs = [
2.83 + SM.spcomp.binary,
2.84 + script_path,
2.85 + ]
2.86 + outputs = [
2.87 + smx_file
2.88 + ]
2.89 + argv = spcomp_argv + [script_path]
2.90 + cmd_entry, smx_entry = builder.AddCommand(
2.91 + inputs = inputs,
2.92 + argv = argv,
2.93 + outputs = outputs,
2.94 + dep_type = 'msvc'
2.95 + )
2.96 + SM.smx_files[smx_file] = smx_entry
2.97
2.98 -#Do the normal ones
2.99 -for file in files:
2.100 - sp = os.path.join(AMBuild.sourceFolder, 'plugins', file)
2.101 - args = [spcomp, 'SM_GENERATED_BUILD=', '-i' + versioninc, '-i' + includes, sp]
2.102 - plugins.AddCommand(command.DirectCommand(args))
2.103 +for script_file in files:
2.104 + script_path = os.path.join(builder.currentSourcePath, script_file)
2.105 + smx_file = os.path.splitext(script_file)[0] + '.smx'
2.106 + build_plugin(script_path, smx_file)
2.107
2.108 -
2.109 +# This one has to be special.
2.110 +build_plugin(os.path.join(builder.currentSourcePath, 'admin-flatfile', 'admin-flatfile.sp'),
2.111 + 'admin-flatfile.smx')
3.1 --- a/sourcepawn/compiler/AMBuilder Mon Dec 30 17:50:58 2013 -0500
3.2 +++ b/sourcepawn/compiler/AMBuilder Mon Dec 30 17:50:58 2013 -0500
3.3 @@ -72,4 +72,4 @@
3.4 if builder.target_platform is 'linux':
3.5 binary.sources.append('binreloc.c')
3.6
3.7 -SM.binaries += [builder.Add(binary)]
3.8 +SM.spcomp = builder.Add(binary)