-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·56 lines (49 loc) · 1.3 KB
/
build.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
#!/bin/bash
# Para gerar o compilador em um JAR execuátvel, de nome `Compilador.jar`
COMPILER_JAR_FILENAME="Compilador.jar"
set -e
###################################################
###### Assuming the following directory tree ######
###################################################
: '
.
├── build.sh <-
├── compile.sh
├── Compilador.jar (this will be created)
├── compiler_tools
│ ├── Coco.jar
│ ├── microc.atg
│ ├── Parser.frame
│ └── Scanner.frame
├── manifest.mf
└── src
├── Compile.java
├── Diagrama.java
├── EdgeInfo.java
├── VertexInfo.java
└── Graph.java
'
###################################################
exec 3>&1 ## salvar o descritor da stdout
exec 1>/dev/null
exec 4>&2 ## salvar o descritor da stderr
exec 2>/dev/null
while getopts "v" opt; do
case $opt in
v) ## enable verbose mode
exec 1>&3 3>&-
exec 2>&4 4>&-
;;
\?) exit 1;;
esac
done
rm -f "${COMPILER_JAR_FILENAME}"
cd compiler_tools/
rm -f *.java # cleanup
java -jar Coco.jar -frames . microc.atg
mv *.java ../src
cd ../src
javac -d . *.java #2>/dev/null
jar cfm "../${COMPILER_JAR_FILENAME}" ../manifest.mf *.class
rm *.class # cleanup
rm Parser.java Scanner.java