<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>

      <Year>$([System.DateTime]::get_now().ToString("yyyy"))</Year>

      <Major>$(Year)</Major>
      <Minor>$([System.DateTime]::get_now().ToString("MM"))</Minor>
      <Build>$([System.DateTime]::get_now().ToString("dd"))</Build>
      <Revision>$([MSBuild]::Divide($([System.DateTime]::get_Now().get_TimeOfDay().get_TotalMinutes()), 2).ToString('F0'))</Revision>

      <Version>$(Major).$(Minor).$(Build).$(Revision)</Version>

      <Company>Raytheon Technologies</Company>
      <Authors>TEEC</Authors>
      <Copyright>Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy"))</Copyright>
      <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
      <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
      <PackageReadmeFile>README.md</PackageReadmeFile>
      <Configurations>Debug;Release;Deploy</Configurations>

      <!-- Append Git Commit Hash to Product Version -->
      <IncludeSourceRevisionInInformationalVersion>true</IncludeSourceRevisionInInformationalVersion>

      <!-- Add Repo URL and Commit # to the *.nuspec file  -->
      <PublishRepositoryUrl>true</PublishRepositoryUrl>

      <HalTempFolder>$(SolutionDir)HalTempFolder</HalTempFolder>

   </PropertyGroup>

   <!-- Copy pdb files in nuget packages to output directory-->
   <Target Name="IncludeSymbolFiles" AfterTargets="ResolveAssemblyReferences" Condition="@(ReferenceCopyLocalPaths) != ''">
      <ItemGroup>
         <ReferenceCopyLocalPaths Include="%(ReferenceCopyLocalPaths.RelativeDir)%(ReferenceCopyLocalPaths.Filename).pdb" />
         <ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="!Exists('%(FullPath)')" />
      </ItemGroup>
   </Target>

   <ItemGroup>
      <None Include="$(SolutionDir)Nuget\readme.md" Pack="true" PackagePath="\">
         <Link>_Project_Items\readme.md</Link>
      </None>
   </ItemGroup>

   <Target Name="DeleteStaleFiles" BeforeTargets="BeforeBuild">
      <ItemGroup>
         <StaleFiles Include="$(OutDir)..\*.nupkg" />
      </ItemGroup>
      <Delete Files="@(StaleFiles)" />
   </Target>

   <Target Name="PublishPackageDebug" AfterTargets="Pack" Condition="'$(Configuration)' == 'Debug'">
      <Exec Command="dotnet nuget push --source &quot;SolutionLocalSource&quot; $(OutDir)..\*.nupkg" />
   </Target>

</Project>