diff --git a/.appveyor.yml b/.appveyor.yml index 834c0c3031..81790d591f 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,5 +1,5 @@ version: 1.0.{build} -image: Visual Studio 2017 +image: Visual Studio 2019 platform: x64 configuration: Debug @@ -12,10 +12,9 @@ build: before_build: - cmd: py -3 -m pip install --user requests - cmd: py -3 RUN_THIS.py --no-prompt -- cmd: nuget restore SpaceStation14.sln build_script: -- ps: msbuild SpaceStation14.sln /v:m /nologo /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /p:Platform=x64 /p:Configuration=Debug /p:AppVeyor=yes +- ps: dotnet build SpaceStation14.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /p:AppVeyor=yes test: assemblies: diff --git a/.travis.yml b/.travis.yml index 5fc0300dde..1fb39cd17c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,8 @@ language: csharp dist: trusty sudo: false +mono: none +# dotnet: 3.1.100 # Travis is shitting itself right now and it can't locate .NET Core packages. os: - linux @@ -20,7 +22,9 @@ cache: directories: - packages/ - RobustToolbox/Dependencies/ - - RobustToolbox/SS14.Client.Godot/.mono/assemblies/ + +install: +- curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 3.1.100 #before_install: # - if [ $TRAVIS_OS_NAME = osx ]; then brew update && brew upgrade python; fi @@ -28,11 +32,9 @@ cache: before_script: #- "if [ $TRAVIS_OS_NAME = linux ]; then pyenv shell 3.6; fi" - "python3.5 -m pip install --user requests" -- "nuget restore SpaceStation14.sln" - "python3.5 RUN_THIS.py --no-prompt" script: -- "msbuild /p:Configuration=Debug /p:Platform=x64 /nologo /m SpaceStation14.sln /p:Python=python3.5" -- "mono packages/nunit.consolerunner/3.10.0/tools/nunit3-console.exe bin/Content.Tests/Content.Tests.dll bin/Content.IntegrationTests/Content.IntegrationTests.dll" +- "Tools/run_travis.sh" diff --git a/BuildFiles/Linux/SS14.Launcher b/BuildFiles/Linux/SS14.Launcher deleted file mode 100755 index 96d0722021..0000000000 --- a/BuildFiles/Linux/SS14.Launcher +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -cd "$(dirname "$0")" - -exec mono bin/SS14.Launcher.exe diff --git a/BuildFiles/Mac/Space Station 14 Launcher.app/Contents/Info.plist b/BuildFiles/Mac/Space Station 14 Launcher.app/Contents/Info.plist deleted file mode 100644 index d5e34b0787..0000000000 --- a/BuildFiles/Mac/Space Station 14 Launcher.app/Contents/Info.plist +++ /dev/null @@ -1,20 +0,0 @@ - - - - - CFBundleName - SS14L - CFBundleDisplayName - Space Station 14 Launcher - CFBundleExecutable - SS14 - - CFBundleIconFile - ss14 - - diff --git a/BuildFiles/Mac/Space Station 14 Launcher.app/Contents/MacOS/SS14 b/BuildFiles/Mac/Space Station 14 Launcher.app/Contents/MacOS/SS14 deleted file mode 100755 index 57abef5dc5..0000000000 --- a/BuildFiles/Mac/Space Station 14 Launcher.app/Contents/MacOS/SS14 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# cd to file containing script or something? -BASEDIR=$(dirname "$0") -echo "$BASEDIR" -cd "$BASEDIR" - -exec /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono ../Resources/SS14.Launcher.exe diff --git a/BuildFiles/Mac/Space Station 14 Launcher.app/Contents/Resources/ss14.icns b/BuildFiles/Mac/Space Station 14 Launcher.app/Contents/Resources/ss14.icns deleted file mode 100644 index ea22dc64c7..0000000000 Binary files a/BuildFiles/Mac/Space Station 14 Launcher.app/Contents/Resources/ss14.icns and /dev/null differ diff --git a/BuildFiles/Mac/Space Station 14.app/Contents/MacOS/SS14 b/BuildFiles/Mac/Space Station 14.app/Contents/MacOS/SS14 index 4aea10fc47..3c47c0b1fc 100755 --- a/BuildFiles/Mac/Space Station 14.app/Contents/MacOS/SS14 +++ b/BuildFiles/Mac/Space Station 14.app/Contents/MacOS/SS14 @@ -5,4 +5,4 @@ BASEDIR=$(dirname "$0") echo "$BASEDIR" cd "$BASEDIR" -exec /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono ../Resources/Robust.Client.exe +exec ../Resources/Robust.Client "$@" diff --git a/BuildFiles/Windows/run_me.bat b/BuildFiles/Windows/run_me.bat deleted file mode 100644 index 9b35a18cbe..0000000000 --- a/BuildFiles/Windows/run_me.bat +++ /dev/null @@ -1 +0,0 @@ -call bin\SS14.Launcher.exe diff --git a/Content.Server/Content.Server.csproj b/Content.Server/Content.Server.csproj index 8646d76f16..4c6a4f5837 100644 --- a/Content.Server/Content.Server.csproj +++ b/Content.Server/Content.Server.csproj @@ -29,7 +29,4 @@ - - - diff --git a/Jenkinsfile b/Jenkinsfile index 1ce08d55b2..cdfa0c48d9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,6 @@ pipeline { stage('Setup') { steps { sh 'git submodule update --init --recursive' - sh 'TMP=~/.cache/NuGet/ nuget restore' } } stage('Build') { diff --git a/RobustToolbox b/RobustToolbox index f6b894f274..58dcea5bda 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit f6b894f27499c351d9cf6b457ed1773f00db7ef4 +Subproject commit 58dcea5bda296326a32d04c03c804c3baa83493f diff --git a/SS14.Launcher/SS14.Launcher.csproj b/SS14.Launcher/SS14.Launcher.csproj index 1d466c7e13..d43eaaf613 100644 --- a/SS14.Launcher/SS14.Launcher.csproj +++ b/SS14.Launcher/SS14.Launcher.csproj @@ -18,10 +18,6 @@ - - - - ..\RobustToolbox\Tools\ diff --git a/Tools/package_release_build.py b/Tools/package_release_build.py index 5dd0208240..13232e2deb 100755 --- a/Tools/package_release_build.py +++ b/Tools/package_release_build.py @@ -8,6 +8,8 @@ import sys import zipfile import argparse +from typing import List, Optional + try: from colorama import init, Fore, Style init() @@ -21,8 +23,13 @@ except ImportError: Fore = ColorDummy() Style = ColorDummy() + p = os.path.join +PLATFORM_WINDOWS = "windows" +PLATFORM_LINUX = "linux" +PLATFORM_MACOS = "mac" + SHARED_IGNORED_RESOURCES = { "ss13model.7z", "ResourcePack.zip", @@ -49,23 +56,37 @@ LAUNCHER_RESOURCES = { "Fonts", } -def main(): +WINDOWS_NATIVES = { + "freetype6.dll", + "openal32.dll", + "swnfd.dll", + "glfw3.dll" +} + +LINUX_NATIVES = { + "libglfw.so.3", + "libswnfd.so" +} + +MAC_NATIVES = { + "libglfw.3.dylib", + "libswnfd.dylib" +} + +def main() -> None: parser = argparse.ArgumentParser( description="Packages the SS14 content repo for release on all platforms.") parser.add_argument("--platform", "-p", action="store", - choices=["windows", "mac", "linux"], + choices=[PLATFORM_WINDOWS, PLATFORM_MACOS, PLATFORM_LINUX], 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"] + platforms = [PLATFORM_WINDOWS, PLATFORM_MACOS, PLATFORM_LINUX] if os.path.exists("release"): print(Fore.BLUE + Style.DIM + @@ -74,17 +95,17 @@ def main(): os.mkdir("release") - if "windows" in platforms: + if PLATFORM_WINDOWS in platforms: wipe_bin() - build_windows(core) + build_windows() - if "linux" in platforms: + if PLATFORM_LINUX in platforms: wipe_bin() - build_linux(core) + build_linux() - if "mac" in platforms: + if PLATFORM_MACOS in platforms: wipe_bin() - build_macos(core) + build_macos() def wipe_bin(): @@ -97,25 +118,23 @@ def wipe_bin(): shutil.rmtree("bin") -def build_windows(core): # type: (bool) -> None +def build_windows(): # type: () -> None # Run a full build. print(Fore.GREEN + "Building project for Windows x64..." + Style.RESET_ALL) - command = ["msbuild", + + subprocess.run([ + "dotnet", + "build", "SpaceStation14.sln", - "/m", - "/p:Configuration=Release", - "/p:Platform=x64", - "/nologo", + "-c", "Release", + "--nologo", "/v:m", "/p:TargetOS=Windows", "/t:Rebuild", "/p:FullRelease=True" - ] + ], check=True) - if core: - command = ["dotnet"] + command + ["/p:UseNetCore=true"] - - subprocess.run(command, check=True) + publish_client_server("win-x64", "Windows") print(Fore.GREEN + "Packaging Windows x64 client..." + Style.RESET_ALL) @@ -123,7 +142,8 @@ def build_windows(core): # type: (bool) -> None p("release", "SS14.Client_Windows_x64.zip"), "w", compression=zipfile.ZIP_DEFLATED) - copy_dir_into_zip(p("RobustToolbox", "bin", "Client"), "", client_zip) + copy_dir_into_zip(p("RobustToolbox", "bin", "Client", "win-x64", "publish"), "", client_zip) + copy_client_natives(WINDOWS_NATIVES, client_zip, "") copy_resources("Resources", client_zip, server=False) copy_content_assemblies(p("Resources", "Assemblies"), client_zip, server=False) # Cool we're done. @@ -132,39 +152,27 @@ def build_windows(core): # type: (bool) -> None print(Fore.GREEN + "Packaging Windows x64 server..." + Style.RESET_ALL) server_zip = zipfile.ZipFile(p("release", "SS14.Server_Windows_x64.zip"), "w", compression=zipfile.ZIP_DEFLATED) - copy_dir_into_zip(p("RobustToolbox", "bin", "Server"), "", server_zip) + copy_dir_into_zip(p("RobustToolbox", "bin", "Server", "win-x64", "publish"), "", server_zip) copy_resources(p("Resources"), server_zip, server=True) copy_content_assemblies(p("Resources", "Assemblies"), server_zip, server=True) server_zip.close() - print(Fore.GREEN + "Packaging Windows x64 launcher..." + Style.RESET_ALL) - launcher_zip = zipfile.ZipFile(p("release", "SS14.Launcher_Windows_x64.zip"), "w", - compression=zipfile.ZIP_DEFLATED) - - copy_dir_into_zip(p("bin", "SS14.Launcher"), "bin", launcher_zip) - copy_launcher_resources(p("bin", "Resources"), launcher_zip) - launcher_zip.write(p("BuildFiles", "Windows", "run_me.bat"), "run_me.bat") - launcher_zip.close() - - -def build_macos(core): # type: (bool) -> None +def build_macos() -> None: print(Fore.GREEN + "Building project for macOS x64..." + Style.RESET_ALL) - command = ["msbuild", + + subprocess.run([ + "dotnet", + "build", "SpaceStation14.sln", - "/m", - "/p:Configuration=Release", - "/p:Platform=x64", - "/nologo", + "-c", "Release", + "--nologo", "/v:m", "/p:TargetOS=MacOS", "/t:Rebuild", "/p:FullRelease=True" - ] + ], check=True) - if core: - command = ["dotnet"] + command + ["/p:UseNetCore=true"] - - subprocess.run(command, check=True) + publish_client_server("osx-x64", "MacOS") print(Fore.GREEN + "Packaging macOS x64 client..." + Style.RESET_ALL) # Client has to go in an app bundle. @@ -173,8 +181,8 @@ def build_macos(core): # type: (bool) -> None contents = p("Space Station 14.app", "Contents", "Resources") copy_dir_into_zip(p("BuildFiles", "Mac", "Space Station 14.app"), "Space Station 14.app", client_zip) - copy_dir_into_zip(p("RobustToolbox", "bin", "Client"), contents, client_zip) - + copy_dir_into_zip(p("RobustToolbox", "bin", "Client", "osx-x64", "publish"), contents, client_zip) + copy_client_natives(MAC_NATIVES, client_zip, contents) copy_resources(p(contents, "Resources"), client_zip, server=False) copy_content_assemblies(p(contents, "Resources", "Assemblies"), client_zip, server=False) client_zip.close() @@ -182,42 +190,29 @@ def build_macos(core): # type: (bool) -> None print(Fore.GREEN + "Packaging macOS x64 server..." + Style.RESET_ALL) server_zip = zipfile.ZipFile(p("release", "SS14.Server_macOS_x64.zip"), "w", compression=zipfile.ZIP_DEFLATED) - copy_dir_into_zip(p("RobustToolbox", "bin", "Server"), "", server_zip) + copy_dir_into_zip(p("RobustToolbox", "bin", "Server", "osx-x64", "publish"), "", server_zip) copy_resources(p("Resources"), server_zip, server=True) copy_content_assemblies(p("Resources", "Assemblies"), server_zip, server=True) server_zip.close() - print(Fore.GREEN + "Packaging macOS x64 launcher..." + Style.RESET_ALL) - launcher_zip = zipfile.ZipFile(p("release", "SS14.Launcher_macOS_x64.zip"), "w", - compression=zipfile.ZIP_DEFLATED) - contents = p("Space Station 14 Launcher.app", "Contents", "Resources") - copy_dir_into_zip(p("BuildFiles", "Mac", "Space Station 14 Launcher.app"), "Space Station 14 Launcher.app", launcher_zip) - copy_dir_into_zip(p("bin", "SS14.Launcher"), contents, launcher_zip) - - copy_launcher_resources(p(contents, "Resources"), launcher_zip) - launcher_zip.close() - - -def build_linux(core): # type: (bool) -> None +def build_linux() -> None: # Run a full build. print(Fore.GREEN + "Building project for Linux x64..." + Style.RESET_ALL) - command = ["msbuild", + + subprocess.run([ + "dotnet", + "build", "SpaceStation14.sln", - "/m", - "/p:Configuration=Release", - "/p:Platform=x64", - "/nologo", + "-c", "Release", + "--nologo", "/v:m", "/p:TargetOS=Linux", "/t:Rebuild", "/p:FullRelease=True" - ] + ], check=True) - if core: - command = ["dotnet"] + command + ["/p:UseNetCore=true"] - - subprocess.run(command, check=True) + publish_client_server("linux-x64", "Linux") print(Fore.GREEN + "Packaging Linux x64 client..." + Style.RESET_ALL) @@ -225,8 +220,9 @@ def build_linux(core): # type: (bool) -> None p("release", "SS14.Client_Linux_x64.zip"), "w", compression=zipfile.ZIP_DEFLATED) - copy_dir_into_zip(p("RobustToolbox", "bin", "Client"), "", client_zip) + copy_dir_into_zip(p("RobustToolbox", "bin", "Client", "linux-x64", "publish"), "", client_zip) copy_resources("Resources", client_zip, server=False) + copy_client_natives(LINUX_NATIVES, client_zip, "") copy_content_assemblies(p("Resources", "Assemblies"), client_zip, server=False) # Cool we're done. client_zip.close() @@ -234,19 +230,24 @@ def build_linux(core): # type: (bool) -> None print(Fore.GREEN + "Packaging Linux x64 server..." + Style.RESET_ALL) server_zip = zipfile.ZipFile(p("release", "SS14.Server_Linux_x64.zip"), "w", compression=zipfile.ZIP_DEFLATED) - copy_dir_into_zip(p("RobustToolbox", "bin", "Server"), "", server_zip) + copy_dir_into_zip(p("RobustToolbox", "bin", "Server", "linux-x64", "publish"), "", server_zip) copy_resources(p("Resources"), server_zip, server=True) copy_content_assemblies(p("Resources", "Assemblies"), server_zip, server=True) server_zip.close() - print(Fore.GREEN + "Packaging Linux x64 launcher..." + Style.RESET_ALL) - launcher_zip = zipfile.ZipFile(p("release", "SS14.Launcher_Linux_x64.zip"), "w", - compression=zipfile.ZIP_DEFLATED) +def publish_client_server(runtime: str, target_os: str) -> None: + # Runs dotnet publish on client and server. + base = [ + "dotnet", "publish", + "--runtime", runtime, + "--no-self-contained", + "-c", "Release", + f"/p:TargetOS={str}", + "/p:FullRelease=True", + ] - copy_dir_into_zip(p("bin", "SS14.Launcher"), "bin", launcher_zip) - copy_launcher_resources(p("bin", "Resources"), launcher_zip) - launcher_zip.write(p("BuildFiles", "Linux", "SS14.Launcher"), "SS14.Launcher") - launcher_zip.close() + subprocess.run(base + ["RobustToolbox/Robust.Client/Robust.Client.csproj"], check=True) + subprocess.run(base + ["RobustToolbox/Robust.Server/Robust.Server.csproj"], check=True) def copy_resources(target, zipf, server): # Content repo goes FIRST so that it won't override engine files as that's forbidden. @@ -331,7 +332,7 @@ def copy_content_assemblies(target, zipf, server): zipf.write(p(source_dir, x), p(target, x)) -def copy_dir_or_file(src, dst): +def copy_dir_or_file(src: str, dst: str): """ Just something from src to dst. If src is a dir it gets copied recursively. """ @@ -345,6 +346,10 @@ def copy_dir_or_file(src, dst): else: raise IOError("{} is neither file nor directory. Can't copy.".format(src)) +def copy_client_natives(fileNames: List[str], zipf: zipfile.ZipFile, zipPath: str): + for fileName in fileNames: + zipf.write(p("RobustToolbox", "bin", "Client", fileName), p(zipPath, fileName)) + print(f"writing native {fileName}") if __name__ == '__main__': main() diff --git a/Tools/run_travis.sh b/Tools/run_travis.sh new file mode 100755 index 0000000000..bd7ee52459 --- /dev/null +++ b/Tools/run_travis.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -e + +# Use manually installed .NET. +# Travis is shitting itself. Wonderful. +PATH="~/.dotnet:$PATH" + +dotnet build SpaceStation14.sln /p:Python=python3.5 +dotnet test Content.Tests/Content.Tests.csproj +dotnet test Content.IntegrationTests/Content.IntegrationTests.csproj