Skip to content

Commit c68f3f1

Browse files
committed
More property renames and additions
1 parent e5bceff commit c68f3f1

12 files changed

Lines changed: 171 additions & 161 deletions

File tree

.github/actions/compile/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,5 @@ runs:
7676
working-directory: ${{ inputs.working-directory }}
7777
run: |
7878
dotnet msbuild -p:Configuration=${{ inputs.build-configuration }} \
79-
-p:KSPBTManagedRelativePath=KSP_x64_Data/Managed ${{ inputs.solution-file-path }} \
79+
-p:_KSPBT_ManagedRelativePath=KSP_x64_Data/Managed ${{ inputs.solution-file-path }} \
8080
${{ runner.debug && '-v:detailed' }}

CHANGELOG.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ All notable changes to this project will be documented in this file
66

77
### Msbuild
88

9-
- Renamed global msbuild properties to have the `KSPBT` prefix to avoid namespace collisions with other frameworks
10-
- `KSPRoot` is now `KSPBTGameRoot`. It should no longer be referenced within a .csproj file
11-
- `RepoRootPath` is now `KSPBTModRoot`, and should now point to the mod folder within GameData rather than the
9+
- Renamed global msbuild properties to have the `KSPBT_` prefix to avoid namespace collisions with other frameworks
10+
- `KSPRoot` is now `KSPBT_GameRoot`. It should no longer be referenced within a .csproj file
11+
- `RepoRootPath` is now `KSPBT_ModRoot`, and should now point to the mod folder within GameData rather than the
1212
root of a git repo
13-
- `BinariesOutputRelativePath` is now `KSPBTModPluginFolder`
14-
- `GenerateKSPAssemblyAttribute` is now `KSPBTGenerateAssemblyAttribute` and defaults to true
15-
- `GenerateKSPAssemblyDependencyAttributes` is now `KSPBTGenerateDependencyAttributes` and defaults to true
16-
- `ReferenceUnityAssemblies` is now `KSPBTReferenceUnityAssemblies`
17-
- `ReferenceKSPAssemblies` is now `KSPBTReferenceGameAssemblies`
18-
- Added the `KSPBTReferenceSystemAssemblies` property to control referencing the mono system DLLs within the KSP
13+
- `BinariesOutputRelativePath` is now `KSPBT_ModPluginFolder`
14+
- `GenerateKSPAssemblyAttribute` is now `KSPBT_GenerateAssemblyAttribute` and defaults to true
15+
- `GenerateKSPAssemblyDependencyAttributes` is now `KSPBT_GenerateDependencyAttributes` and defaults to true
16+
- `ReferenceUnityAssemblies` is now `KSPBT_ReferenceUnityAssemblies`
17+
- `ReferenceKSPAssemblies` is now `KSPBT_ReferenceGameAssemblies`
18+
- Added the `KSPBT_ReferenceSystemAssemblies` property to control referencing the mono system DLLs within the KSP
1919
managed folder. Setting this property to false will load the implicit framework DLLs instead.
2020
- Mod dependencies should now be declared with
2121
`ModReference` items. This avoids the need for the KSP install path to be known at evaluation time.

KSPBuildTools.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<NoWarn>1701;1702;CS0649;CS1591;NU5128</NoWarn>
2525
<AssemblyCopyright>2024 KSPModdingLibs Contributors</AssemblyCopyright>
2626
<AssemblyName>KSPBuildTools</AssemblyName>
27-
<KSPBTModRoot>$(ProjectDir)</KSPBTModRoot>
27+
<KSPBT_ModRoot>$(ProjectDir)</KSPBT_ModRoot>
2828
<PackageId>KSPBuildTools</PackageId>
2929
<PackageReadmeFile>README.md</PackageReadmeFile>
3030
<Title>KSP Build Tools</Title>

KSPCommon.props

Lines changed: 58 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,61 @@
44
<KSPCommonPropsImported>true</KSPCommonPropsImported>
55
</PropertyGroup>
66

