Skip to content

5. Build Instructions

Derek Lane edited this page Nov 25, 2017 · 1 revision

Currently the code should work with Visual Studio 2015 or 2017. See the following documentation on configuring your environment for Debug

Note for debug Unity version for KSP is 5.4.0p4

LocalDev Configuration

  • Locate the folder \BDArmory\BDArmory\LocalDev in your local path
  • Edit the text files with the local paths

The Following Pre and Post build code is currently in the project

Pre-Build

This will copy the appropriate KSP DLL's from the paths specified in the LocalDev folder

@echo $(Targetname)
SET ModName=BDArmory
@echo ...
@echo set lpath vars from LocalDev storage...
set /p KSP_DIR=<"$(ProjectDir)LocalDev\ksp_dir.txt"
set /p PDB2MDB_EXE=<"$(ProjectDir)LocalDev\pdb2mdb_exe.txt"
set /p ZA_DIR=<"$(ProjectDir)LocalDev\7za_dir.txt"
set /p DIST_DIR=<"$(ProjectDir)LocalDev\dist_dir.txt"

@echo Copying KSP assemblies from "%KSP_DIR%\KSP_x64_Data\Managed" to "$(ProjectDir)LocalDev\Refs" folder...
copy /Y "%KSP_DIR%\KSP_x64_Data\Managed\Assembly-CSharp.dll" "$(ProjectDir)LocalDev\Refs"
copy /Y "%KSP_DIR%\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll" "$(ProjectDir)LocalDev\Refs"
copy /Y "%KSP_DIR%\KSP_x64_Data\Managed\KSPAssets.dll" "$(ProjectDir)LocalDev\Refs"
copy /Y "%KSP_DIR%\KSP_x64_Data\Managed\UnityEngine.dll" "$(ProjectDir)LocalDev\Refs"
copy /Y "%KSP_DIR%\KSP_x64_Data\Managed\UnityEngine.UI.dll" "$(ProjectDir)LocalDev\Refs"

@echo KSP API references copying complete!

Post-Build

Will build and zip up for distribution

@echo $(Targetname)
SET ModName=BDArmory
@echo ...
@echo set lpath vars from LocalDev storage...
set /p KSP_DIR=<"$(ProjectDir)LocalDev\ksp_dir.txt"
set /p PDB2MDB_EXE=<"$(ProjectDir)LocalDev\pdb2mdb_exe.txt"
set /p ZA_DIR=<"$(ProjectDir)LocalDev\7za_dir.txt"
set /p DIST_DIR=<"$(ProjectDir)LocalDev\dist_dir.txt"

@echo Copying assemblies to Distribution $(Targetname) files...
copy /Y "$(TargetDir)"BDArmory*.dll "$(ProjectDir)Distribution\GameData\%ModName%\Plugins\"

if $(ConfigurationName) == Debug (
@echo building debug files and symbols...
FOR %%A IN ("$(TargetDir)"BDArmory*.dll) DO (
call "%PDB2MDB_EXE%" %%A
)
copy /Y "$(TargetDir)"BDArmory*.dll.mdb "%KSP_DIR%\GameData\%ModName%\Plugins\"
copy /Y "$(TargetDir)"BDArmory*.pdb "%KSP_DIR%\GameData\%ModName%\Plugins\"
)

@echo deleting previous build ...
if exist "%DIST_DIR%\%ModName%*.zip" del "%DIST_DIR%\%ModName%*.zip"
@echo packaging new build...
call "%ZA_DIR%\7za.exe" a -tzip -r  "%DIST_DIR%\%ModName%.@(VersionNumber)_%DATE:~4,2%%DATE:~7,2%%DATE:~10,4%.zip" "$(ProjectDir)Distribution\*.*"

@echo Deploy $(ProjectDir) Distribution files to test env:  %KSP_DIR%\GameData...
@echo copying:"$(ProjectDir)Distribution\GameData" to "%KSP_DIR%\GameData" 
xcopy /E /Y "$(ProjectDir)Distribution\GameData" "%KSP_DIR%\GameData"

@echo Build/deploy complete!