Allow packaging script to do .NET Core builds.
This commit is contained in:
@@ -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,10 +97,10 @@ 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",
|
||||||
@@ -107,7 +110,12 @@ def build_windows():
|
|||||||
"/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,9 +147,9 @@ 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",
|
||||||
@@ -151,7 +159,12 @@ def build_macos():
|
|||||||
"/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,10 +199,10 @@ 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",
|
||||||
@@ -199,7 +212,12 @@ def build_linux():
|
|||||||
"/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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user