7-
<!-- default settings for KSPBT targets and references -->
7+
<!-- default settings for KSPBT_ targets and references -->
88
<PropertyGroup>
9+
<!-- The root directory of the mod, the folder that gets placed in GameData -->
10+
<KSPBT_ModRoot Condition=" '$(KSPBT_ModRoot)' == '' ">$(MSBuildProjectDirectory)/../GameData/$(MSBuildProjectName)/</KSPBT_ModRoot>
11+
12+
<!-- The folder to place resulting DLLs into, relative to KSPBT_ModRoot -->
13+
<KSPBT_ModPluginFolder Condition=" '$(KSPBT_ModPluginFolder)' == '' "/>
14+
15+
<!-- default CKAN compatibility versions -->
16+
<KSPBT_CKANCompatibleVersions Condition=" '$(KSPBT_CKANCompatibleVersions)' == '' ">1.12 1.11 1.10 1.9 1.8</KSPBT_CKANCompatibleVersions>
17+
918
<!-- reference unity and KSP assemblies unless explicitly disabled -->
10-
<KSPBTReferenceSystemAssemblies Condition=" '$(KSPBTReferenceSystemAssemblies)' == '' ">true</KSPBTReferenceSystemAssemblies>
11-
<KSPBTReferenceUnityAssemblies Condition=" '$(KSPBTReferenceUnityAssemblies)' == '' ">true</KSPBTReferenceUnityAssemblies>
12-
<KSPBTReferenceGameAssemblies Condition=" '$(KSPBTReferenceGameAssemblies)' == '' ">true</KSPBTReferenceGameAssemblies>
19+
<KSPBT_ReferenceSystemAssemblies Condition=" '$(KSPBT_ReferenceSystemAssemblies)' == '' ">true</KSPBT_ReferenceSystemAssemblies>
20+
<KSPBT_ReferenceUnityAssemblies Condition=" '$(KSPBT_ReferenceUnityAssemblies)' == '' ">true</KSPBT_ReferenceUnityAssemblies>
21+
<KSPBT_ReferenceGameAssemblies Condition=" '$(KSPBT_ReferenceGameAssemblies)' == '' ">true</KSPBT_ReferenceGameAssemblies>
22+
<KSPBT_ReferenceModAssemblies Condition=" '$(KSPBT_ReferenceModAssemblies)' == '' ">true</KSPBT_ReferenceModAssemblies>
1323

1424
<!-- Copy DLLs to mod folder -->
15-
<KSPBTCopyDLLsToPluginFolder Condition=" '$(KSPBTCopyDLLsToPluginFolder)' == '' ">true</KSPBTCopyDLLsToPluginFolder>
25+
<KSPBT_InstallCKANDependencies Condition=" '$(KSPBT_InstallCKANDependencies)' == '' ">true</KSPBT_InstallCKANDependencies>
1626

27+
<KSPBT_CopyDLLsToPluginFolder Condition=" '$(KSPBT_CopyDLLsToPluginFolder)' == '' ">true</KSPBT_CopyDLLsToPluginFolder>
1728

18-
<KSPBTGenerateAssemblyAttribute Condition=" '$(KSPBTGenerateAssemblyAttribute)' == '' ">true</KSPBTGenerateAssemblyAttribute>
29+
<KSPBT_GenerateAssemblyAttribute Condition=" '$(KSPBT_GenerateAssemblyAttribute)' == '' ">true</KSPBT_GenerateAssemblyAttribute>
1930

20-
<KSPBTGenerateDependencyAttributes Condition=" '$(KSPBTGenerateDependencyAttributes)' == '' ">true</KSPBTGenerateDependencyAttributes>
31+
<KSPBT_GenerateDependencyAttributes Condition=" '$(KSPBT_GenerateDependencyAttributes)' == '' ">true</KSPBT_GenerateDependencyAttributes>
2132

22-
<KSPBTGenerateVersionFile Condition=" '$(KSPBTGenerateVersionFile)' == '' ">true</KSPBTGenerateVersionFile>
2333

