forked from CombatExtended-Continued/CombatExtended
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BuildCompat.py
45 lines (38 loc) · 1.54 KB
/
BuildCompat.py
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
#!/usr/bin/python3
import os
from twisted.python.filepath import FilePath
from subprocess import Popen
import re
import sys
tm = '-m' in sys.argv
parallel = '-j' in sys.argv
PROJECT_PATTERN = re.compile(r'''Project.".[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}.". = '''
r'''"([0-9a-zA-Z]+Compat)", '''
r'''"([0-9A-zA-Z\/]+.csproj)", '''
r'''".[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}."''')
PUBLICIZER = os.environ.get("PUBLICIZER", "./AssemblyPublicizer")
DOWNLOAD_LIBS = os.environ.get("DOWNLOAD_LIBS", "--download-libs")
tasks = []
def system(*cmd):
sp = Popen(cmd)
if not parallel:
sp.wait()
ec = sp.poll()
if ec:
raise SystemExit(ec)
else:
tasks.append(sp)
with open("Source/CombatExtended.sln") as f:
for line in f.readlines():
line = line.strip()
match = PROJECT_PATTERN.match(line)
if match:
name, csproj = match.groups()
if tm and name not in sys.argv: continue
csproj = csproj.replace('\\', '/').split('/')
csproj = FilePath("Source").descendant(csproj)
print(f"Building {name}")
output = FilePath("AssembliesCompat").child(name+".dll")
system("python3", "Make.py", "--csproj", csproj.path, "--output", output.path, DOWNLOAD_LIBS, "--all-libs", "--publicizer", PUBLICIZER, "--", "-r:Assemblies/CombatExtended.dll")
for t in tasks:
t.wait()