<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>$(NetToolMinimum);$(NetFrameworkToolCurrent)</TargetFrameworks>
    <IsPackable>true</IsPackable>
    <IncludeBuildOutput>false</IncludeBuildOutput>
    <SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
    <!-- This package doesn't contain any lib or ref assemblies because it's a tooling package.-->
    <NoWarn>$(NoWarn);NU5128</NoWarn>
    <TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);_AddBuildOutputToPackageCore;_AddBuildOutputToPackageDesktop</TargetsForTfmSpecificContentInPackage>
    <PackageDescription>MSBuild tasks and targets to emit Roslyn based source code from input assemblies.</PackageDescription>
  </PropertyGroup>

  <!-- SDK's task infrastructure -->
  <ItemGroup>
    <Compile Include="$(RepoRoot)src\Tasks\Common\TaskBase.cs" LinkBase="Common" />
    <Compile Include="$(RepoRoot)src\Tasks\Common\Logger.cs" LinkBase="Common" />
    <Compile Include="$(RepoRoot)src\Tasks\Common\LogAdapter.cs" LinkBase="Common" />
    <Compile Include="$(RepoRoot)src\Tasks\Common\BuildErrorException.cs" LinkBase="Common" />
    <Compile Include="$(RepoRoot)src\Tasks\Common\Message.cs" LinkBase="Common" />
    <Compile Include="$(RepoRoot)src\Tasks\Common\MessageLevel.cs" LinkBase="Common" />
  </ItemGroup>

  <!-- Include MSBuild logger -->
  <ItemGroup>
    <Compile Include="..\..\Microsoft.DotNet.ApiSymbolExtensions\Logging\MSBuildLog.cs" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Build.Framework" ExcludeAssets="Runtime" />
    <PackageReference Include="Microsoft.Build.Utilities.Core" ExcludeAssets="Runtime" />
    <ProjectReference Include="..\Microsoft.DotNet.GenAPI\Microsoft.DotNet.GenAPI.csproj" />
  </ItemGroup>

  <ItemGroup>
    <None Include="**\*.props;**\*.targets" Pack="true" PackagePath="%(RecursiveDir)%(Filename)%(Extension)" />
  </ItemGroup>

  <Target Name="_AddBuildOutputToPackageCore" DependsOnTargets="Publish" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
    <ItemGroup>
      <!-- Publish .NET Core assets and include them in the package under tools directory. -->
      <TfmSpecificPackageFile Include="$(PublishDir)**" PackagePath="tools/net/%(RecursiveDir)%(FileName)%(Extension)" />
    </ItemGroup>
  </Target>

  <Target Name="_AddBuildOutputToPackageDesktop" Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
    <ItemGroup>
      <!-- Include .NET Framework build outputs in the package under tools directory. -->
      <TfmSpecificPackageFile Include="$(OutputPath)**" PackagePath="tools/netframework/%(RecursiveDir)%(FileName)%(Extension)" />
    </ItemGroup>
  </Target>

</Project>
