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

@@ -78,7 +78,7 @@ def wipe_bin():
if os.path.exists("bin"): if os.path.exists("bin"):
shutil.rmtree("bin") shutil.rmtree("bin")
# Be advised this is called from package_server_build during a Hybrid-ACZ build.
def build(skip_build: bool) -> None: def build(skip_build: bool) -> None:
# Run a full build. # Run a full build.
print(Fore.GREEN + "Building project..." + Style.RESET_ALL) print(Fore.GREEN + "Building project..." + Style.RESET_ALL)

View File

@@ -24,20 +24,26 @@ except ImportError:
Style = ColorDummy() Style = ColorDummy()
class PlatformReg: 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.rid = rid
self.target_os = target_os self.target_os = target_os
self.build_by_default = build_by_default
p = os.path.join p = os.path.join
PLATFORMS = [ PLATFORMS = [
PlatformReg("win-x64", "Windows"), PlatformReg("win-x64", "Windows", True),
PlatformReg("linux-x64", "Linux"), PlatformReg("linux-x64", "Linux", True),
PlatformReg("linux-arm64", "Linux"), PlatformReg("linux-arm64", "Linux", True),
PlatformReg("osx-x64", "MacOS"), 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 = {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 = { SHARED_IGNORED_RESOURCES = {
".gitignore", ".gitignore",
@@ -80,12 +86,17 @@ def main() -> None:
action="store_true", action="store_true",
help=argparse.SUPPRESS) 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() args = parser.parse_args()
platforms = args.platform platforms = args.platform
skip_build = args.skip_build skip_build = args.skip_build
hybrid_acz = args.hybrid_acz
if not platforms: if not platforms:
platforms = PLATFORM_RIDS platforms = PLATFORM_RIDS_DEFAULT
if os.path.exists("release"): if os.path.exists("release"):
print(Fore.BLUE + Style.DIM + print(Fore.BLUE + Style.DIM +
@@ -94,13 +105,20 @@ def main() -> None:
os.mkdir("release") 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. # Good variable naming right here.
for platform in PLATFORMS: for platform in PLATFORMS:
if platform.rid not in platforms: if platform.rid not in platforms:
continue continue
build_platform(platform, skip_build) build_platform(platform, skip_build, hybrid_acz)
def wipe_bin(): def wipe_bin():
print(Fore.BLUE + Style.DIM + print(Fore.BLUE + Style.DIM +
@@ -112,7 +130,7 @@ def wipe_bin():
shutil.rmtree("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) print(Fore.GREEN + f"Building project for {platform.rid}..." + Style.RESET_ALL)
if not skip_build: 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_dir_into_zip(p("RobustToolbox", "bin", "Server", platform.rid, "publish"), "", server_zip)
copy_resources(p("Resources"), server_zip) copy_resources(p("Resources"), server_zip)
copy_content_assemblies(p("Resources", "Assemblies"), 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() server_zip.close()