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="*",
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()
platforms = args.platform
core = args.core
if not platforms:
platforms = ["windows", "mac", "linux"]
@@ -73,15 +76,15 @@ def main():
if "windows" in platforms:
wipe_bin()
build_windows()
build_windows(core)
if "linux" in platforms:
wipe_bin()
build_linux()
build_linux(core)
if "mac" in platforms:
wipe_bin()
build_macos()
build_macos(core)
def wipe_bin():
@@ -94,10 +97,10 @@ def wipe_bin():
shutil.rmtree("bin")
def build_windows():
def build_windows(core): # type: (bool) -> None
# Run a full build.
print(Fore.GREEN + "Building project for Windows x64..." + Style.RESET_ALL)
subprocess.run(["msbuild",
command = ["msbuild",
"SpaceStation14.sln",
"/m",
"/p:Configuration=Release",
@@ -107,7 +110,12 @@ def build_windows():
"/p:TargetOS=Windows",
"/t:Rebuild",
"/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)
@@ -139,9 +147,9 @@ def build_windows():
launcher_zip.close()
def build_macos():
def build_macos(core): # type: (bool) -> None
print(Fore.GREEN + "Building project for macOS x64..." + Style.RESET_ALL)
subprocess.run(["msbuild",
command = ["msbuild",
"SpaceStation14.sln",
"/m",
"/p:Configuration=Release",
@@ -151,7 +159,12 @@ def build_macos():
"/p:TargetOS=MacOS",
"/t:Rebuild",
"/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)
# Client has to go in an app bundle.
@@ -186,10 +199,10 @@ def build_macos():
launcher_zip.close()
def build_linux():
def build_linux(core): # type: (bool) -> None
# Run a full build.
print(Fore.GREEN + "Building project for Linux x64..." + Style.RESET_ALL)
subprocess.run(["msbuild",
command = ["msbuild",
"SpaceStation14.sln",
"/m",
"/p:Configuration=Release",
@@ -199,7 +212,12 @@ def build_linux():
"/p:TargetOS=Linux",
"/t:Rebuild",
"/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)