forked from Source2ZE/CS2Fixes
-
Notifications
You must be signed in to change notification settings - Fork 1
/
PackageScript
109 lines (96 loc) · 7.81 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# 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)
if cxx.target.platform == 'windows' and task.debug:
builder.AddCopy(task.debug, 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')
# Add CS2Fixes-specific files
builder.AddFolder(os.path.join('addons', MMSPlugin.plugin_name, 'data'))
configs_folder = builder.AddFolder(os.path.join('addons', MMSPlugin.plugin_name, 'configs'))
zr_folder = builder.AddFolder(os.path.join('addons', MMSPlugin.plugin_name, 'configs', 'zr'))
cfg_folder = builder.AddFolder(os.path.join('cfg', MMSPlugin.plugin_name))
mapcfg_folder = builder.AddFolder(os.path.join('cfg', MMSPlugin.plugin_name, 'maps'))
gamedata_folder = builder.AddFolder(os.path.join('addons', MMSPlugin.plugin_name, 'gamedata'))
builder.AddCopy(os.path.join(builder.sourcePath, 'configs', 'admins.cfg.example'), configs_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'configs', 'discordbots.cfg.example'), configs_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'configs', 'maplist.cfg.example'), configs_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'cfg', MMSPlugin.plugin_name, 'cs2fixes.cfg'), cfg_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'cfg', MMSPlugin.plugin_name, 'maps', 'de_somemap.cfg'), mapcfg_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'configs', 'zr', 'playerclass.jsonc.example'), zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'configs', 'zr', 'weapons.cfg.example'), zr_folder)
builder.AddCopy(os.path.join('gamedata', 'cs2fixes.games.txt'), gamedata_folder)
# Add CS2Fixes-specific compiled asset files
particles_cs2f_folder = builder.AddFolder(os.path.join('particles', MMSPlugin.plugin_name))
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'particles', MMSPlugin.plugin_name, 'player_beacon.vpcf_c'), particles_cs2f_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'particles', MMSPlugin.plugin_name, 'player_beacon_tint.vpcf_c'), particles_cs2f_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'particles', MMSPlugin.plugin_name, 'leader_defend_mark.vpcf_c'), particles_cs2f_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'particles', MMSPlugin.plugin_name, 'leader_defend_mark_ground.vpcf_c'), particles_cs2f_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'particles', MMSPlugin.plugin_name, 'leader_tracer.vpcf_c'), particles_cs2f_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'particles', MMSPlugin.plugin_name, 'napalm_fire.vpcf_c'), particles_cs2f_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'particles', MMSPlugin.plugin_name, 'simple_overlay.vpcf_c'), particles_cs2f_folder)
materials_cs2f_folder = builder.AddFolder(os.path.join('materials', MMSPlugin.plugin_name))
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'materials', MMSPlugin.plugin_name, 'leader_defend_mark.vtex_c'), materials_cs2f_folder)
soundevents_folder = builder.AddFolder(os.path.join('soundevents'))
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'soundevents', 'soundevents_zr.vsndevts_c'), soundevents_folder)
sounds_zr_folder = builder.AddFolder(os.path.join('sounds', 'zr'))
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'fz_scream1.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_die1.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_die2.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_die3.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_pain1.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_pain2.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_pain3.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_pain4.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_pain5.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_pain6.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_voice_idle1.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_voice_idle2.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_voice_idle3.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_voice_idle4.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_voice_idle5.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_voice_idle6.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_voice_idle7.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_voice_idle8.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_voice_idle9.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_voice_idle10.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_voice_idle11.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_voice_idle12.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_voice_idle13.vsnd_c'), sounds_zr_folder)
builder.AddCopy(os.path.join(builder.sourcePath, 'assets', 'sounds', 'zr', 'zombie_voice_idle14.vsnd_c'), sounds_zr_folder)