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

  <PropertyGroup>
    <TargetFrameworks>net462;netstandard2.0;net8.0;</TargetFrameworks>
    <RootNamespace>OpenQA.Selenium</RootNamespace>
    <LangVersion>14.0</LangVersion>
    <Nullable>enable</Nullable>
    <SignAssembly>true</SignAssembly>
    <AssemblyOriginatorKeyFile>..\..\Selenium.snk</AssemblyOriginatorKeyFile>
  </PropertyGroup>

  <PropertyGroup>
    <AssemblyTitle>WebDriver</AssemblyTitle>
    <Company>Selenium Committers</Company>
    <Copyright>Copyright © Software Freedom Conservancy 2018</Copyright>
    <Product>Selenium</Product>
    <Version>4.0.0</Version>
    <AssemblyVersion>4.0.0.0</AssemblyVersion>
    <FileVersion>4.0.0.0</FileVersion>

    <PackageId>Selenium.WebDriver</PackageId>
    <Authors>Selenium Committers</Authors>

    <Title>Selenium WebDriver</Title>

    <PackageProjectUrl>https://selenium.dev</PackageProjectUrl>
    <RepositoryType>GitHub</RepositoryType>
    <RepositoryUrl>https://github.com/SeleniumHQ/selenium</RepositoryUrl>
    <Description>
      Selenium is a set of different software tools each with a different approach
      to supporting browser automation. These tools are highly flexible, allowing
      many options for locating and manipulating elements within a browser, and one
      of its key features is the support for automating multiple browser platforms.
      This package contains the .NET bindings for the concise and object-based
      Selenium WebDriver API, which uses native OS-level events to manipulate the
      browser, bypassing the JavaScript sandbox, and does not require the Selenium
      Server to automate the browser.
    </Description>
    <PackageTags>selenium webdriver browser automation</PackageTags>
    <PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
    <PackageIconUrl>https://selenium.dev/images/selenium_logo_square_green.png</PackageIconUrl>
    <PackageIcon>logo.png</PackageIcon>

    <GenerateDocumentationFile>true</GenerateDocumentationFile>
  </PropertyGroup>

  <PropertyGroup>
    <BaseSeleniumManagerPath>$(MSBuildThisFileDirectory)..\..\..\bazel-bin\dotnet\src\webdriver\manager</BaseSeleniumManagerPath>
  </PropertyGroup>

  <!--TODO when AOT is ready https://github.com/SeleniumHQ/selenium/issues/15080-->
  <!--<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
    <IsAotCompatible>true</IsAotCompatible>
  </PropertyGroup>-->

  <ItemGroup Condition=" '$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'netstandard2.0'">
    <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
    <PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
    <PackageReference Include="System.Text.Json" Version="8.0.6" />
    <PackageReference Include="System.Threading.Channels" Version="8.0.0" />
  </ItemGroup>

  <Target Name="GenerateBazelArtifacts" BeforeTargets="CoreCompile">
    <Exec Command="bazel build //dotnet/src/webdriver:manager-linux //dotnet/src/webdriver:manager-windows //dotnet/src/webdriver:manager-macos //dotnet/src/webdriver:resource-utilities //dotnet/src/webdriver/DevTools/..." WorkingDirectory="../../.." />

    <ItemGroup>
      <Compile Include="..\..\..\bazel-bin\dotnet\src\webdriver\ResourceUtilities.g.cs" />
      <Compile Include="..\..\..\bazel-bin\dotnet\src\webdriver\DevTools\**\*.cs" LinkBase="DevTools\generated" />
    </ItemGroup>
  </Target>

  <ItemGroup>
    <None Include="$(BaseSeleniumManagerPath)\linux\selenium-manager" Pack="true" PackagePath="runtimes\linux\native\" Visible="false" CopyToOutputDirectory="PreserveNewest" Link="runtimes\linux\native\selenium-manager" />
    <None Include="$(BaseSeleniumManagerPath)\macos\selenium-manager" Pack="true" PackagePath="runtimes\osx\native\" Visible="false" CopyToOutputDirectory="PreserveNewest" Link="runtimes\osx\native\selenium-manager" />
    <None Include="$(BaseSeleniumManagerPath)\windows\selenium-manager.exe" Pack="true" PackagePath="runtimes\win\native\" Visible="false" CopyToOutputDirectory="PreserveNewest" Link="runtimes\win\native\selenium-manager.exe" />
  </ItemGroup>

  <ItemGroup>
    <None Include="..\..\..\common\images\selenium_logo_small.png" Pack="true" PackagePath="logo.png" Visible="false" />
  </ItemGroup>

  <ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
    <Reference Include="System.IO.Compression" />
    <Reference Include="System.Net.Http" />
  </ItemGroup>

  <ItemGroup>
    <None Update="assets/nuget/build/Selenium.WebDriver.props" Pack="true" PackagePath="build\" />
    <None Update="assets/nuget/buildTransitive/Selenium.WebDriver.props" Pack="true" PackagePath="buildTransitive\" />
  </ItemGroup>

  <PropertyGroup>
    <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
    <CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\Generated</CompilerGeneratedFilesOutputPath>
  </PropertyGroup>

</Project>
