Let's pray it all works

This commit is contained in:
Pieter-Jan Briers
2019-12-16 00:46:09 +01:00
parent a652e39b1c
commit a9f148c04e
14 changed files with 107 additions and 132 deletions

View File

@@ -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:

View File

@@ -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"

View File

@@ -1,5 +0,0 @@
#!/bin/bash
cd "$(dirname "$0")"
exec mono bin/SS14.Launcher.exe

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>SS14L</string>
<key>CFBundleDisplayName</key>
<string>Space Station 14 Launcher</string>
<key>CFBundleExecutable</key>
<string>SS14</string>
<!--
Just a note about this icon.
MacOS seems REALLY iffy about this and even when the file is correct,
it can take forever before it decides to actually update it and display it.
TL;DR Apple is stupid.
-->
<key>CFBundleIconFile</key>
<string>ss14</string>
</dict>
</plist>

View File

@@ -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

View File

@@ -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 "$@"

View File

@@ -1 +0,0 @@
call bin\SS14.Launcher.exe

View File

@@ -29,7 +29,4 @@
</ProjectReference>
<ProjectReference Include="..\Content.Shared\Content.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Condition="'$(UseNetCore)' != 'true'" Include="System.Net.Http" />
</ItemGroup>
</Project>

1
Jenkinsfile vendored
View File

@@ -5,7 +5,6 @@ pipeline {
stage('Setup') {
steps {
sh 'git submodule update --init --recursive'
sh 'TMP=~/.cache/NuGet/ nuget restore'
}
}
stage('Build') {

View File

@@ -18,10 +18,6 @@
<ProjectReference Include="..\RobustToolbox\Robust.Client\Robust.Client.csproj" />
<ProjectReference Include="..\RobustToolbox\Robust.Lite\Robust.Lite.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Condition="'$(UseNetCore)' != 'true'" Include="System.IO.Compression" />
<Reference Condition="'$(UseNetCore)' != 'true'" Include="System.Net.Http" />
</ItemGroup>
<Import Project="..\RobustToolbox\MSBuild\Robust.Engine.targets" />
<PropertyGroup>
<RobustToolsPath>..\RobustToolbox\Tools\</RobustToolsPath>

View File

@@ -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()

11
Tools/run_travis.sh Executable file
View File

@@ -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