Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preliminary 3.4.0 Support #123

Merged
merged 10 commits into from
Jul 14, 2022
45 changes: 33 additions & 12 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ if [[ ${BASH_VERSINFO[0]} -lt 4 ]] || [[ ${BASH_VERSINFO[0]} -eq 4 && ${BASH_VER
fi

# Game versions for uploading
declare -A game_flavor=( ["retail"]="retail" ["classic"]="classic" ["bcc"]="bcc" ["mainline"]="retail" ["tbc"]="bcc" ["vanilla"]="classic" )
declare -A game_flavor=( ["retail"]="retail" ["classic"]="classic" ["bcc"]="bcc" ["mainline"]="retail" ["tbc"]="bcc" ["vanilla"]="classic" ["wrath"]="wrath" ["wotlkc"]="wrath" )

declare -A game_type_version=() # type -> version
declare -A game_type_interface=() # type -> toc
Expand Down Expand Up @@ -116,7 +116,8 @@ filename_filter() {
[ -n "$skip_invalid" ] && invalid="&"
if [[ -n $game_type ]] && [[ "$game_type" != "retail" ]] && \
[[ "$game_type" != "classic" || "${si_project_version,,}" != *"-classic"* ]] &&\
[[ "$game_type" != "bcc" || "${si_project_version,,}" != *"-bcc"* ]]
[[ "$game_type" != "bcc" || "${si_project_version,,}" != *"-bcc"* ]] &&\
[[ "$game_type" != "wrath" || "${si_project_version,,}" != *"-wrath"* ]]
then
# only append the game type if the tag doesn't include it
classic="-$game_type"
Expand Down Expand Up @@ -217,7 +218,7 @@ while getopts ":celLzusSop:dw:a:r:t:g:m:n:" opt; do
g) # Set the game type or version
OPTARG="${OPTARG,,}"
case "$OPTARG" in
retail|classic|bcc) game_type="$OPTARG" ;; # game_version from toc
retail|classic|bcc|wrath) game_type="$OPTARG" ;; # game_version from toc
mainline) game_type="retail" ;;
*)
# Set game version (x.y.z)
Expand All @@ -233,6 +234,8 @@ while getopts ":celLzusSop:dw:a:r:t:g:m:n:" opt; do
game_type="classic"
elif [[ ${BASH_REMATCH[1]} == "2" ]]; then
game_type="bcc"
elif [[ ${BASH_REMATCH[1]} == "3" ]]; then
game_type="wrath"
else
game_type="retail"
fi
Expand Down Expand Up @@ -1064,6 +1067,7 @@ do_toc() {
"") toc_game_type= ;;
11*) toc_game_type="classic" ;;
20*) toc_game_type="bcc" ;;
30*) toc_game_type="wrath" ;;
*) toc_game_type="retail"
esac
si_game_type_interface=()
Expand All @@ -1072,7 +1076,7 @@ do_toc() {

root_toc_version="$toc_version"

if [[ ${toc_name} =~ "$package_name"[-_](Mainline|Classic|Vanilla|BCC|TBC)\.toc$ ]]; then
if [[ ${toc_name} =~ "$package_name"[-_](Mainline|Classic|Vanilla|BCC|TBC|Wrath|WOTLKC)\.toc$ ]]; then
# Flavored
if [[ -z "$toc_version" ]]; then
echo "$toc_name is missing an interface version." >&2
Expand Down Expand Up @@ -1103,6 +1107,7 @@ do_toc() {
case $toc_version in
11*) toc_game_type="classic" ;;
20*) toc_game_type="bcc" ;;
30*) toc_game_type="wrath" ;;
*) toc_game_type="retail"
esac
fi
Expand All @@ -1113,6 +1118,7 @@ do_toc() {
case $toc_game_type in
classic) toc_version=$( sed -n '/@non-[-a-z]*@/,/@end-non-[-a-z]*@/{//b;p}' <<< "$toc_file" | awk '/#[[:blank:]]*## Interface:[[:blank:]]*(11)/ { print $NF; exit }' ) ;;
bcc) toc_version=$( sed -n '/@non-[-a-z]*@/,/@end-non-[-a-z]*@/{//b;p}' <<< "$toc_file" | awk '/#[[:blank:]]*## Interface:[[:blank:]]*(20)/ { print $NF; exit }' ) ;;
wrath) toc_version=$( sed -n '/@non-[-a-z]*@/,/@end-non-[-a-z]*@/{//b;p}' <<< "$toc_file" | awk '/#[[:blank:]]*## Interface:[[:blank:]]*(30)/ { print $NF; exit }' ) ;;
esac
# This becomes the actual interface version after replacements
root_toc_version="$toc_version"
Expand Down Expand Up @@ -1172,6 +1178,7 @@ set_build_version() {
case $toc_version in
11*) toc_game_type="classic" ;;
20*) toc_game_type="bcc" ;;
30*) toc_game_type="wrath" ;;
*) toc_game_type="retail"
esac
if [[ -z $game_type || $game_type == "$toc_game_type" ]]; then
Expand Down Expand Up @@ -1203,14 +1210,14 @@ if [[ -z "$package" ]]; then
exit 1
fi
package=${package%.toc}
if [[ $package =~ ^(.*)([-_](Mainline|Classic|Vanilla|BCC|TBC))$ ]]; then
if [[ $package =~ ^(.*)([-_](Mainline|Classic|Vanilla|BCC|TBC|Wrath|WOTLKC))$ ]]; then
echo "Ambiguous addon name. No fallback TOC file or addon name includes an expansion suffix (${BASH_REMATCH[2]}). Set 'package-as' in .pkgmeta" >&2
exit 1
fi
fi

