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

  <PropertyGroup>
    <TargetFrameworks>netstandard2.0;net8.0;</TargetFrameworks>
    <AssemblyName>WebDriver</AssemblyName>
    <RootNamespace>OpenQA.Selenium</RootNamespace>
    <LangVersion>12.0</LangVersion>
  </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>

  <ItemGroup>
    <InternalsVisibleTo Include="WebDriver.Common.Tests" />
  </ItemGroup>

  <ItemGroup>
    <None Remove="Settings.StyleCop" />
    <None Remove="WebDriver.ruleset" />
  </ItemGroup>

  <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
    <PackageReference Include="System.Text.Json" Version="8.0.4" />
  </ItemGroup>

  <PropertyGroup>
    <BaseImagePath>..\..\..\bazel-bin\dotnet\src\webdriver\images</BaseImagePath>
  </PropertyGroup>

  <ItemGroup>
    <None Include="assets\Selenium.WebDriver.targets" Pack="true" PackagePath="build\" />
    <None Include="assets\Selenium.WebDriver.targets" Pack="true" PackagePath="buildTransitive\" />

    <None Include="$(BaseImagePath)\selenium_logo_small.png" Pack="true" PackagePath="logo.png" Visible="false" />

    <None Include="$(BaseSeleniumManagerPath)\linux\selenium-manager" Pack="true" PackagePath="manager\linux" Visible="false" />
    <None Include="$(BaseSeleniumManagerPath)\macos\selenium-manager" Pack="true" PackagePath="manager\macos" Visible="false" />
    <None Include="$(BaseSeleniumManagerPath)\windows\selenium-manager.exe" Pack="true" PackagePath="manager\windows" Visible="false" />
  </ItemGroup>

  <Target Name="GenerateSeleniumManagerBinaries" BeforeTargets="PrepareForBuild">
    <Exec Command="bazel build //dotnet/src/webdriver:manager-linux //dotnet/src/webdriver:manager-windows //dotnet/src/webdriver:manager-macos" WorkingDirectory="../../.." />

    <PropertyGroup>
      <BaseSeleniumManagerPath>..\..\..\bazel-bin\dotnet\src\webdriver\manager</BaseSeleniumManagerPath>
    </PropertyGroup>
  </Target>

  <Target Name="GenerateAtoms" BeforeTargets="PrepareForBuild">
    <Exec Command="bazel build //javascript/webdriver/atoms:get-attribute.js //javascript/atoms/fragments:is-displayed.js //javascript/atoms/fragments:find-elements.js" WorkingDirectory="../../.." />

    <ItemGroup>
      <EmbeddedResource Include="$(ProjectDir)..\..\..\third_party\js\selenium\webdriver.json">
        <Visible>False</Visible>
        <LogicalName>webdriver_prefs.json</LogicalName>
      </EmbeddedResource>
      <EmbeddedResource Include="$(ProjectDir)..\..\..\bazel-bin\javascript\webdriver\atoms\get-attribute.js">
        <Visible>False</Visible>
        <LogicalName>get-attribute.js</LogicalName>
      </EmbeddedResource>
      <EmbeddedResource Include="$(ProjectDir)..\..\..\bazel-bin\javascript\atoms\fragments\is-displayed.js">
        <Visible>False</Visible>
        <LogicalName>is-displayed.js</LogicalName>
      </EmbeddedResource>
      <EmbeddedResource Include="$(ProjectDir)..\..\..\bazel-bin\javascript\atoms\fragments\find-elements.js">
        <Visible>False</Visible>
        <LogicalName>find-elements.js</LogicalName>
      </EmbeddedResource>
      <EmbeddedResource Include="$(ProjectDir)..\..\..\javascript\cdp-support\mutation-listener.js">
        <Visible>False</Visible>
        <LogicalName>mutation-listener.js</LogicalName>
      </EmbeddedResource>
    </ItemGroup>
  </Target>

  <Target Name="GenerateCdp" BeforeTargets="CoreCompile">
    <Exec Command="bazel build //dotnet/src/webdriver/cdp/..." WorkingDirectory="../../.." />

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

</Project>
