Skip to content

Commit

Permalink
use KSPCommon.props
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyOThan committed Apr 4, 2024
1 parent 506a517 commit 947b4b7
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 119 deletions.
83 changes: 83 additions & 0 deletions KSPCommon.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!--import solution-wide props if it exists -->
<Import Condition=" Exists('$(SolutionName).props') " Project="$(SolutionName).props"/>

<!-- The following properties can be customized per-mod in SolutionName.props-->
<PropertyGroup>
<!-- The root directory of the mod repository -->
<RepoRootPath Condition = " '$(RepoRootPath)' == '' ">$(SolutionDir)</RepoRootPath>
<BinariesOutputRelativePath Condition = " '$(BinariesOutputRelativePath)' == '' ">GameData\$(SolutionName)</BinariesOutputRelativePath>

<KSPRoot Condition = " '$(KSPRoot)' == '' ">$(ReferencePath)</KSPRoot>
<!--If the reference path isn't set, use the default steam location, but this will be incorrect in lots of cases-->
<KSPRoot Condition = "'$(KSPRoot)' == '' ">C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program</KSPRoot>
</PropertyGroup>

<!--Import a props.user file if it exists, so that KSPRoot can be set globally for the whole mod if desired-->
<Import Condition=" Exists('KSPCommon.props.user') " Project="KSPCommon.props.user"/>

<!--Parse KSP platform-specific paths -->
<PropertyGroup>
<KSPExecutable Condition = "$([MSBuild]::IsOsPlatform('Windows'))">KSP_x64.exe</KSPExecutable>
<KSPExecutable Condition = "$([MSBuild]::IsOsPlatform('OSX'))">KSP.app</KSPExecutable>
<KSPExecutable Condition = "$([MSBuild]::IsOsPlatform('Linux'))">KSP.x86_64</KSPExecutable>
<ManagedRelativePath Condition = "$([MSBuild]::IsOsPlatform('Windows'))">KSP_x64_Data\Managed</ManagedRelativePath>
<ManagedRelativePath Condition = "$([MSBuild]::IsOsPlatform('OSX'))">KSP.app\Contents\Resources\Data\Managed</ManagedRelativePath>
<ManagedRelativePath Condition = "$([MSBuild]::IsOsPlatform('Linux'))">KSP_Data\Managed</ManagedRelativePath>
<ManagedPath>$(KSPRoot)\$(ManagedRelativePath)</ManagedPath>
</PropertyGroup>

<!-- set the start action so that you can launch directly from VS -->
<PropertyGroup>
<StartAction>Program</StartAction>
<StartProgram>$(KSPRoot)\$(KSPExecutable)</StartProgram>
<StartWorkingDirectory>$(KSPRoot)</StartWorkingDirectory>
</PropertyGroup>

<!--Import references-->
<ItemGroup>
<Reference Include="$(ManagedPath)\System.dll">
<Name>System (KSP/Mono)</Name>
<Private>False</Private>
</Reference>
<Reference Include="$(ManagedPath)\mscorlib.dll">
<Name>System.Core (KSP/Mono)</Name>
<Private>False</Private>
</Reference>
<Reference Include="$(ManagedPath)\System.Xml.dll">
<Name>System.Xml (KSP/Mono)</Name>
<Private>False</Private>
</Reference>
<Reference Include="$(ManagedPath)\UnityEngine*.dll">
<Name>UnityEngine</Name>
<Private>False</Private>
</Reference>
<Reference Include="$(ManagedPath)\Assembly-CSharp.dll">
<Name>Assembly-CSharp</Name>
<Private>False</Private>
</Reference>
</ItemGroup>

<!--Common stuff that would normally go in a Targets file-->

<!--MSBuild targets-->
<!-- this might not be the best way to specify these since there can only be one BeforeBuild or AfterBuild target-->
<Target Name="BeforeBuildScript">
</Target>
<Target Name="PostBuildScript" AfterTargets="Build">
<CallTarget Targets="CopyBinariesToRepo" />
</Target>

<!--Custom Targets-->

