845c20ad93
* Start using Github Actions Build on windows and linux. Cannot build for macos, since the builders only support xcode 10+ which dropped x86 support. * Build sourcepawn tooling as separate package Upload build artifacts containing only spcomp and the includes. This adds a new `--scripting-only` flag to configure.py which skips everything and goes straight to building spcomp and packaging the include folder with it. * Only run the workflows for the master branch * Split common operations into PackageHelpers file Don't duplicate the code for packaging releases for the tooling-only packages. Instead use a common `PackageHelpers` class which provides the functionality common to both packages. This replaces the explicit list of files to package with a directory scan, so we don't have to list them all. The pgsql sql-init-scripts were missing from the release package before, so they were added here as well. Three scripts from the testsuite were missing from the explicit list (mapdisplayname, floats, findmap), so they're now included. * Fix Python 2 compatibility os.scandir is Python 3 only.
128 lines
5.5 KiB
Python
128 lines
5.5 KiB
Python
# vim: set ts=8 sts=2 sw=2 tw=99 et ft=python:
|
|
import os
|
|
|
|
builder.SetBuildFolder('package')
|
|
|
|
folder_list = [
|
|
'addons/sourcemod',
|
|
'addons/sourcemod/bin',
|
|
'addons/sourcemod/plugins',
|
|
'addons/sourcemod/plugins/disabled',
|
|
'addons/sourcemod/gamedata',
|
|
'addons/sourcemod/gamedata/core.games',
|
|
'addons/sourcemod/gamedata/sdkhooks.games',
|
|
'addons/sourcemod/gamedata/sdktools.games',
|
|
'addons/sourcemod/gamedata/sm-cstrike.games',
|
|
'addons/sourcemod/configs',
|
|
'addons/sourcemod/configs/geoip',
|
|
'addons/sourcemod/translations',
|
|
'addons/sourcemod/logs',
|
|
'addons/sourcemod/extensions',
|
|
'addons/sourcemod/data',
|
|
'addons/sourcemod/configs/sql-init-scripts',
|
|
'addons/sourcemod/configs/sql-init-scripts/mysql',
|
|
'addons/sourcemod/configs/sql-init-scripts/pgsql',
|
|
'addons/sourcemod/configs/sql-init-scripts/sqlite',
|
|
'addons/sourcemod/scripting',
|
|
'addons/sourcemod/scripting/include',
|
|
'addons/sourcemod/scripting/admin-flatfile',
|
|
'addons/sourcemod/scripting/adminmenu',
|
|
'addons/sourcemod/scripting/testsuite',
|
|
'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',
|
|
'cfg/sourcemod',
|
|
]
|
|
|
|
if 'x86_64' in SM.target_archs:
|
|
folder_list.extend([
|
|
'addons/sourcemod/bin/x64',
|
|
'addons/sourcemod/extensions/x64',
|
|
])
|
|
|
|
helpers = SM.package_helpers
|
|
helpers.builder = builder
|
|
folder_map = helpers.CreateFolders(folder_list)
|
|
|
|
# Copy binaries.
|
|
for cxx_task in SM.binaries:
|
|
# mms expects our loader (sourcemod_mm) to exist in /bin/
|
|
if cxx_task.target.arch == 'x86_64' and not 'sourcemod_mm' in cxx_task.binary.path:
|
|
builder.AddCopy(cxx_task.binary, folder_map['addons/sourcemod/bin/x64'])
|
|
else:
|
|
builder.AddCopy(cxx_task.binary, folder_map['addons/sourcemod/bin'])
|
|
for cxx_task in SM.extensions:
|
|
if cxx_task.target.arch == 'x86_64':
|
|
builder.AddCopy(cxx_task.binary, folder_map['addons/sourcemod/extensions/x64'])
|
|
else:
|
|
builder.AddCopy(cxx_task.binary, folder_map['addons/sourcemod/extensions'])
|
|
for cxx_task in SM.spvm:
|
|
if cxx_task.target.arch == 'x86':
|
|
dest_path = os.path.join('addons/sourcemod/bin',
|
|
'sourcepawn.jit.x86' + os.path.splitext(cxx_task.binary.path)[1])
|
|
builder.AddCopy(cxx_task.binary, dest_path)
|
|
elif cxx_task.target.arch == 'x86_64':
|
|
builder.AddCopy(cxx_task.binary, folder_map['addons/sourcemod/bin/x64'])
|
|
|
|
helpers.CopySpcomp('addons/sourcemod/scripting')
|
|
|
|
# Export PDB files. We write to a file in the build folder which is pretty
|
|
# verboten, but it's okay if it's in the root since AMBuild will never try
|
|
# to rmdir the root.
|
|
full_binary_list = SM.binaries + SM.extensions + SM.spcomp_bins
|
|
with open(os.path.join(builder.buildPath, 'pdblog.txt'), 'w') as fp:
|
|
for task in full_binary_list:
|
|
fp.write(task.debug.path + '\n')
|
|
|
|
# Copy plugins.
|
|
disabled_plugins = set([
|
|
'admin-sql-prefetch.smx',
|
|
'admin-sql-threaded.smx',
|
|
'sql-admin-manager.smx',
|
|
'mapchooser.smx',
|
|
'randomcycle.smx',
|
|
'rockthevote.smx',
|
|
'nominations.smx',
|
|
])
|
|
|
|
for smx_file in SM.smx_files:
|
|
smx_entry = SM.smx_files[smx_file]
|
|
if smx_file in disabled_plugins:
|
|
builder.AddCopy(smx_entry, folder_map['addons/sourcemod/plugins/disabled'])
|
|
else:
|
|
builder.AddCopy(smx_entry, folder_map['addons/sourcemod/plugins'])
|
|
|
|
# Do all straight-up file copies from the source tree.
|
|
helpers.CopyIncludes('addons/sourcemod/scripting/include')
|
|
|
|
helpers.CopyFiles('configs', 'addons/sourcemod/configs')
|
|
helpers.CopyFiles('configs/geoip', 'addons/sourcemod/configs/geoip')
|
|
helpers.CopyFiles('configs/cfg', 'cfg/sourcemod')
|
|
helpers.CopyFiles('configs/metamod', 'addons/metamod')
|
|
helpers.CopyFiles('configs/sql-init-scripts/mysql', 'addons/sourcemod/configs/sql-init-scripts/mysql')
|
|
helpers.CopyFiles('configs/sql-init-scripts/pgsql', 'addons/sourcemod/configs/sql-init-scripts/pgsql')
|
|
helpers.CopyFiles('configs/sql-init-scripts/sqlite', 'addons/sourcemod/configs/sql-init-scripts/sqlite')
|
|
helpers.CopyFiles('gamedata', 'addons/sourcemod/gamedata')
|
|
helpers.CopyFiles('gamedata/sdkhooks.games', 'addons/sourcemod/gamedata/sdkhooks.games')
|
|
helpers.CopyFiles('gamedata/sdktools.games', 'addons/sourcemod/gamedata/sdktools.games')
|
|
helpers.CopyFiles('gamedata/core.games', 'addons/sourcemod/gamedata/core.games')
|
|
helpers.CopyFiles('gamedata/sm-cstrike.games', 'addons/sourcemod/gamedata/sm-cstrike.games')
|
|
helpers.CopyFiles('plugins', 'addons/sourcemod/scripting', '.sp')
|
|
helpers.CopyFiles('translations', 'addons/sourcemod/translations')
|
|
helpers.CopyFiles('licenses', 'addons/sourcemod')
|
|
helpers.CopyFiles('plugins/admin-flatfile', 'addons/sourcemod/scripting/admin-flatfile')
|
|
helpers.CopyFiles('plugins/adminmenu', 'addons/sourcemod/scripting/adminmenu')
|
|
helpers.CopyFiles('plugins/testsuite', 'addons/sourcemod/scripting/testsuite')
|
|
helpers.CopyFiles('plugins/basecommands', 'addons/sourcemod/scripting/basecommands')
|
|
helpers.CopyFiles('plugins/basecomm', 'addons/sourcemod/scripting/basecomm')
|
|
helpers.CopyFiles('plugins/funvotes', 'addons/sourcemod/scripting/funvotes')
|
|
helpers.CopyFiles('plugins/basevotes', 'addons/sourcemod/scripting/basevotes')
|
|
helpers.CopyFiles('plugins/basebans', 'addons/sourcemod/scripting/basebans')
|
|
helpers.CopyFiles('plugins/funcommands', 'addons/sourcemod/scripting/funcommands')
|
|
helpers.CopyFiles('plugins/playercommands', 'addons/sourcemod/scripting/playercommands')
|