Allow packaging script to do .NET Core builds.

This commit is contained in:
Pieter-Jan Briers
2019-08-11 21:42:52 +02:00
parent 418522b714
commit a2e6500d54

View File

@@ -59,8 +59,11 @@ def main():
nargs="*", nargs="*",
help="Which platform to build for. If not provided, all platforms will be built") help="Which platform to build for. If not provided, all platforms will be built")
parser.add_argument("--core", action="store_true", help="Build with .NET Core instead.")
args = parser.parse_args() args = parser.parse_args()
platforms = args.platform platforms = args.platform
core = args.core
if not platforms: if not platforms:
platforms = ["windows", "mac", "linux"] platforms = ["windows", "mac", "linux"]
@@ -73,15 +76,15 @@ def main():
if "windows" in platforms: if "windows" in platforms:
wipe_bin() wipe_bin()
build_windows() build_windows(core)
if "linux" in platforms: if "linux" in platforms:
wipe_bin() wipe_bin()
build_linux() build_linux(core)
if "mac" in platforms: if "mac" in platforms:
wipe_bin() wipe_bin()
build_macos() build_macos(core)
def wipe_bin(): def wipe_bin():
@@ -94,20 +97,25 @@ def wipe_bin():
shutil.rmtree("bin") shutil.rmtree("bin")
def build_windows(): def build_windows(core): # type: (bool) -> None
# Run a full build. # Run a full build.
print(Fore.GREEN + "Building project for Windows x64..." + Style.RESET_ALL) print(Fore.GREEN + "Building project for Windows x64..." + Style.RESET_ALL)
subprocess.run(["msbuild", command = ["msbuild",
"SpaceStation14.sln", "SpaceStation14.sln",
"/m", "/m",
"/p:Configuration=Release", "/p:Configuration=Release",
"/p:Platform=x64", "/p:Platform=x64",
"/nologo", "/nologo",
"/v:m", "/v:m",
"/p:TargetOS=Windows", "/p:TargetOS=Windows",
"/t:Rebuild", "/t:Rebuild",
"/p:FullRelease=True" "/p:FullRelease=True"
], check=True) ]
if core:
command = ["dotnet"] + command + ["/p:UseNetCore=true"]
subprocess.run(command, check=True)
print(Fore.GREEN + "Packaging Windows x64 client..." + Style.RESET_ALL) print(Fore.GREEN + "Packaging Windows x64 client..." + Style.RESET_ALL)
@@ -139,19 +147,24 @@ def build_windows():
launcher_zip.close() launcher_zip.close()
def build_macos(): def build_macos(core): # type: (bool) -> None
print(Fore.GREEN + "Building project for macOS x64..." + Style.RESET_ALL) print(Fore.GREEN + "Building project for macOS x64..." + Style.RESET_ALL)
subprocess.run(["msbuild", command = ["msbuild",
"SpaceStation14.sln", "SpaceStation14.sln",
"/m", "/m",
"/p:Configuration=Release", "/p:Configuration=Release",
"/p:Platform=x64", "/p:Platform=x64",
"/nologo", "/nologo",
"/v:m", "/v:m",
"/p:TargetOS=MacOS", "/p:TargetOS=MacOS",
"/t:Rebuild", "/t:Rebuild",
"/p:FullRelease=True" "/p:FullRelease=True"
], check=True) ]
if core:
command = ["dotnet"] + command + ["/p:UseNetCore=true"]
subprocess.run(command, check=True)
print(Fore.GREEN + "Packaging macOS x64 client..." + Style.RESET_ALL) print(Fore.GREEN + "Packaging macOS x64 client..." + Style.RESET_ALL)
# Client has to go in an app bundle. # Client has to go in an app bundle.
@@ -186,20 +199,25 @@ def build_macos():
launcher_zip.close() launcher_zip.close()
def build_linux(): def build_linux(core): # type: (bool) -> None
# Run a full build. # Run a full build.
print(Fore.GREEN + "Building project for Linux x64..." + Style.RESET_ALL) print(Fore.GREEN + "Building project for Linux x64..." + Style.RESET_ALL)
subprocess.run(["msbuild", command = ["msbuild",
"SpaceStation14.sln", "SpaceStation14.sln",
"/m", "/m",
"/p:Configuration=Release", "/p:Configuration=Release",
"/p:Platform=x64", "/p:Platform=x64",
"/nologo", "/nologo",
"/v:m", "/v:m",
"/p:TargetOS=Linux", "/p:TargetOS=Linux",
"/t:Rebuild", "/t:Rebuild",
"/p:FullRelease=True" "/p:FullRelease=True"
], check=True) ]
if core:
command = ["dotnet"] + command + ["/p:UseNetCore=true"]
subprocess.run(command, check=True)
print(Fore.GREEN + "Packaging Linux x64 client..." + Style.RESET_ALL) print(Fore.GREEN + "Packaging Linux x64 client..." + Style.RESET_ALL)