Port plugin build scripts to AMBuild 2 (bug 5997 part 5, r=ds).

This commit is contained in:
David Anderson 2013-12-30 17:50:58 -05:00
parent 58995fc829
commit 9c19f6efb7
3 changed files with 59 additions and 47 deletions

View File

@ -64,6 +64,8 @@ class SMConfig(object):
self.binaries = [] self.binaries = []
self.mms_root = None self.mms_root = None
self.mysql_root = None self.mysql_root = None
self.spcomp = None
self.smx_files = {}
def detectSDKs(self): def detectSDKs(self):
sdk_list = builder.options.sdks.split(',') sdk_list = builder.options.sdks.split(',')
@ -409,6 +411,7 @@ builder.RunBuildScripts(
'extensions/updater/AMBuilder', 'extensions/updater/AMBuilder',
'sourcepawn/compiler/AMBuilder', 'sourcepawn/compiler/AMBuilder',
'sourcepawn/jit/AMBuilder', 'sourcepawn/jit/AMBuilder',
'plugins/AMBuilder',
], ],
{ {
'SM': SM 'SM': SM

View File

@ -1,8 +1,5 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python: # vim: set ts=8 sts=2 sw=2 tw=99 et ft=python:
import os import os
import os.path
import ambuild.osutil as osutil
import ambuild.command as command
files = [ files = [
'adminhelp.sp', 'adminhelp.sp',
@ -28,26 +25,38 @@ files = [
'mapchooser.sp', 'mapchooser.sp',
'randomcycle.sp', 'randomcycle.sp',
'sql-admin-manager.sp' 'sql-admin-manager.sp'
]
spcomp_argv = [
os.path.join(builder.buildPath, SM.spcomp.binary.path),
'SM_GENERATED_BUILD=',
'-i' + os.path.relpath(os.path.join(builder.sourcePath, 'plugins', 'include'),
os.path.join(builder.buildPath, builder.buildFolder)),
'-h',
]
def build_plugin(script_path, smx_file):
inputs = [
SM.spcomp.binary,
script_path,
] ]
outputs = [
smx_file
]
argv = spcomp_argv + [script_path]
cmd_entry, smx_entry = builder.AddCommand(
inputs = inputs,
argv = argv,
outputs = outputs,
dep_type = 'msvc'
)
SM.smx_files[smx_file] = smx_entry
plugins = AMBuild.AddJob('plugins') for script_file in files:
script_path = os.path.join(builder.currentSourcePath, script_file)
spcomp = os.path.join(AMBuild.outputFolder, 'spcomp', 'spcomp') smx_file = os.path.splitext(script_file)[0] + '.smx'
includes = os.path.relpath(os.path.join(AMBuild.sourceFolder, 'plugins', 'include'), build_plugin(script_path, smx_file)
os.path.join(AMBuild.outputFolder, 'plugins'))
versioninc = os.path.relpath(os.path.join(AMBuild.outputFolder, 'includes'),
os.path.join(AMBuild.outputFolder, 'plugins'))
#This one has to be special
sp = os.path.join(AMBuild.sourceFolder, 'plugins', 'admin-flatfile', 'admin-flatfile.sp')
args = [spcomp, 'SM_GENERATED_BUILD=', '-i' + versioninc, '-i' + includes, sp]
plugins.AddCommand(command.DirectCommand(args))
#Do the normal ones
for file in files:
sp = os.path.join(AMBuild.sourceFolder, 'plugins', file)
args = [spcomp, 'SM_GENERATED_BUILD=', '-i' + versioninc, '-i' + includes, sp]
plugins.AddCommand(command.DirectCommand(args))
# This one has to be special.
build_plugin(os.path.join(builder.currentSourcePath, 'admin-flatfile', 'admin-flatfile.sp'),
'admin-flatfile.smx')

View File

@ -72,4 +72,4 @@ binary.sources += [
if builder.target_platform is 'linux': if builder.target_platform is 'linux':
binary.sources.append('binreloc.c') binary.sources.append('binreloc.c')
SM.binaries += [builder.Add(binary)] SM.spcomp = builder.Add(binary)