-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprepare.py
30 lines (24 loc) · 984 Bytes
/
prepare.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
import os
import re
import sys
import glob
import shutil
import subprocess
# 0. clear 'out' and 'resources'
shutil.rmtree('out')
shutil.rmtree('resources')
# 1. add 'out' directory to /src
if not os.path.exists("out"): os.mkdir("out"); print('INFO: "out" directory created')
# 2. copy 'resources to \src
if not os.path.exists("resources"): shutil.copytree('../resources', 'resources'); print('INFO: "resource" directory copied')
#3. prepare list of all java files to recompile
with open('_sources.txt', 'w') as sourcelist:
sourcelist.write('\n'.join([file for file in glob.glob('**/*.java', recursive=True)]))
if 0 != subprocess.call(["javac", "@_sources.txt"]): print('ERROR: Java compilation error'); sys.exit(1)
#if 0 != subprocess.call(["java", "com.lukzar.Main"]): print('ERROR: Java runtime error'); sys.exit(1)
print('Done.')
#What to do:
#1. run this script on my machine
#2. copy 'src' to remote
#3a. ./run.sh A
#3b. nohup java com.lukzar.Main A > A.out &