<?xml version="1.0" encoding="utf-8"?>
<Project>  

  <!-- Legal =================================================================================== -->

  <PropertyGroup>
    <Authors>Vicente Penades</Authors>    
    <Copyright>Copyright (c) $([System.DateTime]::Now.ToString(`yyyy`)) Vicente Penades</Copyright>
    <Description>SharpGLTF is a C# library for reading and writing glTF2 3D models</Description>    
  </PropertyGroup>  

  <!-- Configuration =================================================================================== -->

  <PropertyGroup>
    <LangVersion>8.0</LangVersion>
    <IsPackable>true</IsPackable>
  </PropertyGroup>

  <PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
    <IsTrimmable>true</IsTrimmable>
  </PropertyGroup>

  <PropertyGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
    <IsAotCompatible>true</IsAotCompatible>
  </PropertyGroup>

  <Import Project="$(MsBuildThisFileDirectory)Shared\SharpGLTF.PublicKey.props"/>

  <!-- Testing & Analysers =================================================================================== -->

  <!-- Condition=" '$(Configuration)' == 'Debug' " -->
  
  <ItemGroup>
    <InternalsVisibleTo Include="SharpGLTF.Core.Tests" Key="$(StrongName_PublicKey)"/>
    <InternalsVisibleTo Include="SharpGLTF.Toolkit.Tests" Key="$(StrongName_PublicKey)"/>
    <InternalsVisibleTo Include="SharpGLTF.Ext.3DTiles.Tests" Key="$(StrongName_PublicKey)"/>
  </ItemGroup>

  <PropertyGroup>
    <NoWarn>1701;1702;1591;CA1033;CA1062;CA1304;CA1310;CA1000;CA1510;CA1512;CA1861;CA1852;CA1823;IDE1006</NoWarn>
  </PropertyGroup>  

  <PropertyGroup>
    <!-- Enable all FxCop rules with NetAnalyzers
    https://docs.microsoft.com/es-es/visualstudio/code-quality/migrate-from-fxcop-analyzers-to-net-analyzers?view=vs-2022#migration-steps
    -->
    
    <AnalysisMode>AllEnabledByDefault</AnalysisMode>
    <!-- <CodeAnalysisRuleSet>$(MsBuildThisFileDirectory)..\solution.ruleset</CodeAnalysisRuleSet>  -->  
    
  </PropertyGroup>

  <ItemGroup>
    
    <AdditionalFiles Include="$(MsBuildThisFileDirectory)..\stylecop.json" />
    
    <PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    
  </ItemGroup>

  <ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net6.0-windows'">
    
    <!-- Optimization analysis only makes sense on platforms that will be actually ran -->

    <!-- https://devblogs.microsoft.com/premier-developer/avoiding-struct-and-readonly-reference-performance-pitfalls-with-errorprone-net/ -->
    <PackageReference Include="ErrorProne.NET.Structs" Version="0.6.1-beta.1">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    
  </ItemGroup>
  
  <!-- Packaging =================================================================================== -->

  <!-- https://andrewlock.net/version-vs-versionsuffix-vs-packageversion-what-do-they-all-mean/ -->
  <!-- https://stackoverflow.com/questions/43019832/auto-versioning-in-visual-studio-2017-net-core -->
  <!-- https://stackoverflow.com/questions/23533838/how-to-get-buildid-in-msbuild -->
  
  <PropertyGroup>
    <PackageIcon>glTF2Sharp.png</PackageIcon>
    <PackageTags>C# glTF 3D</PackageTags>
    <PackageLicenseExpression>MIT</PackageLicenseExpression>
  </PropertyGroup>

  <ItemGroup>
    <None Include="$(MsBuildThisFileDirectory)..\build\Icons\glTF2Sharp.png" Pack="true" Visible="false" PackagePath="" />
  </ItemGroup>

  <PropertyGroup>
    <RepositoryType>git</RepositoryType>
    <RepositoryUrl>https://github.com/vpenades/SharpGLTF</RepositoryUrl>    
    <PackageProjectUrl>https://github.com/vpenades/SharpGLTF</PackageProjectUrl>
    <PublishRepositoryUrl>true</PublishRepositoryUrl>    
  </PropertyGroup>  
  
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <VersionPrefix>1.0.0</VersionPrefix>
    <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
  </PropertyGroup>

  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <Deterministic>true</Deterministic>
    <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
  </PropertyGroup>

  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">    
    <DebugSymbols>true</DebugSymbols>
    <IncludeSymbols>true</IncludeSymbols>
    <SymbolPackageFormat>snupkg</SymbolPackageFormat>    
    <GenerateDocumentationFile>true</GenerateDocumentationFile>    
  </PropertyGroup>  

  <!-- Source Control =================================================================================== -->

  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">   

    <!-- https://github.com/dotnet/sourcelink/blob/main/docs/README.md -->
    
    <!-- better alternative than source link -->
    <EmbedAllSources>true</EmbedAllSources>
    
    <!-- conceal source code full paths -->
    <PathMap>$(MSBuildProjectDirectory)=X:\sources</PathMap>
    
    <!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
    <!--<EmbedUntrackedSources>true</EmbedUntrackedSources>-->
    
  </PropertyGroup>
  
</Project>