-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paths
More file actions
executable file
·152 lines (125 loc) · 4.88 KB
/
Copy paths
File metadata and controls
executable file
·152 lines (125 loc) · 4.88 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/bin/bash
# estore Development Tasks
# Usage: ./s [command]
if [ $(whoami) = "gligoric" ]; then
if command -v /usr/libexec/java_home >/dev/null 2>&1; then
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8 2>/dev/null)"
else
export JAVA_HOME="$HOME/opt/jdk-8"
fi
export PATH="$JAVA_HOME/bin:$PATH"
fi
# ----------
# Functions.
function check_deps() {
# Check dependencies for this project.
! hash "mvn" && \
{ echo "missing maven (https://maven.apache.org/download.cgi)"; return 1; }
java -version 2>&1 | grep -qE 'version "1\.8|version "8' || \
{ echo "no java 8 available (apt-get install openjdk-8-jdk; macOS: brew install openjdk@8)"; return 1; }
! hash "wget" && \
{ echo "missing wget (apt-get install wget)"; return 1; }
! hash "zstd" && \
{ echo "missing zstd (apt-get install zstd)"; return 1; }
! hash "tar" && \
{ echo "missing tar (apt-get install tar)"; return 1; }
! hash "gzip" && \
{ echo "missing gzip (apt-get install gzip)"; return 1; }
! hash "nc" && \
{ echo "missing nc (apt-get install netcat-openbsd)"; return 1; }
echo "deps ok"
return 0
}
function install_deps() {
echo "Installing dependencies..."
if ! hash "mvn" 2>/dev/null; then
echo "Installing Maven..."
apt-get update && apt-get install -y maven || \
{ echo "Failed to install Maven"; return 1; }
fi
if ! hash "java" 2>/dev/null || ! java -version 2>&1 | grep -qE 'version "1\.8|version "8'; then
echo "Installing Java 8..."
apt-get update && apt-get install -y openjdk-8-jdk || \
{ echo "Failed to install Java 8"; return 1; }
fi
if ! hash "wget" 2>/dev/null; then
echo "Installing wget..."
apt-get update && apt-get install -y wget || \
{ echo "Failed to install wget"; return 1; }
fi
if ! hash "zstd" 2>/dev/null; then
echo "Installing zstd..."
apt-get update && apt-get install -y zstd || \
{ echo "Failed to install zstd"; return 1; }
fi
if ! hash "tar" 2>/dev/null; then
echo "Installing tar..."
apt-get update && apt-get install -y tar || \
{ echo "Failed to install tar"; return 1; }
fi
if ! hash "gzip" 2>/dev/null; then
echo "Installing gzip..."
apt-get update && apt-get install -y gzip || \
{ echo "Failed to install gzip"; return 1; }
fi
if ! hash "nc" 2>/dev/null; then
echo "Installing netcat..."
apt-get update && apt-get install -y netcat-openbsd || \
{ echo "Failed to install netcat"; return 1; }
fi
echo "Dependencies installed successfully!"
return 0
}
function compile_estore() {
# Build the project.
( cd estore
mvn clean compile || \
{ echo "could not compile estore"; return 1; }
)
}
function download_data() {
# Download data for estore test.
./scripts/download_test_data || \
{ echo "could not download data"; return 1; }
}
function install_estore() {
check_deps || \
{ echo "Dependencies not satisfied. Please install with: ./s install_deps"; return 1; }
download_data || \
{ echo "could not download data"; return 1; }
( cd estore
mvn install || \
{ echo "could not install estore"; return 1; }
)
}
function exec_estore() {
check_deps || \
{ echo "Dependencies not satisfied. Please install with: ./s install_deps"; return 1; }
echo "Usage: $0 [port] [useUnsafe]"
local port=${1:-1234}
local useUnsafe=${2:-false}
echo "Example: echo 'MATCH (n) return n' | nc -q 0 localhost $port"
echo "send 'q' to exit"
compile_estore
( cd estore
mvn exec:java@main -Dexec.args="$port $useUnsafe" &
echo "Running db as $!"
)
}
function prepare_eval() {
#Prepares evaluation by copying needed jars
( cd eval
rm -rf libs && mkdir libs
cp ../estore/target/*.jar libs || \
{ echo "could not copy estore jars into libs in eval"; return 1; }
)
}
function end_to_end() {
check_deps || \
{ echo "deps not satisfied"; exit 1; }
install_estore || \
{ echo "could not install estore"; exit 1; }
prepare_eval || \
{ echo "could not prepare evaluation"; exit 1; }
}
"$@"