# Parse the project root TOC files for info first
for toc_path in "$topdir/$package"{,-Mainline,_Mainline,-Classic,_Classic,-Vanilla,_Vanilla,-BCC,_BCC,-TBC,_TBC}.toc; do
for toc_path in "$topdir/$package"{,-Mainline,_Mainline,-Classic,_Classic,-Vanilla,_Vanilla,-BCC,_BCC,-TBC,_TBC,-Wrath,_Wrath,-WOTLKC,_WOTLKC}.toc; do
if [[ -f "$toc_path" ]]; then
set_toc_project_info "$toc_path"
toc_root_paths["$topdir"]="$package"
Expand All @@ -1226,7 +1233,7 @@ done

# Parse project TOC files
for path in "${!toc_root_paths[@]}"; do
for toc_path in "$path/${toc_root_paths[$path]}"{,-Mainline,_Mainline,-Classic,_Classic,-Vanilla,_Vanilla,-BCC,_BCC,-TBC,_TBC}.toc; do
for toc_path in "$path/${toc_root_paths[$path]}"{,-Mainline,_Mainline,-Classic,_Classic,-Vanilla,_Vanilla,-BCC,_BCC,-TBC,_TBC,-Wrath,_Wrath,-WOTLKC,_WOTLKC}.toc; do
if [[ -f "$toc_path" ]]; then
set_toc_project_info "$toc_path"
do_toc "$toc_path" "${toc_root_paths[$path]}"
Expand Down Expand Up @@ -1683,6 +1690,7 @@ copy_directory_tree() {
[ "$_cdt_gametype" != "retail" ] && _cdt_filters+="|lua_filter version-retail|lua_filter retail"
[ "$_cdt_gametype" != "classic" ] && _cdt_filters+="|lua_filter version-classic"
[ "$_cdt_gametype" != "bcc" ] && _cdt_filters+="|lua_filter version-bcc"
[ "$_cdt_gametype" != "wrath" ] && _cdt_filters+="|lua_filter version-wrath"
[ -n "$_cdt_localization" ] && _cdt_filters+="|localization_filter"
;;
*.xml)
Expand All @@ -1693,6 +1701,7 @@ copy_directory_tree() {
[ "$_cdt_gametype" != "retail" ] && _cdt_filters+="|xml_filter version-retail|xml_filter retail"
[ "$_cdt_gametype" != "classic" ] && _cdt_filters+="|xml_filter version-classic"
[ "$_cdt_gametype" != "bcc" ] && _cdt_filters+="|xml_filter version-bcc"
[ "$_cdt_gametype" != "wrath" ] && _cdt_filters+="|xml_filter version-wrath"
;;
*.toc)
# We only care about processing project TOC files
Expand All @@ -1704,6 +1713,7 @@ copy_directory_tree() {
case ${toc_root_interface["$_cdt_srcdir/$file"]} in
11*) _cdt_gametype="classic" ;;
20*) _cdt_gametype="bcc" ;;
30*) _cdt_gametype="wrath" ;;
*) _cdt_gametype="retail"
esac
fi
Expand All @@ -1715,6 +1725,7 @@ copy_directory_tree() {
_cdt_filters+="|toc_filter version-retail $([[ "$_cdt_gametype" != "retail" ]] && echo "true")"
_cdt_filters+="|toc_filter version-classic $([[ "$_cdt_gametype" != "classic" ]] && echo "true")"
_cdt_filters+="|toc_filter version-bcc $([[ "$_cdt_gametype" != "bcc" ]] && echo "true")"
_cdt_filters+="|toc_filter version-wrath $([[ "$_cdt_gametype" != "wrath" ]] && echo "true")"
_cdt_filters+="|toc_interface_filter '${si_game_type_interface_all[${_cdt_gametype:- }]}' '${toc_root_interface["$_cdt_srcdir/$file"]}'"
[ -n "$_cdt_localization" ] && _cdt_filters+="|localization_filter"
fi
Expand All @@ -1730,10 +1741,10 @@ copy_directory_tree() {
echo " Copying: $file"

# Make sure we're not causing any surprises
if [[ -z $_cdt_gametype && ( $file == *".lua" || $file == *".xml" || $file == *".toc" ) ]] && grep -q '@\(non-\)\?version-\(retail\|classic\|bcc\)@' "$_cdt_srcdir/$file"; then
if [[ -z $_cdt_gametype && ( $file == *".lua" || $file == *".xml" || $file == *".toc" ) ]] && grep -q '@\(non-\)\?version-\(retail\|classic\|bcc\|wrath\)@' "$_cdt_srcdir/$file"; then
echo " Error! Build type version keywords are not allowed in a multi-version build." >&2
echo " These should be replaced with lua conditional statements:" >&2
grep -n '@\(non-\)\?version-\(retail\|classic\|bcc\)@' "$_cdt_srcdir/$file" | sed 's/^/ /' >&2
grep -n '@\(non-\)\?version-\(retail\|classic\|bcc\|wrath\)@' "$_cdt_srcdir/$file" | sed 's/^/ /' >&2
echo " See https://wowpedia.fandom.com/wiki/WOW_PROJECT_ID" >&2
exit 1
fi
Expand All @@ -1751,6 +1762,7 @@ copy_directory_tree() {
retail) new_file+="_Mainline.toc" ;;
classic) new_file+="_Vanilla.toc" ;;
bcc) new_file+="_TBC.toc" ;;
wrath) new_file+="_Wrath.toc" ;;
esac

