-
Notifications
You must be signed in to change notification settings - Fork 15
/
Directory.Build.props
59 lines (53 loc) · 2.95 KB
/
Directory.Build.props
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup Label="Framework and language configuration">
<TargetFramework>netstandard2.1</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
<PropertyGroup Label="Game folder configuration">
<!-- Set this to the path to your KSP 2 folder if you don't have the KSP2DIR environmental variable set -->
<KSP2DIR Condition="'$(KSP2DIR)' == ''">C:/Program Files (x86)/Steam/steamapps/common/Kerbal Space Program 2</KSP2DIR>
</PropertyGroup>
<PropertyGroup Label="Build and namespace configuration">
<SolutionDir Condition="'$(SolutionDir)'==''">$(MSBuildThisFileDirectory)</SolutionDir>
<PluginBinPath>$(SolutionDir)build/bin/plugin/$(Configuration)</PluginBinPath>
<PluginObjPath>$(SolutionDir)build/obj/plugin/$(Configuration)</PluginObjPath>
<BaseOutputPath>$(PluginBinPath)/$(MSBuildProjectName)</BaseOutputPath>
<BaseIntermediateOutputPath>$(PluginObjPath)/$(MSBuildProjectName)</BaseIntermediateOutputPath>
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace>
<Configurations>Debug;Release;Deploy;DeployAndRun</Configurations>
<Platforms>AnyCPU</Platforms>
<NoWarn>$(NoWarn);CS0436</NoWarn>
</PropertyGroup>
<PropertyGroup Label="Package source configuration">
<RestoreAdditionalProjectSources>
https://nuget.spacewarp.org/v3/index.json
</RestoreAdditionalProjectSources>
</PropertyGroup>
<ItemGroup Label="Dependencies for build targets">
<PackageReference Include="JsonPeek" Version="1.2.0" PrivateAssets="all"/>
</ItemGroup>
<!-- Define the main target -->
<Target Label="Reading properties from swinfo.json" Name="ReadPropertiesFromJson" BeforeTargets="PreBuildEvent;AddGeneratedFile">
<JsonPeek ContentPath="$(SolutionDir)/plugin_template/swinfo.json" Query="$">
<Output TaskParameter="Result" ItemName="Swinfo"/>
</JsonPeek>
<!-- Extract properties from the JSON -->
<PropertyGroup>
<ModId>@(Swinfo -> '%(mod_id)')</ModId>
<Version>@(Swinfo -> '%(version)')</Version>
<Version Condition="$(Version.Contains('-'))">$(Version.Substring(0, $(Version.IndexOf('-'))))</Version>
<Product>@(Swinfo -> '%(name)')</Product>
<Authors>@(Swinfo -> '%(author)')</Authors>
<Description>@(Swinfo -> '%(description)')</Description>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>@(Swinfo -> '%(source)')</RepositoryUrl>
<SpaceWarpPluginGuid>$(ModId)</SpaceWarpPluginGuid>
<SpaceWarpPluginName>$(Product)</SpaceWarpPluginName>
<SpaceWarpPluginVersion>$(Version)</SpaceWarpPluginVersion>
</PropertyGroup>
</Target>
</Project>