Skip to content

Commit

Permalink
recode basics project and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
warning-explosive committed Oct 31, 2024
1 parent bfd037e commit 092961c
Show file tree
Hide file tree
Showing 141 changed files with 6,749 additions and 9,124 deletions.
35 changes: 23 additions & 12 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<Authors>Nikita Grishin</Authors>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

<CodeAnalysisRuleSet>..\..\..\ruleset.ruleset</CodeAnalysisRuleSet>
<Company>MightyMorphinSpaceEngineers</Company>
<Copyright>Copyright (c) 2023</Copyright>

<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>

<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>

<IsPackable>false</IsPackable>

<LangVersion>latest</LangVersion>

<Nullable>enable</Nullable>

<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/warning-explosive/Core</RepositoryUrl>
<Copyright>Copyright (c) 2023</Copyright>
<CodeAnalysisRuleSet>..\..\..\ruleset.ruleset</CodeAnalysisRuleSet>

<RunAnalyzers>true</RunAnalyzers>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
<RunAnalyzersDuringLiveAnalysis>true</RunAnalyzersDuringLiveAnalysis>
<RunAnalyzers>true</RunAnalyzers>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateDocumentationFile>true</GenerateDocumentationFile>

<TargetFramework>netstandard2.1</TargetFramework>
<TieredCompilation>true</TieredCompilation>
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
</Project>
14 changes: 14 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project>
<ItemGroup>
<PackageVersion Include="coverlet.msbuild" Version="6.0.2" />
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="SimpleInjector" Version="5.4.2" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.1.118"/>
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions ruleset.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Rule Id="CA1040" Action="None"/>
<Rule Id="CA1062" Action="None"/>
<Rule Id="CA1063" Action="None"/>
<Rule Id="CS1591" Action="None"/>
<Rule Id="CA1711" Action="None"/>
<Rule Id="CA1812" Action="None"/>
<Rule Id="CA1816" Action="None"/>
Expand All @@ -19,6 +20,7 @@
<Rule Id="SA1413" Action="None"/>
<Rule Id="SA1502" Action="None"/>
<Rule Id="SA1600" Action="None"/>
<Rule Id="SA1601" Action="None"/>
<Rule Id="SA1623" Action="None"/>
<Rule Id="SA1629" Action="None"/>
<Rule Id="SA1633" Action="None"/>
Expand Down
33 changes: 33 additions & 0 deletions src/Common/Basics/AccessorExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
namespace SpaceEngineers.Core.Basics;

using System;
using System.Linq;
using System.Reflection;

public static class AccessorExtensions
{
private static readonly Type[] IsExternalInitTypes =
new[]
{
TypeExtensions.FindType("System.Private.CoreLib System.Runtime.CompilerServices.IsExternalInit"),
};

public static bool GetIsAccessible(this PropertyInfo property)
{
var getMethod = property.GetGetMethod(true);
return getMethod != null && getMethod.IsAccessible();
}

public static bool SetIsAccessible(this PropertyInfo property)
{
var setMethod = property.GetSetMethod(true);
return setMethod != null && setMethod.IsAccessible();
}

public static bool HasInitializer(this PropertyInfo propertyInfo)
{
return propertyInfo.SetMethod != default
&& propertyInfo.SetMethod.ReturnParameter != null
&& propertyInfo.SetMethod.ReturnParameter.GetRequiredCustomModifiers().Any(IsExternalInitTypes.Contains);
}
}
91 changes: 0 additions & 91 deletions src/Common/Basics/ActionExecutionInfo.cs

This file was deleted.

Loading

0 comments on commit 092961c

Please sign in to comment.