echo " Creating $new_file [$toc_version]"
Expand All @@ -1764,6 +1776,7 @@ copy_directory_tree() {
_cdt_filters+="|toc_filter version-retail $([[ "$type" != "retail" ]] && echo "true")"
_cdt_filters+="|toc_filter version-classic $([[ "$type" != "classic" ]] && echo "true")"
_cdt_filters+="|toc_filter version-bcc $([[ "$type" != "bcc" ]] && echo "true")"
_cdt_filters+="|toc_filter version-wrath $([[ "$type" != "wrath" ]] && echo "true")"
_cdt_filters+="|toc_interface_filter '$toc_version' '$root_toc_version'"
_cdt_filters+="|line_ending_filter"

Expand Down Expand Up @@ -2506,12 +2519,13 @@ upload_curseforge() {
_cf_game_version_id=
_cf_game_version=
local version_name version_id game_id
for type in "classic" "bcc" "retail"; do # sort order (last id is show as the version on the project's files page apparently)
for type in "classic" "bcc" "wrath" "retail"; do # sort order (last id is show as the version on the project's files page apparently)
version_name="${game_type_version[$type]}"
[[ -z $version_name ]] && continue
case $type in
classic) game_id=67408 ;;
bcc) game_id=73246 ;;
wrath) game_id=73713 ;;
*) game_id=517
esac

Expand Down Expand Up @@ -2619,6 +2633,10 @@ upload_wowinterface() {
version="${game_type_version[$type]}"
# check the version
if ! jq -e --arg v "$version" 'map(select(.id == $v)) | length > 0' <<< "$_wowi_versions" &>/dev/null; then
if [[ $type == "wrath" ]]; then # XXX compat
echo "WARNING: Wrath is currently unsupported by WoWInterface, falling back to BCC" >&2
version="2.5.10"
fi
# split out the versions that match the version we're checking against (to keep things more readable)
_wowi_versions_type=$( echo "$_wowi_versions" | jq -c --arg v "$version" 'map(select( (.id | .[:2]) == ($v | .[:2]) ))' )
if [[ $_wowi_versions_type == "[]" ]]; then
Expand Down Expand Up @@ -2722,8 +2740,11 @@ upload_wago() {
local version wago_type
for type in "${!game_type_version[@]}"; do
version="${game_type_version[$type]}"
wago_type="$type"
[[ "$wago_type" == "bcc" ]] && wago_type="bc"
case $type in
bcc) wago_type="bc" ;;
wrath) wago_type="wotlk" ;;
*) wago_type="$type"
esac
# check the version
if ! jq -e --arg t "$wago_type" --arg v "$version" '.[$t] | index($v)' <<< "$_wago_versions" &>/dev/null; then
# no match, so grab the next highest version (try to avoid testing versions)
Expand Down