24-
<!-- default CKAN compatibility versions -->
25-
<CKANCompatibleVersions Condition=" '$(CKANCompatibleVersions)' == '' ">1.12 1.11 1.10 1.9 1.8</CKANCompatibleVersions>
34+
<KSPBT_GenerateVersionFile Condition=" '$(KSPBT_GenerateVersionFile)' == '' ">true</KSPBT_GenerateVersionFile>
2635
</PropertyGroup>
2736

28-
<!--Parse KSP platform-specific paths -->
29-
<!-- These can be overwritten by user and props files -->
30-
<PropertyGroup Condition=" '$(KSPBTManagedRelativePath)' == '' ">
31-
<KSPBTManagedRelativePath Condition=" $([MSBuild]::IsOsPlatform('Windows')) ">KSP_x64_Data/Managed</KSPBTManagedRelativePath>
32-
<KSPBTManagedRelativePath Condition=" $([MSBuild]::IsOsPlatform('OSX')) ">KSP.app/Contents/Resources/Data/Managed</KSPBTManagedRelativePath>
33-
<KSPBTManagedRelativePath Condition=" $([MSBuild]::IsOsPlatform('Linux')) ">KSP_Data/Managed</KSPBTManagedRelativePath>
34-
</PropertyGroup>
37+
<!-- Define the ModReference item type and its defaults -->
38+
<ItemDefinitionGroup>
39+
<ModReference>
40+
<Private>false</Private>
41+
</ModReference>
42+
</ItemDefinitionGroup>
3543

36-
<PropertyGroup>
37-
<KSPBTGameExecutable Condition=" $([MSBuild]::IsOsPlatform('Windows')) ">KSP_x64.exe</KSPBTGameExecutable>
38-
<KSPBTGameExecutable Condition=" $([MSBuild]::IsOsPlatform('OSX')) ">KSP.app/Contents/MacOS/KSP</KSPBTGameExecutable>
39-
<KSPBTGameExecutable Condition=" $([MSBuild]::IsOsPlatform('Linux')) ">KSP.x86_64</KSPBTGameExecutable>
40-
<KSPBTSteamGameRoot Condition=" $([MSBuild]::IsOsPlatform('Windows')) ">C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program</KSPBTSteamGameRoot>
41-
<KSPBTSteamGameRoot Condition=" $([MSBuild]::IsOsPlatform('OSX')) ">$(HOME)/Library/Application Support/Steam/steamapps/common/Kerbal Space Program</KSPBTSteamGameRoot>
44+
<!--Parse KSP platform-specific paths -->
45+
<PropertyGroup Condition=" '$(_KSPBT_ManagedRelativePath)' == '' ">
46+
<_KSPBT_ManagedRelativePath Condition=" $([MSBuild]::IsOsPlatform('Windows')) ">KSP_x64_Data/Managed</_KSPBT_ManagedRelativePath>
47+
<_KSPBT_ManagedRelativePath Condition=" $([MSBuild]::IsOsPlatform('OSX')) ">KSP.app/Contents/Resources/Data/Managed</_KSPBT_ManagedRelativePath>
48+
<_KSPBT_ManagedRelativePath Condition=" $([MSBuild]::IsOsPlatform('Linux')) ">KSP_Data/Managed</_KSPBT_ManagedRelativePath>
4249
</PropertyGroup>
4350

44-
<!-- Calculate mod paths -->
45-
<!-- These can be overwritten by user, csproj, and props files -->
4651
<PropertyGroup>
47-
<!-- The root directory of the mod, the folder that gets placed in GameData -->
48-
<KSPBTModRoot Condition=" '$(KSPBTModRoot)' == '' ">$(MSBuildProjectDirectory)/../GameData/$(MSBuildProjectName)/</KSPBTModRoot>
49-
<!-- The folder to place resulting DLLs into, relative to KSPBTModRoot -->
50-
<KSPBTModPluginFolder Condition=" '$(KSPBTModPluginFolder)' == '' "/>
52+
<_KSPBT_GameExecutable Condition=" $([MSBuild]::IsOsPlatform('Windows')) ">KSP_x64.exe</_KSPBT_GameExecutable>
53+
<_KSPBT_GameExecutable Condition=" $([MSBuild]::IsOsPlatform('OSX')) ">KSP.app/Contents/MacOS/KSP</_KSPBT_GameExecutable>
54+
<_KSPBT_GameExecutable Condition=" $([MSBuild]::IsOsPlatform('Linux')) ">KSP.x86_64</_KSPBT_GameExecutable>
55+
<_KSPBT_SteamGameRoot Condition=" $([MSBuild]::IsOsPlatform('Windows')) ">C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program</_KSPBT_SteamGameRoot>
56+
<_KSPBT_SteamGameRoot Condition=" $([MSBuild]::IsOsPlatform('OSX')) ">$(HOME)/Library/Application Support/Steam/steamapps/common/Kerbal Space Program</_KSPBT_SteamGameRoot>
5157
</PropertyGroup>
5258

