Hybrid ACZ build option & add (off-by-default) 32-bit platform RIDs (#5453)

This commit is contained in:
20kdc
2021-11-23 13:26:26 +00:00
committed by GitHub
parent 943e46eece
commit 545e36912a
2 changed files with 31 additions and 10 deletions

View File

@@ -24,20 +24,26 @@ except ImportError:
Style = ColorDummy()
class PlatformReg:
def __init__(self, rid: str, target_os: str):
def __init__(self, rid: str, target_os: str, build_by_default: bool):
self.rid = rid
self.target_os = target_os
self.build_by_default = build_by_default
p = os.path.join
PLATFORMS = [
PlatformReg("win-x64", "Windows"),
PlatformReg("linux-x64", "Linux"),
PlatformReg("linux-arm64", "Linux"),
PlatformReg("osx-x64", "MacOS"),
PlatformReg("win-x64", "Windows", True),
PlatformReg("linux-x64", "Linux", True),
PlatformReg("linux-arm64", "Linux", True),
PlatformReg("osx-x64", "MacOS", True),
# Non-default platforms (i.e. for Watchdog Git)
PlatformReg("win-x86", "Windows", False),
PlatformReg("linux-x86", "Linux", False),
PlatformReg("linux-arm", "Linux", False),
]
PLATFORM_RIDS = {x.rid for x in PLATFORMS}
PLATFORM_RIDS_DEFAULT = {x.rid for x in filter(lambda val: val.build_by_default, PLATFORMS)}
SHARED_IGNORED_RESOURCES = {
".gitignore",
@@ -80,12 +86,17 @@ def main() -> None:
action="store_true",
help=argparse.SUPPRESS)
parser.add_argument("--hybrid-acz",
action="store_true",
help="Creates a 'Hybrid ACZ' build that contains an embedded Content.Client.zip the server hosts.")
args = parser.parse_args()
platforms = args.platform
skip_build = args.skip_build
hybrid_acz = args.hybrid_acz
if not platforms:
platforms = PLATFORM_RIDS
platforms = PLATFORM_RIDS_DEFAULT
if os.path.exists("release"):
print(Fore.BLUE + Style.DIM +
@@ -94,13 +105,20 @@ def main() -> None:
os.mkdir("release")
if hybrid_acz:
# Hybrid ACZ involves a file "Content.Client.zip" in the server executable directory.
# Rather than hosting the client ZIP on the watchdog or on a separate server,
# Hybrid ACZ uses the ACZ hosting functionality to host it as part of the status host,
# which means that features such as automatic UPnP forwarding still work properly.
import package_client_build
package_client_build.build(skip_build)
# Good variable naming right here.
for platform in PLATFORMS:
if platform.rid not in platforms:
continue
build_platform(platform, skip_build)
build_platform(platform, skip_build, hybrid_acz)
def wipe_bin():
print(Fore.BLUE + Style.DIM +
@@ -112,7 +130,7 @@ def wipe_bin():
shutil.rmtree("bin")
def build_platform(platform: PlatformReg, skip_build: bool) -> None:
def build_platform(platform: PlatformReg, skip_build: bool, hybrid_acz: bool) -> None:
print(Fore.GREEN + f"Building project for {platform.rid}..." + Style.RESET_ALL)
if not skip_build:
@@ -137,6 +155,9 @@ def build_platform(platform: PlatformReg, skip_build: bool) -> None:
copy_dir_into_zip(p("RobustToolbox", "bin", "Server", platform.rid, "publish"), "", server_zip)
copy_resources(p("Resources"), server_zip)
copy_content_assemblies(p("Resources", "Assemblies"), server_zip)
if hybrid_acz:
# Hybrid ACZ expects "Content.Client.zip" (as it's not SS14-specific)
server_zip.write(p("release", "SS14.Client.zip"), "Content.Client.zip")
server_zip.close()