Skip to content

Commit

Permalink
Fix build type version filters
Browse files Browse the repository at this point in the history
  • Loading branch information
nebularg committed Feb 22, 2022
1 parent f978d69 commit 329bf49
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 28 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,22 @@ So what does this mean for you?
one for each supported game type, and game versions will be set from them on
upload. So if you've already been dabbling with multiple tocs and/or
multiple versions, you no longer need to manually set the versions via `-g`
or on the website.
or on the CurseForge website.
2. If you are using multiple `## Interface-Type` lines in your TOC file, you can
now use the `-S` option to automatically generate game type specific TOC
files based on your existing preproccessing logic. You will still need to
merge `.pkgmeta` files if your old workflow used a different file per build.
3. If you use build type keywords (e.g., `@version-retail@` ... `@end-version-retail@`)
for controlling what code blocks execute based on the build version, in a
multi-version build, everything will get commented out since no specific
version is being targeted.

For a multi-version build, you should switch keyword usage to plain old lua
control statements. Fortunately, there are builtin constants you can use for
this. `WOW_PROJECT_ID` is what game version you are currently running and
can be checked against `WOW_PROJECT_MAINLINE`, `WOW_PROJECT_CLASSIC`, and
`WOW_PROJECT_BURNING_CRUSADE_CLASSIC` (e.g., `if WOW_PROJECT_ID ==
WOW_PROJECT_MAINLINE then ... end`).

## Customizing the build

Expand Down
42 changes: 15 additions & 27 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ copy_directory_tree() {
_cdt_external=
_cdt_split=
OPTIND=1
while getopts :adi:lnpu:c:eS _cdt_opt "$@"; do
while getopts :adi:lnpu:g:eS _cdt_opt "$@"; do
# shellcheck disable=2220
case $_cdt_opt in
a) _cdt_alpha="true" ;;
Expand All @@ -1530,7 +1530,7 @@ copy_directory_tree() {
n) _cdt_nolib="true" ;;
p) _cdt_do_not_package="true" ;;
u) _cdt_unchanged_patterns=$OPTARG ;;
c) _cdt_classic=$OPTARG ;;
g) _cdt_gametype=$OPTARG ;;
e) _cdt_external="true" ;;
S) _cdt_split="true" ;;
esac
Expand Down Expand Up @@ -1599,42 +1599,30 @@ copy_directory_tree() {
[ -n "$_cdt_do_not_package" ] && _cdt_filters+="|do_not_package_filter lua"
[ -n "$_cdt_debug" ] && _cdt_filters+="|lua_filter debug"
[ -n "$_cdt_alpha" ] && _cdt_filters+="|lua_filter alpha"
if [ -n "$_cdt_classic" ]; then
_cdt_filters+="|lua_filter retail"
_cdt_filters+="|lua_filter version-retail"
[ "$_cdt_classic" != "bcc" ] && _cdt_filters+="|lua_filter version-bcc"
[ "$_cdt_classic" != "classic" ] && _cdt_filters+="|lua_filter version-classic"
else
_cdt_filters+="|lua_filter version-classic"
_cdt_filters+="|lua_filter version-bcc"
fi
[ "$_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"
[ -n "$_cdt_localization" ] && _cdt_filters+="|localization_filter"
;;
*.xml)
[ -n "$_cdt_do_not_package" ] && _cdt_filters+="|do_not_package_filter xml"
[ -n "$_cdt_nolib" ] && _cdt_filters+="|xml_filter no-lib-strip"
[ -n "$_cdt_debug" ] && _cdt_filters+="|xml_filter debug"
[ -n "$_cdt_alpha" ] && _cdt_filters+="|xml_filter alpha"
if [ -n "$_cdt_classic" ]; then
_cdt_filters+="|xml_filter retail"
_cdt_filters+="|xml_filter version-retail"
[ "$_cdt_classic" != "bcc" ] && _cdt_filters+="|xml_filter version-bcc"
[ "$_cdt_classic" != "classic" ] && _cdt_filters+="|xml_filter version-classic"
else
_cdt_filters+="|xml_filter version-classic"
_cdt_filters+="|xml_filter version-bcc"
fi
[ "$_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"
;;
*.toc)
do_toc "$_cdt_srcdir/$file" "$package"
_cdt_filters+="|do_not_package_filter toc"
[ -n "$_cdt_nolib" ] && _cdt_filters+="|toc_filter no-lib-strip true" # leave the tokens in the file normally
_cdt_filters+="|toc_filter debug ${_cdt_debug}"
_cdt_filters+="|toc_filter alpha ${_cdt_alpha}"
_cdt_filters+="|toc_filter retail ${_cdt_classic:+true}"
_cdt_filters+="|toc_filter version-retail ${_cdt_classic:+true}"
_cdt_filters+="|toc_filter version-classic $([[ "$_cdt_classic" != "classic" ]] && echo "true")"
_cdt_filters+="|toc_filter version-bcc $([[ "$_cdt_classic" != "bcc" ]] && echo "true")"
_cdt_filters+="|toc_filter retail $([[ "$_cdt_gametype" != "retail" ]] && echo "true")"
_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_interface_filter '${si_game_type_interface[${game_type:- }]}' '${toc_root_interface["$_cdt_srcdir/$file"]}'"
[ -n "$_cdt_localization" ] && _cdt_filters+="|localization_filter"
;;
Expand All @@ -1655,8 +1643,8 @@ copy_directory_tree() {
# This uses version info from the main TOC file
# Reparsing seems a bit much when they should be the same
for type in "${!si_game_type_interface[@]}"; do
toc_version=${si_game_type_interface[$type]}
new_file=${file%.toc}
toc_version="${si_game_type_interface[$type]}"
new_file="${file%.toc}"
case $type in
retail) new_file+="_Mainline.toc" ;;
classic) new_file+="_Vanilla.toc" ;;
Expand Down Expand Up @@ -1701,7 +1689,7 @@ if [ -z "$skip_copying" ]; then
[ -z "$skip_localization" ] && cdt_args+="l"
[ -n "$nolib" ] && cdt_args+="n"
[ -n "$split" ] && cdt_args+="S"
[[ -n "$game_type" && "$game_type" != "retail" ]] && cdt_args+=" -c $game_type"
[ -n "$game_type" ] && cdt_args+=" -g $game_type"
[ -n "$ignore" ] && cdt_args+=" -i \"$ignore\""
[ -n "$changelog" ] && cdt_args+=" -u \"$changelog\""
eval copy_directory_tree "$cdt_args" "\"$topdir\"" "\"$pkgdir\""
Expand Down

0 comments on commit 329bf49

Please sign in to comment.