<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <RuntimeIdentifiers>win10-x64;win10-x86;osx-x64;linux-x64;linux-arm;linux-arm64;</RuntimeIdentifiers>
    <GeneratePackageOnBuild>false</GeneratePackageOnBuild>
    <TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
    <!-- <PublishTrimmed>true</PublishTrimmed>    
    <PublishReadyToRun>true</PublishReadyToRun> -->
    <AssemblyVersion>$(SemVer)</AssemblyVersion>
    <FileVersion>$(SemVer)</FileVersion>
    <Version>$(FullVer)</Version>
    <PackageVersion></PackageVersion>
    <TypeScriptToolsVersion>3.1</TypeScriptToolsVersion>    
    <SpaRoot>ClientApp\</SpaRoot>
    <DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
    <TieredCompilationQuickJit>true</TieredCompilationQuickJit> <!--https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0#tiered-compilation-->
    <DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
    <Configurations>Debug;Release;NonUiBuild</Configurations>
  </PropertyGroup>

  <PropertyGroup>
    <ServerGarbageCollection>false</ServerGarbageCollection>
  </PropertyGroup>

  <ItemGroup>
    <Content Remove="$(SpaRoot)**" />
    <Content Remove="Controllers\External\**" />
    <None Remove="$(SpaRoot)**" />
    <None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
  </ItemGroup>
  
  <ItemGroup>
    <!-- Files not to show in IDE -->
    <Compile Remove="Controllers\External\**" />
    <Compile Remove="Logs\**" />
    <Compile Remove="Styles\**" />
    <Compile Remove="wwwroot\dist\**" />
    
    <!-- Files not to publish (note that the 'dist' subfolders are re-added below) -->
    <Content Remove="ClientApp\**" />
    <Content Remove="Logs\**" />
    <Content Remove="Styles\**" />
    <Content Remove="wwwroot\dist\**" />
    <EmbeddedResource Remove="Controllers\External\**" />
    <EmbeddedResource Remove="Logs\**" />
    <EmbeddedResource Remove="Styles\**" />
    <EmbeddedResource Remove="wwwroot\dist\**" />
    <None Remove="Controllers\External\**" />
    <None Remove="Logs\**" />
    <None Remove="Styles\**" />
    <None Remove="wwwroot\dist\**" />
  </ItemGroup>
  
  <ItemGroup>
    <None Include="..\.editorconfig" Link=".editorconfig" />
  </ItemGroup>

 
  <ItemGroup>
    <PackageReference Include="AspNetCore.HealthChecks.MySql" Version="6.0.2" />
    <PackageReference Include="AspNetCore.HealthChecks.Sqlite" Version="6.0.2" />
    <PackageReference Include="AutoMapper" Version="12.0.0" />
    <PackageReference Include="CommandLineParser" Version="2.9.1" />
    <PackageReference Include="LazyCache.AspNetCore" Version="2.4.0" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.9" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.9">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="6.0.0" />
    <PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.2.0" />
    <PackageReference Include="ncrontab" Version="3.3.1" />
    <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.2" />
    <PackageReference Include="Serilog" Version="2.12.0" />
    <PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
    <PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
    <PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
    <PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.4.0" />
    <PackageReference Include="System.Security.Cryptography.Csp" Version="4.3.0" />
    <PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="6.0.9" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.9" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\Ombi.Api.Emby\Ombi.Api.Emby.csproj" />
    <ProjectReference Include="..\Ombi.Api.Jellyfin\Ombi.Api.Jellyfin.csproj" />
    <ProjectReference Include="..\Ombi.Api.Github\Ombi.Api.Github.csproj" />
    <ProjectReference Include="..\Ombi.Api.Lidarr\Ombi.Api.Lidarr.csproj" />
    <ProjectReference Include="..\Ombi.Api.SickRage\Ombi.Api.SickRage.csproj" />
    <ProjectReference Include="..\Ombi.Api.Twilio\Ombi.Api.Twilio.csproj" />
    <ProjectReference Include="..\Ombi.Core\Ombi.Core.csproj" />
    <ProjectReference Include="..\Ombi.DependencyInjection\Ombi.DependencyInjection.csproj" />
    <ProjectReference Include="..\Ombi.HealthChecks\Ombi.HealthChecks.csproj" />
    <ProjectReference Include="..\Ombi.Helpers\Ombi.Helpers.csproj" />
    <ProjectReference Include="..\Ombi.Hubs\Ombi.Hubs.csproj" />
    <ProjectReference Include="..\Ombi.Mapping\Ombi.Mapping.csproj" />
    <ProjectReference Include="..\Ombi.Schedule\Ombi.Schedule.csproj" />
    <ProjectReference Include="..\Ombi.Settings\Ombi.Settings.csproj" />
    <ProjectReference Include="..\Ombi.TheMovieDbApi\Ombi.Api.TheMovieDb.csproj" />
    <ProjectReference Include="..\Ombi.Updater\Ombi.Updater.csproj" />
  </ItemGroup>

  
  <Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules')  And '$(NCrunch)' != '1' ">
    <Exec Command="node --version" ContinueOnError="true">
      <Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
    </Exec>
    <Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
    <Message Importance="high" Text="Restoring dependencies using 'yarn'. This may take several minutes..." />
    <Exec WorkingDirectory="$(SpaRoot)" Command="yarn install" />
  </Target>

</Project>