5359
<!-- Import the csproj.user file. -->
54-
<!-- This can overwrite KSPBTManagedRelativePath and KSPBTGameExecutable,
55-
set KSPBTGameRoot and ReferencePath, and any other user-specific settings -->
60+
<!-- This can overwrite _KSPBT_ManagedRelativePath and _KSPBT_GameExecutable,
61+
set KSPBT_GameRoot and ReferencePath, and any other user-specific settings -->
5662
<Import Project="$(MSBuildProjectFullPath).user" Condition="Exists('$(MSBuildProjectFullPath).user')"/>
5763

5864
<!-- Import a props.user file -->
@@ -64,50 +70,45 @@
6470

6571
<!-- Relative path that must exist for a path to be a valid KSP Install-->
6672
<PropertyGroup>
67-
<KSPBTGameIdentifier>$(KSPBTManagedRelativePath)/Assembly-CSharp.dll</KSPBTGameIdentifier>
68-
<KSPBTGameRootSource Condition="'$(KSPBTGameRoot)' != ''">property</KSPBTGameRootSource>
73+
<KSPBT_GameIdentifier>$(_KSPBT_ManagedRelativePath)/Assembly-CSharp.dll</KSPBT_GameIdentifier>
74+
<KSPBT_GameRootSource Condition="'$(KSPBT_GameRoot)' != ''">property</KSPBT_GameRootSource>
6975
</PropertyGroup>
7076

71-
<!-- Default KSPBTGameRoot to the "KSP_ROOT" environment variable if it exists -->
77+
<!-- Default KSPBT_GameRoot to the "KSP_ROOT" environment variable if it exists -->
7278
<!-- Doing this skips any checks for a valid KSP install so be careful! -->
73-
<PropertyGroup Condition=" '$(KSPBTGameRoot)' == '' And '$(KSP_ROOT)' != '' ">
74-
<KSPBTGameRoot>$(KSP_ROOT)</KSPBTGameRoot>
75-
<KSPBTGameRootSource>environment variable</KSPBTGameRootSource>
79+
<PropertyGroup Condition=" '$(KSPBT_GameRoot)' == '' And '$(KSP_ROOT)' != '' ">
80+
<KSPBT_GameRoot>$(KSP_ROOT)</KSPBT_GameRoot>
81+
<KSPBT_GameRootSource>environment variable</KSPBT_GameRootSource>
7682
</PropertyGroup>
7783
<ItemGroup>
78-
<KSPBTGameRootCandidate Include="$(SolutionDir)KSP" source="solution directory"/>
79-
<KSPBTGameRootCandidate Include="$(ReferencePath)" source="reference path"/>
80-
<KSPBTGameRootCandidate Include="$(KSPBTSteamGameRoot)" source="steam"/>
84+
<KSPBT_GameRootCandidate Include="$(SolutionDir)KSP" source="solution directory"/>
85+
<KSPBT_GameRootCandidate Include="$(ReferencePath)" source="reference path"/>
86+
<KSPBT_GameRootCandidate Include="$(_KSPBT_SteamGameRoot)" source="steam"/>
8187
</ItemGroup>
8288

