diff --git a/.gitignore b/.gitignore index f1e3d20..89fca48 100644 --- a/.gitignore +++ b/.gitignore @@ -250,3 +250,8 @@ paket-files/ # JetBrains Rider .idea/ *.sln.iml + + +# Binaries +TorchBinaries +GameBinaries diff --git a/Essentials.sln b/Essentials.sln new file mode 100644 index 0000000..c3c8348 --- /dev/null +++ b/Essentials.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.8 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Essentials", "Essentials\Essentials.csproj", "{A4C5FC37-5848-4A75-8CDC-4A1ADB2E01A2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A4C5FC37-5848-4A75-8CDC-4A1ADB2E01A2}.Debug|x64.ActiveCfg = Debug|x64 + {A4C5FC37-5848-4A75-8CDC-4A1ADB2E01A2}.Debug|x64.Build.0 = Debug|x64 + {A4C5FC37-5848-4A75-8CDC-4A1ADB2E01A2}.Release|x64.ActiveCfg = Release|x64 + {A4C5FC37-5848-4A75-8CDC-4A1ADB2E01A2}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F5A14432-44BA-480B-8B20-1AC78BEF79BC} + EndGlobalSection +EndGlobal diff --git a/Essentials/Essentials.csproj b/Essentials/Essentials.csproj index a9ef82b..b0ec430 100644 --- a/Essentials/Essentials.csproj +++ b/Essentials/Essentials.csproj @@ -12,7 +12,7 @@ true - bin\x64\Debug\ + $(SolutionDir)\bin\x64\Debug\ DEBUG;TRACE full x64 @@ -20,7 +20,7 @@ MinimumRecommendedRules.ruleset - bin\x64\Release\ + $(SolutionDir)\bin\x64\Release\ TRACE true pdbonly @@ -30,27 +30,34 @@ - packages\NLog.4.4.11\lib\net45\NLog.dll + ..\packages\NLog.4.4.12\lib\net45\NLog.dll + False - ..\..\Torch\GameBinaries\Sandbox.Common.dll + $(SolutionDir)\GameBinaries\Sandbox.Common.dll + False - ..\..\Torch\GameBinaries\Sandbox.Game.dll + $(SolutionDir)\GameBinaries\Sandbox.Game.dll + False - ..\..\Torch\GameBinaries\Sandbox.Graphics.dll + $(SolutionDir)\GameBinaries\Sandbox.Graphics.dll + False - ..\..\Torch\GameBinaries\SpaceEngineers.Game.dll + $(SolutionDir)\GameBinaries\SpaceEngineers.Game.dll + False - ..\..\Torch\GameBinaries\SpaceEngineers.ObjectBuilders.dll + $(SolutionDir)\GameBinaries\SpaceEngineers.ObjectBuilders.dll + False - ..\..\Torch\GameBinaries\SpaceEngineers.ObjectBuilders.XmlSerializers.dll + $(SolutionDir)\GameBinaries\SpaceEngineers.ObjectBuilders.XmlSerializers.dll + False @@ -63,52 +70,68 @@ - ..\..\Torch\bin\x64\Release\Torch.dll + $(SolutionDir)\TorchBinaries\Torch.dll + False - ..\..\Torch\bin\x64\Release\Torch.API.dll + $(SolutionDir)\TorchBinaries\Torch.API.dll + False - ..\..\Torch\bin\x64\Release\Torch.Server.exe + $(SolutionDir)\TorchBinaries\Torch.Server.exe + False - ..\..\Torch\GameBinaries\VRage.dll + $(SolutionDir)\GameBinaries\VRage.dll + False - ..\..\Torch\GameBinaries\VRage.Audio.dll + $(SolutionDir)\GameBinaries\VRage.Audio.dll + False - ..\..\Torch\GameBinaries\VRage.Dedicated.dll + $(SolutionDir)\GameBinaries\VRage.Dedicated.dll + False - ..\..\Torch\GameBinaries\VRage.Game.dll + $(SolutionDir)\GameBinaries\VRage.Game.dll + False - ..\..\Torch\GameBinaries\VRage.Game.XmlSerializers.dll + $(SolutionDir)\GameBinaries\VRage.Game.XmlSerializers.dll + False - ..\..\Torch\GameBinaries\VRage.Input.dll + $(SolutionDir)\GameBinaries\VRage.Input.dll + False - ..\..\Torch\GameBinaries\VRage.Library.dll + $(SolutionDir)\GameBinaries\VRage.Library.dll + False - ..\..\Torch\GameBinaries\VRage.Math.dll + $(SolutionDir)\GameBinaries\VRage.Math.dll + False - ..\..\Torch\GameBinaries\VRage.Native.dll + $(SolutionDir)\GameBinaries\VRage.Native.dll + False - ..\..\Torch\GameBinaries\VRage.OpenVRWrapper.dll + $(SolutionDir)\GameBinaries\VRage.OpenVRWrapper.dll + False - ..\..\Torch\GameBinaries\VRage.Render.dll + $(SolutionDir)\GameBinaries\VRage.Render.dll + False - ..\..\Torch\GameBinaries\VRage.Render11.dll + $(SolutionDir)\GameBinaries\VRage.Render11.dll + False - ..\..\Torch\GameBinaries\VRage.Scripting.dll + $(SolutionDir)\GameBinaries\VRage.Scripting.dll + False diff --git a/Essentials/packages.config b/Essentials/packages.config index 2e94d57..80757f3 100644 --- a/Essentials/packages.config +++ b/Essentials/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Jenkins/jenkins-grab-se.ps1 b/Jenkins/jenkins-grab-se.ps1 new file mode 100644 index 0000000..7670e02 --- /dev/null +++ b/Jenkins/jenkins-grab-se.ps1 @@ -0,0 +1,22 @@ +pushd + +$steamData = "C:/Steam/Data/" +$steamCMDPath = "C:/Steam/steamcmd/" +$steamCMDZip = "C:/Steam/steamcmd.zip" + +Add-Type -AssemblyName System.IO.Compression.FileSystem + +if (!(Test-Path $steamData)) { + mkdir "$steamData" +} +if (!(Test-Path $steamCMDPath)) { + if (!(Test-Path $steamCMDZip)) { + (New-Object System.Net.WebClient).DownloadFile("https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip", "$steamCMDZip"); + } + [System.IO.Compression.ZipFile]::ExtractToDirectory($steamCMDZip, $steamCMDPath) +} + +cd "$steamData" +& "$steamCMDPath/steamcmd.exe" "+login anonymous" "+force_install_dir $steamData" "+app_update 298740" "+quit" + +popd \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..e09ebf6 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,67 @@ +def test_with_torch(branch) +{ + try { + stage('Acquire Torch ' + branch) { + bat 'IF EXIST TorchBinaries RMDIR /S /Q TorchBinaries' + bat 'mkdir TorchBinaries' + step([$class: 'CopyArtifact', projectName: "Torch/Torch/${branch}", filter: "**/Torch*.dll", flatten: true, fingerprintArtifacts: true, target: "TorchBinaries"]) + step([$class: 'CopyArtifact', projectName: "Torch/Torch/${branch}", filter: "**/Torch*.exe", flatten: true, fingerprintArtifacts: true, target: "TorchBinaries"]) + } + + stage('Build + Torch ' + branch) { + bat "\"${tool 'MSBuild'}msbuild\" Essentials.sln /p:Configuration=Release /p:Platform=x64 /t:Clean" + // bat "\"${tool 'MSBuild'}msbuild\" Essentials.sln /p:Configuration=Release /p:Platform=x64 /t:TransformOnBuild" + bat "\"${tool 'MSBuild'}msbuild\" Essentials.sln /p:Configuration=Release /p:Platform=x64" + } + + /* + stage('Test + Torch ' + branch) { + bat 'IF NOT EXIST reports MKDIR reports' + bat "\"packages/xunit.runner.console.2.2.0/tools/xunit.console.exe\" \"bin-test/x64/Release/Essentials.Tests.dll\" -parallel none -xml \"reports/Essentials.Tests.xml\"" + step([ + $class: 'XUnitBuilder', + thresholdMode: 1, + thresholds: [[$class: 'FailedThreshold', failureThreshold: '1']], + tools: [[ + $class: 'XUnitDotNetTestType', + deleteOutputFiles: true, + failIfNotNew: true, + pattern: 'reports/*.xml', + skipNoTestFiles: false, + stopProcessingIfError: true + ]] + ]) + } + */ + return true + } catch (e) { + return false + } +} + +node { + stage('Checkout') { + checkout scm + } + + stage('Acquire SE') { + bat 'powershell -File Jenkins/jenkins-grab-se.ps1' + bat 'IF EXIST GameBinaries RMDIR GameBinaries' + bat 'mklink /J GameBinaries "C:/Steam/Data/DedicatedServer64/"' + } + + stage('Acquire NuGet Packages') { + bat 'nuget restore Essentials.sln' + } + + resultMaster = test_with_torch("master") + resultStaging = test_with_torch("staging") + if (resultMaster || resultStaging) { + currentBuild.result = "SUCCESS" + stage('Archive') { + archiveArtifacts artifacts: "bin/x64/Release/Essentials.dll", caseSensitive: false, fingerprint: true, onlyIfSuccessful: true + } + } + else + currentBuild.result = "FAIL" +} \ No newline at end of file diff --git a/Setup (run before opening solution).bat b/Setup (run before opening solution).bat new file mode 100644 index 0000000..39d244c --- /dev/null +++ b/Setup (run before opening solution).bat @@ -0,0 +1,24 @@ +:: This script creates a symlink to the game binaries to account for different installation directories on different systems. + +@echo off +set /p path="Please enter the folder location of your SpaceEngineersDedicated.exe: " +cd %~dp0 +mklink /J GameBinaries %path% +if errorlevel 1 goto Error +echo Done! +goto End +:Error +echo An error occured creating the symlink. +goto EndFinal +:End + +set /p path="Please enter the folder location of your Torch.Server.exe: " +cd %~dp0 +mklink /J TorchBinaries %path% +if errorlevel 1 goto Error +echo Done! You can now open the Torch solution without issue. +goto EndFinal +:Error2 +echo An error occured creating the symlink. +:EndFinal +pause \ No newline at end of file