-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathPackageScript
95 lines (81 loc) · 6.4 KB
/
PackageScript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# vim: set ts=2 sw=2 tw=99 noet ft=python:
import os
builder.SetBuildFolder('package')
metamod_folder = builder.AddFolder(os.path.join('addons', 'metamod'))
bin_folder_path = os.path.join('addons', MMSPlugin.plugin_name, 'bin')
bin_folder = builder.AddFolder(bin_folder_path)
for cxx in MMSPlugin.all_targets:
if cxx.target.arch == 'x86_64':
if cxx.target.platform == 'windows':
bin64_folder_path = os.path.join('addons', MMSPlugin.plugin_name, 'bin', 'win64')
bin64_folder = builder.AddFolder(bin64_folder_path)
elif cxx.target.platform == 'linux':
bin64_folder_path = os.path.join('addons', MMSPlugin.plugin_name, 'bin', 'linuxsteamrt64')
bin64_folder = builder.AddFolder(bin64_folder_path)
elif cxx.target.platform == 'mac':
bin64_folder_path = os.path.join('addons', MMSPlugin.plugin_name, 'bin', 'win64')
bin64_folder = builder.AddFolder(bin64_folder_path)
pdb_list = []
for task in MMSPlugin.binaries:
# This hardly assumes there's only 1 targetted platform and would be overwritten
# with whatever comes last if multiple are used!
with open(os.path.join(builder.buildPath, MMSPlugin.plugin_name + '.vdf'), 'w') as fp:
fp.write('"Metamod Plugin"\n')
fp.write('{\n')
fp.write(f'\t"alias"\t"{MMSPlugin.plugin_alias}"\n')
if task.target.arch == 'x86_64':
fp.write(f'\t"file"\t"{os.path.join(bin64_folder_path, MMSPlugin.plugin_name)}"\n')
else:
fp.write(f'\t"file"\t"{os.path.join(bin_folder_path, MMSPlugin.plugin_name)}"\n')
fp.write('}\n')
if task.target.arch == 'x86_64':
builder.AddCopy(task.binary, bin64_folder)
else:
builder.AddCopy(task.binary, bin_folder)
if task.debug:
pdb_list.append(task.debug)
builder.AddCopy(os.path.join(builder.buildPath, MMSPlugin.plugin_name + '.vdf'), metamod_folder)
# Generate PDB info.
with open(os.path.join(builder.buildPath, 'pdblog.txt'), 'wt') as fp:
for line in pdb_list:
fp.write(line.path + '\n')
bin_folder = builder.AddFolder(os.path.join('addons', MMSPlugin.plugin_name, 'bin'))
bin_scripting_folder = builder.AddFolder(os.path.join('addons', MMSPlugin.plugin_name, 'bin', 'scripting'))
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'bin', 'scripting', 'database.lua'), bin_scripting_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'bin', 'scripting', 'entity.lua'), bin_scripting_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'bin', 'scripting', 'events.lua'), bin_scripting_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'bin', 'scripting', 'exports.lua'), bin_scripting_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'bin', 'scripting', 'hooks.lua'), bin_scripting_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'bin', 'scripting', 'serpent.lua'), bin_scripting_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'bin', 'scripting', 'timers.lua'), bin_scripting_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'bin', 'scripting', 'utils.lua'), bin_scripting_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'bin', 'scripting', 'database.js'), bin_scripting_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'bin', 'scripting', 'entity.js'), bin_scripting_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'bin', 'scripting', 'events.js'), bin_scripting_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'bin', 'scripting', 'exports.js'), bin_scripting_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'bin', 'scripting', 'hooks.js'), bin_scripting_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'bin', 'scripting', 'timers.js'), bin_scripting_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'bin', 'scripting', 'utils.js'), bin_scripting_folder)
configs_folder = builder.AddFolder(os.path.join('addons', MMSPlugin.plugin_name, 'configs'))
configs_plugins_folder = builder.AddFolder(os.path.join('addons', MMSPlugin.plugin_name, 'configs', 'plugins'))
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'configs', 'core.example.json'), configs_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'configs', 'databases.example.json'), configs_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'configs', 'plugins', '.gitignore'), configs_plugins_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'configs', 'chat.example.json'), configs_folder)
gamedata_folder = builder.AddFolder(os.path.join('addons', MMSPlugin.plugin_name, 'gamedata'))
gamedata_core_folder = builder.AddFolder(os.path.join('addons', MMSPlugin.plugin_name, 'gamedata', 'core'))
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'gamedata', 'sdk.json'), gamedata_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'gamedata', 'sdk_types.json'), gamedata_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'gamedata', 'gameevents.json'), gamedata_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'gamedata', 'core', 'signatures.json'), gamedata_core_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'gamedata', 'core', 'patches.json'), gamedata_core_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'gamedata', 'core', 'offsets.json'), gamedata_core_folder)
logs_folder = builder.AddFolder(os.path.join('addons', MMSPlugin.plugin_name, 'logs'))
logs_plugins_folder = builder.AddFolder(os.path.join('addons', MMSPlugin.plugin_name, 'logs', 'plugins'))
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'logs', '.gitignore'), logs_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'logs', 'plugins', '.gitignore'), logs_plugins_folder)
plugins_folder = builder.AddFolder(os.path.join('addons', MMSPlugin.plugin_name, 'plugins'))
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'plugins', '.gitignore'), plugins_folder)
translations_folder = builder.AddFolder(os.path.join('addons', MMSPlugin.plugin_name, 'translations'))
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'translations', '.gitignore'), translations_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'plugin_files', 'translations', 'translation.core.json'), translations_folder)