-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·86 lines (67 loc) · 2.09 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·86 lines (67 loc) · 2.09 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
# Usage: ./setup.sh [clean|install|dist]
set -e
# Paths (adjust if needed)
GRADLE_DIR="./agent" # Change this to the actual directory name
PYTHON_DIR="."
PYTHON_DIR="./matilda" # Change this to the actual directory name
PROTO_DIR="$PYTHON_DIR/protos"
GENERATED_DIR="$PYTHON_DIR/generated"
RESOURCES_DIR="$PYTHON_DIR/resources"
TESTS_DIR="./tests"
TESTS_PROTO_DIR="$TESTS_DIR/protos"
TESTS_GENERATED_DIR="$TESTS_DIR/generated"
TESTS_RESOURCES_DIR="$TESTS_DIR/resources"
do_clean() {
echo "Cleaning Gradle project..."
(cd "$GRADLE_DIR" && ./gradlew clean)
echo "Cleaning Python project..."
find "$PYTHON_DIR" -type d -name "__pycache__" -exec rm -rf {} +
rm -rf build dist *.egg-info
echo "Deleting 'generated' directories..."
rm -rf "$GENERATED_DIR" "$TESTS_GENERATED_DIR"
echo "Deleting *.pb2.py files in $PROTO_DIR..."
find "$PROTO_DIR" -name "*_pb2.py" -type f -delete
echo "Deleting *.pb2.py files in $TEST_PLUGIN_PROTO_DIR..."
find "$TESTS_PROTO_DIR" -name "*_pb2.py" -type f -delete
echo "Cleaning resources directories except required files..."
find "$RESOURCES_DIR" -type f ! -name ".gitignore" ! -name "__init__.py" ! -name "resources.py" -delete
find "$TESTS_RESOURCES_DIR" -type f ! -name ".gitignore" ! -name "__init__.py" -delete
echo "Clean completed."
}
do_install() {
echo "Assembling Gradle project..."
(cd "$GRADLE_DIR" && ./gradlew assemble publishAllPublicationsToMavenLocalRepository)
echo "Installing Python project..."
pip install .
echo "Install completed."
}
do_dist() {
echo "Assembling Gradle project..."
(cd "$GRADLE_DIR" && ./gradlew assemble)
echo "Creating Python distribution..."
python setup.py sdist bdist_wheel
echo "Distribution created."
}
# Main loop over all arguments
if [ "$#" -eq 0 ]; then
echo "Usage: $0 [clean] [install] [dist]"
exit 1
fi
for action in "$@"; do
case "$action" in
clean)
do_clean
;;
install)
do_install
;;
dist)
do_dist
;;
*)
echo "Unknown action: $action"
echo "Usage: $0 [clean] [install] [dist]"
exit 1
;;
esac
done