-
Notifications
You must be signed in to change notification settings - Fork 39
/
generateSchedule.sh
executable file
·57 lines (38 loc) · 1.08 KB
/
generateSchedule.sh
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
#!/bin/bash
param="${1}"
THE_CLASSPATH=
PROGRAM_NAME=
for i in `ls ./libs/*.jar`
do
THE_CLASSPATH=${THE_CLASSPATH}:${i}
done
rm output/*
if [ "${param: -5}" == ".java" ]
then
PROGRAM_NAME=GenerateScheduleJavaInput.java
cp "$1" "UseCase.java"
wait
sed -i s/"package schedule_generator;"/"import schedule_generator.*; "/g "UseCase.java"
sed -i s/GeneratedCode/UseCase/g "UseCase.java"
wait
echo ${THE_CLASSPATH}
javac -classpath ".:${THE_CLASSPATH}" "UseCase.java"
wait
javac -classpath ".:${THE_CLASSPATH}" $PROGRAM_NAME
wait
java -classpath ".:${THE_CLASSPATH}" "${PROGRAM_NAME::-5}" > output.txt
rm "GenerateScheduleJavaInput.class"
rm "UseCase.java"
rm "UseCase.class"
else
echo "${1}"
PROGRAM_NAME=GenerateScheduleJSONInput.java
javac -classpath ".:${THE_CLASSPATH}" $PROGRAM_NAME
wait
java -classpath ".:${THE_CLASSPATH}" "${PROGRAM_NAME:0:${#PROGRAM_NAME}-5}" "$1" > output.txt
rm "GenerateScheduleJSONInput.class"
fi
mv output.txt "output/$1.out"
mv log.txt "output/$1.log"
mv output.json "output/output.json"
echo "Ending execution"