-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·47 lines (37 loc) · 1.4 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
#!/bin/bash
# Check if inotifywait is installed
if [ -z "$(which inotifywait)" ]; then
echo "inotifywait not installed."
echo "Install the inotify-tools package and try again."
exit 1
fi
# Directory to monitor for changes
dir="./Source"
MOD=$(basename $PWD)
# Define the path to your solution file
solutionPath="Source/${MOD}.sln"
# Define an array of configurations
configurations=("Release v1.2" "Release v1.3" "Release v1.4" "Release v1.5")
function build() {
# Loop through each configuration and build it
for config in "${configurations[@]}"; do
echo "Building for configuration: $config"
msbuild "$solutionPath" /p:Configuration="$config" &
done
echo "All builds completed!"
}
build
cp -avf /rimworld/1.3/Mods/${MOD}/1.3 /rimworld/1.2/Mods/${MOD}
cp -avf /rimworld/1.4/Mods/${MOD}/1.4 /rimworld/1.2/Mods/${MOD}
cp -avf /rimworld/1.5/Mods/${MOD}/1.5 /rimworld/1.2/Mods/${MOD}
# Watch for changes to .cs files in the directory and subdirectories
inotifywait --recursive --monitor --format "%e %w%f" \
--event modify,move,create,delete $dir \
--include '\.cs$' |
while read changed; do
echo "Detected change in $changed"
build
cp -avf /rimworld/1.3/Mods/${MOD}/1.3 /rimworld/1.2/Mods/${MOD}
cp -avf /rimworld/1.4/Mods/${MOD}/1.4 /rimworld/1.2/Mods/${MOD}
cp -avf /rimworld/1.5/Mods/${MOD}/1.5 /rimworld/1.2/Mods/${MOD}
done