<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <ProductVersion>8.0.30703</ProductVersion>
    <ProjectGuid>{1305ABF0-EEA0-464F-99D5-7FD5BE5E4956}</ProjectGuid>
    <RootNamespace>Perforce.P4</RootNamespace>
    <TargetFrameworks>netstandard2.0;net462;net80</TargetFrameworks>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <PackageId>p4api.net</PackageId>
    <AssemblyTitle>Helix Core API for .NET</AssemblyTitle>
    <Version>2025.1.277.3624</Version>
    <Company>Perforce Software, Inc.</Company>
    <Product>Helix Core API for .NET</Product>
    <Description>
      Perforce Helix VCS Library for .NET Core
      Cross Platform Library supporting Windows, Linux and OSX
    </Description>
    <Copyright>Copyright (C) 2025 Perforce Software, Inc.</Copyright>
    <AssemblyVersion>2025.1.277.3624</AssemblyVersion>
    <FileVersion>2025.1.277.3624</FileVersion>
    <Authors>Perforce Software, Inc.</Authors>
    <PackageTags>perforce helix vcs scm p4 p4api p4api.net</PackageTags>

    <!-- Add Icon and Readme -->
    <PackageIcon>icon-helix-core-simple-64-64.png</PackageIcon>
    <PackageReadmeFile>nugetReadme.md</PackageReadmeFile>
    <PostBuildEvent />
    <PreBuildEvent />
  </PropertyGroup>
  <PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
    <DefineConstants>_WINDOWS</DefineConstants>
    <DocumentationFile>.\bin\Release\p4api.net.xml</DocumentationFile>
    <NoWarn>1570;1572;1573;1587;1591;8032;NETSDK1182</NoWarn>
  </PropertyGroup>
  <PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Linux'))">
    <DefineConstants>_LINUX</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
    <DefineConstants>_OSX</DefineConstants>
  </PropertyGroup>

  <ItemGroup Label="PackageContents">
    <None Include=".\.editorconfig" />
    <None Include="icon-helix-core-simple-64-64.png" Pack="true" PackagePath="\" />
    <None Include="nugetReadme.md" Pack="true" PackagePath="\" />
    <Content Include="..\p4bridge\out\x64\release\lib\**\*.*" Pack="true">
      <PackagePath>runtimes\win-x64\native;</PackagePath>
    </Content>
    <Content Include="..\p4bridge\out\x86\release\lib\**\*.*" Pack="true">
      <PackagePath>runtimes\win-x86\native;</PackagePath>
    </Content>
    <!-- Linux DLL -->
    <Content Include="..\p4bridge\out\linux-Release\**\*.*" Pack="true">
      <PackagePath>runtimes\linux-x64\native;</PackagePath>
    </Content>
    <!-- Mac DLL -->
    <Content Include="..\p4bridge\out\osx-Release\**\*.*" Pack="true">
      <PackagePath>runtimes\osx-x64\native;</PackagePath>
    </Content>
  </ItemGroup>

  <!--Copy the appropriate native dll to the Output Directory (for testing)-->
  <Choose>
    <When Condition="$([MSBuild]::IsOSPlatform('Windows'))">
      <Choose>
        <When Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
          <ItemGroup>
            <Content Include="..\p4bridge\out\x86\debug\lib\**\*.*" Pack="false">
              <CopyToOutputDirectory>Always</CopyToOutputDirectory>
            </Content>
          </ItemGroup>
        </When>
        <When Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
          <ItemGroup>
            <Content Include="..\p4bridge\out\x86\release\lib\**\*.*">
              <CopyToOutputDirectory>Always</CopyToOutputDirectory>
            </Content>
          </ItemGroup>
        </When>
        <When Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
          <ItemGroup>
            <Content Include="..\p4bridge\out\x86\debug\lib\**\*.*" Pack="false">
              <CopyToOutputDirectory>Always</CopyToOutputDirectory>
              <Link>x86\%(Filename)%(Extension)</Link>
            </Content>
            <Content Include="..\p4bridge\out\x64\debug\lib\**\*.*" Pack="false">
              <CopyToOutputDirectory>Always</CopyToOutputDirectory>
              <Link>x64\%(Filename)%(Extension)</Link>
            </Content>
          </ItemGroup>
        </When>
        <When Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
          <ItemGroup>
            <Content Include="..\p4bridge\out\x86\release\lib\**\*.*">
              <CopyToOutputDirectory>Always</CopyToOutputDirectory>
              <Link>x86\%(Filename)%(Extension)</Link>
            </Content>
            <Content Include="..\p4bridge\out\x64\release\lib\**\*.*">
              <CopyToOutputDirectory>Always</CopyToOutputDirectory>
              <Link>x64\%(Filename)%(Extension)</Link>
            </Content>
          </ItemGroup>
        </When>
        <When Condition=" '$(Configuration)' == 'Debug' ">
          <ItemGroup>
            <Content Include="..\p4bridge\out\x64\debug\lib\**\*.*" Pack="false">
              <CopyToOutputDirectory>Always</CopyToOutputDirectory>
            </Content>
          </ItemGroup>
        </When>
        <When Condition=" '$(Configuration)' == 'Release' ">
          <ItemGroup>
            <Content Include="..\p4bridge\out\x64\release\lib\**\*.*">
              <CopyToOutputDirectory>Always</CopyToOutputDirectory>
            </Content>
          </ItemGroup>
        </When>
      </Choose>
    </When>
    <When Condition="$([MSBuild]::IsOSPlatform('Linux')) And '$(Configuration)' == 'Debug'">
      <ItemGroup>
        <Content Include="..\p4bridge\out\linux-Debug\**\*.so" Pack="false">
          <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        </Content>
        <Content Include="..\p4bridge\out\linux-Debug\**\p4bridge.*" Pack="false">
          <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        </Content>
      </ItemGroup>
    </When>
    <When Condition="$([MSBuild]::IsOSPlatform('Linux')) And '$(Configuration)' == 'Release' ">
      <ItemGroup>
        <Content Include="..\p4bridge\out\linux-Release\**\*.so">
          <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        </Content>
      </ItemGroup>
    </When>
    <When Condition="$([MSBuild]::IsOSPlatform('OSX')) And '$(Configuration)' == 'Debug'">
      <ItemGroup>
        <Content Include="..\p4bridge\out\osx-Debug\**\*.dylib" Pack="false">
          <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        </Content>
      </ItemGroup>
    </When>
    <When Condition="$([MSBuild]::IsOSPlatform('OSX')) And '$(Configuration)' == 'Release'">
      <ItemGroup>
        <Content Include="..\p4bridge\out\osx-Release\**\*.dylib">
          <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        </Content>
      </ItemGroup>
    </When>
  </Choose>

  <ItemGroup>
    <InternalsVisibleTo Include="p4api.net-unit-test, PublicKey=00240000048000009400000006020000002400005253413100040000010001005bd58b86ff0b4ac3872932400b9b4da1d7d72faad9c7a37cc1c9c3d9a89d7de24f260d07fe676146196ef8f1e5b5dc49d2eaa0347780454b82afb9502d15730858f0acc35cfd20285d4aa924b2edb55cb56846a2c3cbe2d65303b45c9dd737e6f81fec00d5c5f3c66e1335bc36d1ad13bea44851d35d65d08bee5aacf9e409b2" />
  </ItemGroup>

  <ItemGroup>
    <Folder Include="Properties" />
  </ItemGroup>
  
  <PropertyGroup>
    <GenerateAssemblyInfo>true</GenerateAssemblyInfo>
    <OutputType>Library</OutputType>
  </PropertyGroup>
  <PropertyGroup>
    <PostBuildEvent />
  </PropertyGroup>
  <PropertyGroup>
    <PreBuildEvent />
  </PropertyGroup>
  <ItemGroup>
    <EditorConfigFiles Remove=".\.editorconfig" />
  </ItemGroup>
</Project>
