Skip to content

Commit 52a031d

Browse files
Amend env-var note, revise build-package.bat to handle cross-drive paths and update .csproj to work in CI service
1 parent f2be5e5 commit 52a031d

3 files changed

Lines changed: 21 additions & 25 deletions

File tree

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ When writing new code for RemoteTech, please follow the following steps:
7474
- If your code adds a new feature in RemoteTech, create a pull request to the branch of the next release (e.g., `1.7.0`; if no such branch exists, please contact us).
7575
* One of the Remote Technologies Group members will merge the pull request; if you yourself are a member, please wait one week to give others a chance to give feedback.
7676

77-
To make your life a little easier, the Visual Studio Project respects an environment variable called `KSPDEVDIR`.
78-
If you set its value to the path of your KSP install, the reference and build paths inside the project should be set automatically.
79-
If it is not set, your reference paths and the build paths have to be set manually.
77+
## Visual Studio build
8078

81-
To set the variable, follow the instructions in this link, before starting a Visual Studio instance:
79+
Visual Studio Project (.csproj) respects and utilises an environment variable called `KSPDEVDIR`.
8280

83-
https://superuser.com/a/949577
81+
If its value is set to the path of your KSP install, the reference and build paths in the project should be set automatically. Otherwise, the reference paths and the build paths have to be set manually.
82+
83+
To create the variable, follow the [instructions](https://superuser.com/a/949577) before starting a Visual Studio instance. If you are on a standard Windows account, it should be in the system variables to be referred.
8484

8585

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
rem Generate the zip Release package.
2+
rem Highly recommend to use a Continuous Integration service to pull source codes from repository, build, test, package and deploy
23

34
@echo off
45

@@ -13,28 +14,19 @@ SET rootPath=%scriptPath%..\..\
1314
SET initialWD=%CD%
1415

1516
echo Generating %TargetName% for %KSPversion% Release Package...
16-
cd "%rootPath%"
17-
xcopy /y "%initialWD%\%TargetName%.dll" GameData\%TargetName%\Plugins\%TargetName%.dll*
17+
xcopy /y "%initialWD%\%TargetName%.dll" %rootPath%GameData\%TargetName%\Plugins\%TargetName%.dll*
1818

19-
IF EXIST package\ rd /s /q package
20-
mkdir package
21-
cd package
19+
IF EXIST %rootPath%package\ rd /s /q %rootPath%package
20+
mkdir %rootPath%package\GameData
21+
cd %rootPath%package\GameData
2222

23-
mkdir GameData
24-
cd GameData
25-
26-
mkdir "%TargetName%"
27-
cd "%TargetName%"
28-
xcopy /y /e "..\..\..\GameData\%TargetName%\*" .
29-
xcopy /y ..\..\..\CHANGES.md .
30-
xcopy /y ..\..\..\LICENSE.txt .
23+
echo Copying %rootPath%GameData files to package stage
24+
xcopy /y /E /Q %rootPath%GameData %rootPath%package\GameData
3125

3226
echo.
3327
echo Compressing %TargetName% for %KSPversion% Release Package...
3428
IF EXIST "%rootPath%%TargetName%*_For_%KSPversion%.zip" del "%rootPath%%TargetName%*_For_%KSPversion%.zip"
35-
"%scriptPath%7za.exe" a "..\..\..\%TargetName%%Dllversion%_For_%KSPversion%.zip" ..\..\GameData
36-
37-
cd "%rootPath%"
38-
rd /s /q package
29+
"%scriptPath%7za.exe" a "%rootPath%%TargetName%%Dllversion%_For_%KSPversion%.zip" %rootPath%package\GameData
3930

40-
cd "%initialWD%"
31+
echo Deleting package stage
32+
rd /s /q %rootPath%package

src/RemoteTech/RemoteTech.csproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<DebugType>none</DebugType>
3030
<Optimize>true</Optimize>
3131
<OutputPath Condition="Exists('$(KSPDEVDIR)\GameData\RemoteTech\Plugins\')">$(KSPDEVDIR)\GameData\RemoteTech\Plugins\</OutputPath>
32-
<OutputPath Condition="!Exists('$(KSPDEVDIR)\GameData\RemoteTech\Plugins\')">obj\RemoteTech\</OutputPath>
32+
<OutputPath Condition="!Exists('$(KSPDEVDIR)\GameData\RemoteTech\Plugins\')">..\..\GameData\RemoteTech\Plugins\</OutputPath>
3333
<DefineConstants>
3434
</DefineConstants>
3535
<ErrorReport>prompt</ErrorReport>
@@ -40,10 +40,12 @@
4040
<ItemGroup>
4141
<Reference Include="Assembly-CSharp">
4242
<HintPath Condition="Exists('$(KSPDEVDIR)\KSP_x64_Data\Managed\Assembly-CSharp.dll')">$(KSPDEVDIR)\KSP_x64_Data\Managed\Assembly-CSharp.dll</HintPath>
43+
<HintPath Condition="!Exists('$(KSPDEVDIR)\KSP_x64_Data\Managed\Assembly-CSharp.dll')">Assembly-CSharp.dll</HintPath>
4344
<Private>False</Private>
4445
</Reference>
4546
<Reference Include="Assembly-CSharp-firstpass">
4647
<HintPath Condition="Exists('$(KSPDEVDIR)\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll')">$(KSPDEVDIR)\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
48+
<HintPath Condition="!Exists('$(KSPDEVDIR)\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll')">Assembly-CSharp-firstpass.dll</HintPath>
4749
<Private>False</Private>
4850
</Reference>
4951
<Reference Include="System" />
@@ -52,10 +54,12 @@
5254
<Reference Include="System.Xml" />
5355
<Reference Include="UnityEngine">
5456
<HintPath Condition="Exists('$(KSPDEVDIR)\KSP_x64_Data\Managed\UnityEngine.dll')">$(KSPDEVDIR)\KSP_x64_Data\Managed\UnityEngine.dll</HintPath>
57+
<HintPath Condition="!Exists('$(KSPDEVDIR)\KSP_x64_Data\Managed\UnityEngine.dll')">UnityEngine.dll</HintPath>
5558
<Private>False</Private>
5659
</Reference>
5760
<Reference Include="UnityEngine.UI">
5861
<HintPath Condition="Exists('$(KSPDEVDIR)\KSP_x64_Data\Managed\UnityEngine.UI.dll')">$(KSPDEVDIR)\KSP_x64_Data\Managed\UnityEngine.UI.dll</HintPath>
62+
<HintPath Condition="!Exists('$(KSPDEVDIR)\KSP_x64_Data\Managed\UnityEngine.UI.dll')">UnityEngine.UI.dll</HintPath>
5963
<Private>False</Private>
6064
</Reference>
6165
</ItemGroup>
@@ -162,7 +166,7 @@
162166
$(PostBuildEventDependsOn);
163167
PostBuildMacros;
164168
</PostBuildEventDependsOn>
165-
<PostBuildEvent>if "$(ConfigurationName)"=="Release" (call "$(ProjectDir)..\..\buildscripts\ZipPack\build-package.bat" $(TargetName) -v@(VersionNumber) KSP1.4.5)
169+
<PostBuildEvent><!--if "$(ConfigurationName)"=="Release" (call "$(ProjectDir)..\..\buildscripts\ZipPack\build-package.bat" $(TargetName) -v@(VersionNumber) KSP1.4.5)-->
166170
if "$(ConfigurationName)"=="Debug" (call "$(ProjectDir)..\..\buildscripts\UnityDebug\prepare-debug.bat" $(TargetName))
167171
</PostBuildEvent>
168172
</PropertyGroup>

0 commit comments

Comments
 (0)