forked from ASSERT-KTH/cigar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·66 lines (62 loc) · 2.09 KB
/
install.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
58
59
60
61
62
63
64
65
66
### Check requirements
if ! type "virtualenv" > /dev/null; then
echo "virtualenv not installed"
exit 1
# To install run: pip3 install virtualenv
fi
if ! type "svn" > /dev/null; then
echo "subversion (svn) not installed"
exit 1
# To install run:
# linux: sudo apt install subversion
# mac: brew install svn
fi
if ! type "java" > /dev/null; then
echo "java not installed"
exit 1
# To install run:
# linux: sudo apt install openjdk-8-jdk -y
# mac: install openjdk@8
fi
# Get java 8 home path
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
java_home=$(readlink -f /usr/bin/java | sed "s:bin/java::")
elif [[ "$OSTYPE" == "darwin"* ]]; then
java_home=$(/usr/libexec/java_home -version 1.8)
else
echo "OS not supported"
exit 1
fi
# Check if java_home is set
if [ -z "$java_home" ]; then
echo "java_home not set"
exit 1
fi
### Install python requirements
virtualenv venv
source venv/bin/activate
# Install requirements
pip3 install -r requirements.txt
### Download tools & dependencies
# To count diff lines download gumtree-spoon-ast-diff.jar from https://github.com/SpoonLabs/gumtree-spoon-ast-diff
wget https://search.maven.org/remote_content\?g\=fr.inria.gforge.spoon.labs\&a\=gumtree-spoon-ast-diff\&v\=LATEST\&c\=jar-with-dependencies -O gumtree-spoon-ast-diff.jar
# Download ind init Defects4J
git clone https://github.com/rjust/defects4j.git
defects4j/init.sh
### Set parameters
rm user_params.py
cp user_params.py.template user_params.py
user_params=$(<user_params.py)
# set TMP_DIR to "/tmp/defects4j"
user_params=${user_params//path_to_tmp_dir/\/tmp\/defects4j}
# set D4J_PATH to "$(pwd)/defects4j/framework/bin"
user_params=${user_params//path_to_d4j_bin/$(pwd)\/defects4j\/framework\/bin}
# set JAVA_HOME to $(/usr/libexec/java_home -version 1.8)
user_params=${user_params//path_to_java_home/$java_home}
# write to file
echo "$user_params" > user_params.py
# Print that user should set API_KEY
echo
echo "Please set your JAVA_HOME to your Java 8 home in user_params.py"
echo "Please set TMP_DIR in user_params.py"
echo "Please set your API_KEY in user_params.py"