-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·85 lines (73 loc) · 3.05 KB
/
build.sh
File metadata and controls
executable file
·85 lines (73 loc) · 3.05 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
#!/usr/bin/env bash
set -euo pipefail
ONLY_VERSION=${ONLY_VERSION:-}
DRY_RUN=${DRY_RUN:-0}
# Allow “pattern→empty” instead of “pattern→itself”
shopt -s nullglob
# Format: minecraft_version yarn_mappings loader_version loom_version fabric_version
VERSIONS=$(cat <<'EOF'
1.20 1.20+build.1 0.16.14 1.10-SNAPSHOT 0.83.0+1.20
1.20.1 1.20.1+build.10 0.15.11 1.10-SNAPSHOT 0.92.1+1.20.1
1.20.2 1.20.2+build.4 0.15.11 1.10-SNAPSHOT 0.91.6+1.20.2
1.20.3 1.20.3+build.1 0.15.11 1.10-SNAPSHOT 0.91.1+1.20.3
1.20.4 1.20.4+build.3 0.15.11 1.10-SNAPSHOT 0.97.0+1.20.4
1.20.5 1.20.5+build.1 0.16.14 1.10-SNAPSHOT 0.97.8+1.20.5
1.20.6 1.20.6+build.3 0.16.14 1.10-SNAPSHOT 0.100.8+1.20.6
1.21 1.21+build.9 0.16.14 1.10-SNAPSHOT 0.102.0+1.21
1.21.1 1.21.1+build.3 0.16.14 1.10-SNAPSHOT 0.116.3+1.21.1
1.21.2 1.21.2+build.1 0.16.14 1.10-SNAPSHOT 0.106.1+1.21.2
1.21.3 1.21.3+build.2 0.16.14 1.10-SNAPSHOT 0.114.1+1.21.3
1.21.4 1.21.4+build.8 0.16.14 1.10-SNAPSHOT 0.119.3+1.21.4
EOF
)
while read -r mc_version yarn_mapping loader_version loom_version fabric_version; do
[[ -z "$mc_version" || "$mc_version" =~ ^# ]] && continue
[[ -n "$ONLY_VERSION" && "$ONLY_VERSION" != "$mc_version" ]] && continue
echo "****"
echo "Building for MC $mc_version Fabric API $fabric_version"
echo "****"
if [[ "$DRY_RUN" == "1" ]]; then
cat <<EOD
[DRY RUN] gradle.properties -> \
minecraft_version=$mc_version, \
yarn_mappings=$yarn_mapping, \
loader_version=$loader_version, \
loom_version=$loom_version, \
fabric_version=$fabric_version
[DRY RUN] fabric.mod.json -> "minecraft": "~$mc_version"
[DRY RUN] run './gradlew build -x test --build-cache --parallel'
[DRY RUN] download fabric-api-$fabric_version.jar from FabricMC
EOD
echo
continue
fi
sed -i \
-e "s/^minecraft_version=.*/minecraft_version=$mc_version/" \
-e "s/^yarn_mappings=.*/yarn_mappings=$yarn_mapping/" \
-e "s/^loader_version=.*/loader_version=$loader_version/" \
-e "s/^loom_version=.*/loom_version=$loom_version/" \
-e "s/^fabric_version=.*/fabric_version=$fabric_version/" \
gradle.properties
sed -i "s/\"minecraft\": \".*\"/\"minecraft\": \"~$mc_version\"/" \
src/main/resources/fabric.mod.json
./gradlew build -x test --build-cache --parallel
find build/libs -name '*sources*.jar' -delete
mv build/libs/creaturechat-*.jar .
# safe Forge packaging for exactly 1.20.1
if [[ "$mc_version" == "1.20.1" ]]; then
forge_jars=(creaturechat-*+1.20.1.jar)
if (( ${#forge_jars[@]} )); then
jar="${forge_jars[0]}"
cp "$jar" "${jar%.jar}-forge.jar"
touch FORGE
zip -r "${jar%.jar}-forge.jar" FORGE
else
echo "Warning: no jar matched for Forge packaging (creaturechat-*+1.20.1.jar)" >&2
fi
fi
# download Fabric API
api_jar="fabric-api-${fabric_version}.jar"
url="https://github.com/FabricMC/fabric/releases/download/${fabric_version//+/%2B}/${api_jar}"
wget -q -O "$api_jar" "$url"
echo
done <<< "$VERSIONS"