8389
<!-- Look for KSP install in Solution dir -->
84-
<PropertyGroup Condition=" '$(KSPBTGameRoot)' == '' And Exists('$(SolutionDir)KSP/$(KSPBTGameIdentifier)') ">
85-
<KSPBTGameRoot>$(SolutionDir)KSP</KSPBTGameRoot>
86-
<KSPBTGameRootSource>solution directory</KSPBTGameRootSource>
90+
<PropertyGroup Condition=" '$(KSPBT_GameRoot)' == '' And Exists('$(SolutionDir)KSP/$(KSPBT_GameIdentifier)') ">
91+
<KSPBT_GameRoot>$(SolutionDir)KSP</KSPBT_GameRoot>
92+
<KSPBT_GameRootSource>solution directory</KSPBT_GameRootSource>
8793
</PropertyGroup>
8894

8995
<!-- Look for KSP install in ReferencePath -->
90-
<PropertyGroup Condition=" '$(KSPBTGameRoot)' == '' And Exists('$(ReferencePath)/$(KSPBTGameIdentifier)') ">
91-
<KSPBTGameRoot>$(ReferencePath)</KSPBTGameRoot>
92-
<KSPBTGameRootSource>reference path</KSPBTGameRootSource>
96+
<PropertyGroup Condition=" '$(KSPBT_GameRoot)' == '' And Exists('$(ReferencePath)/$(KSPBT_GameIdentifier)') ">
97+
<KSPBT_GameRoot>$(ReferencePath)</KSPBT_GameRoot>
98+
<KSPBT_GameRootSource>reference path</KSPBT_GameRootSource>
9399
</PropertyGroup>
94100

95101
<!-- Look for KSP steam install-->
96-
<PropertyGroup Condition=" '$(KSPBTGameRoot)' == '' And Exists('$(KSPBTSteamGameRoot)/$(KSPBTGameIdentifier)') ">
97-
<KSPBTGameRoot>$(KSPBTSteamGameRoot)</KSPBTGameRoot>
98-
<KSPBTGameRootSource>steam</KSPBTGameRootSource>
99-
</PropertyGroup>
100-
101-
<!-- Calculate KSPBTManagedPath -->
102-
<PropertyGroup Condition=" '$(KSPBTManagedPath)' == ''">
103-
<KSPBTManagedPath>$(KSPBTGameRoot)/$(KSPBTManagedRelativePath)</KSPBTManagedPath>
102+
<PropertyGroup Condition=" '$(KSPBT_GameRoot)' == '' And Exists('$(_KSPBT_SteamGameRoot)/$(KSPBT_GameIdentifier)') ">
103+
<KSPBT_GameRoot>$(_KSPBT_SteamGameRoot)</KSPBT_GameRoot>
104+
<KSPBT_GameRootSource>steam</KSPBT_GameRootSource>
104105
</PropertyGroup>
105106

106107
<!-- set the start action so that you can launch directly from VS -->
107108
<PropertyGroup>
108109
<StartAction>Program</StartAction>
109-
<StartProgram>$(KSPBTGameRoot)/$(KSPBTGameExecutable)</StartProgram>
110-
<StartWorkingDirectory>$(KSPBTGameRoot)</StartWorkingDirectory>
110+
<StartProgram>$(KSPBT_GameRoot)/$(_KSPBT_GameExecutable)</StartProgram>
111+
<StartWorkingDirectory>$(KSPBT_GameRoot)</StartWorkingDirectory>
111112
<DebugType>portable</DebugType>
112113
</PropertyGroup>
113114

@@ -120,7 +121,7 @@
120121
<!-- Prevent the GetReferenceAssemblyPaths task in Microsoft.Common.CurrentVersion.targets
121122
from attempting to locate an external copy of the reference assemblies. -->
122123
<AutomaticallyUseReferenceAssemblyPackages>false</AutomaticallyUseReferenceAssemblyPackages>
123-
<FrameworkPathOverride>$(KSPBTManagedPath)</FrameworkPathOverride>
124+
<FrameworkPathOverride>$(KSPBT_ManagedPath)</FrameworkPathOverride>
124125
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
125126
</PropertyGroup>
126127

0 commit comments

Comments
 (0)