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