-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild
More file actions
51 lines (33 loc) · 933 Bytes
/
build
File metadata and controls
51 lines (33 loc) · 933 Bytes
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
#!/bin/bash
# Configuration
MODULE_NAME="javaiterables"
SRC_DIR="src/$MODULE_NAME"
OUT_DIR="out"
JAR_NAME="$MODULE_NAME.jar"
cd "$(dirname "$0")"
# Clean previous build
echo "Cleaning previous build..."
rm -rf "$OUT_DIR"
mkdir -p "$OUT_DIR"
# Compile module
echo "Compiling Module: '$MODULE_NAME'..."
javac -d "$OUT_DIR" \
"src/$MODULE_NAME/module-info.java" \
src/$MODULE_NAME/javaiterables/*.java
if [ $? -ne 0 ]; then
echo "Error while compiling, aborting..."
exit 1
fi
# Generate .jar file
echo "Generating jar package '$JAR_NAME'..."
jar --create \
--file "$JAR_NAME" \
--module-version 1.0 \
-C "$OUT_DIR" .
# Perguntar ao usuário se deseja executar o teste
read -p "Wants to run tests 'tests/test.sh'? (y/N): " respond
if [[ "$respond" == "y" || "$respond" == "Y" ]]; then
echo "Executing tests..."
bash ./tests/test "$JAR_NAME"
fi
echo "Build finished, exiting..."