-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile.py
35 lines (25 loc) · 882 Bytes
/
compile.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
import os
import json
devnull: str = os.devnull
def run(command: str) -> None:
os.system(f"{command} > {devnull} 2>&1")
print("cleaning up previously compiled data..")
run("python3 compilercleaner.py")
print("collecting data for the compilation to begin...")
run("ts-node buildCompilerFile")
print("")
with open("compile.json") as file:
data: dict | list = json.load(file)
for lang in data:
for file in lang["files"]:
print(
f"{'giving permissions to' if lang['type_'] == 'sh' else 'compiling'} {file['file']}..."
)
run(
f"{lang['command']} {file['file'][2:-3] if file['file'][-2:] == 'rs' else file['file']}"
)
if lang["type_"] == "rs":
run(f"mv ./target/debug/{file['file'][2:-3]} ./")
print("\n")
print("running prettier on the compiled javascript")
run("npm run format-code")