-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.sh
executable file
·77 lines (63 loc) · 1.57 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
CMD="all"
if [ ! -z "$1" ]
then
CMD=$1
fi
install_maven() {
echo "=== Installing maven ==="
mvn_version=${mvn_version:-3.8.6}
url="https://dlcdn.apache.org/maven/maven-3/${mvn_version}/binaries/apache-maven-${mvn_version}-bin.tar.gz"
install_dir="/opt/maven"
echo $url
if [ -d ${install_dir} ]; then
sudo mv ${install_dir} ${install_dir}.$(date +"%Y%m%d")
fi
sudo mkdir ${install_dir}
sudo curl -fSL ${url} | sudo tar zx --strip-components=1 -C ${install_dir}
cat << EOF | sudo tee -a /etc/profile.d/maven.sh
#!/bin/sh
export MAVEN_HOME=${install_dir}
export M2_HOME=${install_dir}
export M2=${install_dir}/bin
export PATH=${install_dir}/bin:$PATH
EOF
source /etc/profile.d/maven.sh
echo maven installed to ${install_dir}
mvn --version
}
install_deps() {
echo "=== Installing dependencies ==="
sudo apt update
sudo apt install -y openjdk-17-jdk git python3 python3-pip curl
install_maven
python3 -m pip install matplotlib seaborn
}
get_datasets() {
echo "=== Downloading datasets ==="
git clone https://bitbucket.org/gdtongji/dataset.git
}
jar() {
echo "=== Building artifact ==="
if [ -d /etc/profile.d/maven.sh ]; then
install_maven
fi
mvn assembly:assembly
cp target/flash-public-1.0-SNAPSHOT-jar-with-dependencies.jar ./flash.jar
}
case $CMD in
"install_deps")
install_deps
;;
"get_datasets")
get_datasets
;;
"jar")
jar
;;
*)
install_deps
get_datasets
jar
;;
esac