<!-- this probably isn't the best way to do this, because it doesn't necessarily get run when switching build configs (debug/release)-->
<!-- make sure to always to a rebuild when switching configs and you should be fine -->
<Target Name="CopyBinariesToRepo">
<ItemGroup>
<BinariesToCopy Include="$(TargetDir)\*.*" />
</ItemGroup>
<Copy SourceFiles="@(BinariesToCopy)" DestinationFolder="$(RepoRootPath)\$(BinariesOutputRelativePath)" />
</Target>
</Project>
127 changes: 8 additions & 119 deletions RasterPropMonitor/RasterPropMonitor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\Debug</OutputPath>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand All @@ -28,17 +28,10 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>..\bin\Release</OutputPath>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CustomCommands>
<CustomCommands>
<Command type="BeforeBuild" command="..\bin\Release\BumpBuildNumber.exe" workingdir="${SolutionDir}" />
</CustomCommands>
</CustomCommands>
<DefineConstants>
</DefineConstants>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<DebugType>portable</DebugType>
Expand All @@ -49,58 +42,19 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Profile|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\bin\Profile\</OutputPath>
<OutputPath>bin\Profile\</OutputPath>
<DefineConstants>ENABLE_PROFILER</DefineConstants>
<Optimize>true</Optimize>
<DebugType>portable</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="UnityEngine.AnimationModule">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.AssetBundleModule">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.AudioModule">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.ImageConversionModule">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.PhysicsModule">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UIModule">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UnityWebRequestWWWModule">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
</ItemGroup>
<PropertyGroup>
<BinariesOutputRelativePath>GameData\JSI\RasterPropMonitor\Plugins</BinariesOutputRelativePath>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<Import Project="$(SolutionDir)KSPCommon.props" />
<ItemGroup>
<Compile Include="Auxiliary modules\JSICallbackAnimator.cs" />
<Compile Include="Auxiliary modules\JSIFlashModule.cs" />
Expand Down Expand Up @@ -188,68 +142,6 @@
<Compile Include="Auxiliary modules\JSISelectivelyVisibleProp.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<MonoDevelop>
<Properties>
<Policies>
<NameConventionPolicy>
<Rules>
<NamingRule Name="Namespaces" AffectedEntity="Namespace" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
<NamingRule Name="Types" AffectedEntity="Class, Struct, Enum, Delegate" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
<NamingRule Name="Interfaces" AffectedEntity="Interface" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
<RequiredPrefixes>
<String>I</String>
</RequiredPrefixes>
</NamingRule>
<NamingRule Name="Attributes" AffectedEntity="CustomAttributes" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
<RequiredSuffixes>
<String>Attribute</String>
</RequiredSuffixes>
</NamingRule>
<NamingRule Name="Event Arguments" AffectedEntity="CustomEventArgs" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
<RequiredSuffixes>
<String>EventArgs</String>
</RequiredSuffixes>
</NamingRule>
<NamingRule Name="Exceptions" AffectedEntity="CustomExceptions" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
<RequiredSuffixes>
<String>Exception</String>
</RequiredSuffixes>
</NamingRule>
<NamingRule Name="Methods" AffectedEntity="Methods" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
<NamingRule Name="Static Readonly Fields" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Protected, Public" NamingStyle="PascalCase" IncludeInstanceMembers="False" IncludeStaticEntities="True" />
<NamingRule Name="Fields (Non Private)" AffectedEntity="Field" VisibilityMask="Internal, Protected, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
<NamingRule Name="ReadOnly Fields (Non Private)" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Protected, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False" />
<NamingRule Name="Fields (Private)" AffectedEntity="Field, ReadonlyField" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
<AllowedPrefixes>
<String>_</String>
<String>m_</String>
</AllowedPrefixes>
</NamingRule>
<NamingRule Name="Static Fields (Private)" AffectedEntity="Field" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True" />
<NamingRule Name="ReadOnly Fields (Private)" AffectedEntity="ReadonlyField" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
<AllowedPrefixes>
<String>_</String>
<String>m_</String>
</AllowedPrefixes>
</NamingRule>
<NamingRule Name="Constant Fields" AffectedEntity="ConstantField" VisibilityMask="VisibilityMask" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
<NamingRule Name="Properties" AffectedEntity="Property" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
<NamingRule Name="Events" AffectedEntity="Event" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
<NamingRule Name="Enum Members" AffectedEntity="EnumMember" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
<NamingRule Name="Parameters" AffectedEntity="Parameter" VisibilityMask="VisibilityMask" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
<NamingRule Name="Type Parameters" AffectedEntity="TypeParameter" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
<RequiredPrefixes>
<String>T</String>
</RequiredPrefixes>
</NamingRule>
</Rules>
</NameConventionPolicy>
</Policies>
</Properties>
</MonoDevelop>
</ProjectExtensions>
<ItemGroup />
<ItemGroup>
<None Include=".editorconfig" />
<None Include="packages.config" />
Expand All @@ -263,9 +155,6 @@
<ItemGroup>
<Publicize Include="Assembly-CSharp" />
</ItemGroup>
<PropertyGroup>
<PostBuildEvent>copy $(TargetDir)$(TargetName).* $(SolutionDir)GameData\JSI\RasterPropMonitor\Plugins\$(TargetName).*</PostBuildEvent>
</PropertyGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
Expand Down

0 comments on commit 947b4b7

Please sign in to comment.