<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <Import Project="$(MSBuildThisFileDirectory)Version.props" />

  <!-- Compute intermediate values. To avoid conflicts name all custom variables with Do prefix. -->
  <PropertyGroup>
    <DoBuildNumber>$(BUILD_NUMBER)</DoBuildNumber>
    <DoBuildNumber Condition="'$(DoBuildNumber)'==''">0</DoBuildNumber>
    <DoBuildYear>$([System.DateTime]::Today.Year)</DoBuildYear>
    <DoProductName>DataObjects.Net</DoProductName>
    <DoProductAuthors>Xtensive LLC and contributors</DoProductAuthors>
    <DoProductCopyright>2003-$(DoBuildYear) $(DoProductAuthors)</DoProductCopyright>
    <DoVersionSuffix Condition="'$(DoVersionSuffix)'=='dev'">dev-$(DoBuildNumber)</DoVersionSuffix>
    <DoMajor>$([System.Version]::new($(DoVersion)).Major)</DoMajor>
    <DoMinor>$([System.Version]::new($(DoVersion)).Minor)</DoMinor>
    <DoPatch>$([System.Version]::new($(DoVersion)).Build)</DoPatch>
    <DoVersionName>$(DoMajor).$(DoMinor).$(DoPatch)</DoVersionName>
    <DoVersionName Condition="'$(DoVersionSuffix)'!=''">$(DoVersionName)-$(DoVersionSuffix)</DoVersionName>
    <DoPackageIcon>$(MSBuildThisFileDirectory)do-nuget.png</DoPackageIcon>
    <DoRevFile>$(MSBuildThisFileDirectory)_Build\rev.txt</DoRevFile>
  </PropertyGroup>

  <PropertyGroup>
    <LangVersion>8.0</LangVersion>
    <SolutionDir Condition="$(SolutionDir) == ''">$(MSBuildThisFileDirectory.TrimEnd('\').TrimEnd('/'))\</SolutionDir>
    <Configuration Condition="$(Configuration) == ''">Debug</Configuration>
    <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
    <NoLogo>true</NoLogo>
    <SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
    <ArtifactsDir Condition="'$(ArtifactsDir)'==''">$(SolutionDir)_Build\</ArtifactsDir>
    <BaseIntermediateOutputPath>$(ArtifactsDir)obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
    <IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
    <BaseOutputPath>$(ArtifactsDir)bin\$(Configuration)\</BaseOutputPath>
    <BaseOutputPath Condition="$(MSBuildProjectName.Contains('Tests'))
      OR $(MSBuildProjectName) == 'TestCommon'
      OR $(MSBuildProjectName) == 'Xtensive.Orm.Manual'">$(ArtifactsDir)tests\$(Configuration)\</BaseOutputPath>
    <OutputPath>$(BaseOutputPath)lib\</OutputPath>
    <MSBuildProjectExtensionsPath>$(BaseIntermediateOutputPath)</MSBuildProjectExtensionsPath>
    <ProjectAssetsFile>$(MSBuildProjectExtensionsPath)project.assets.json</ProjectAssetsFile>
    <ProjectAssetsCacheFile>$(MSBuildProjectExtensionsPath)$(MSBuildProjectName).assets.cache</ProjectAssetsCacheFile>
    <OrmKeyFile>$(SolutionDir)Orm\Orm.snk</OrmKeyFile>
	<NoWarn>$(NoWarn);NETSDK1138</NoWarn>
  </PropertyGroup>

  <PropertyGroup>
    <GeneratePackageOnBuild Condition="$(MSBuildProjectName) == 'Xtensive.Orm.Weaver'">false</GeneratePackageOnBuild>
    <GeneratePackageOnBuild Condition="$(MSBuildProjectName) == 'Xtensive.Orm.Manual'">false</GeneratePackageOnBuild>
    <GeneratePackageOnBuild Condition="$(MSBuildProjectName) == 'TestCommon'">false</GeneratePackageOnBuild>
    <GeneratePackageOnBuild Condition="$(MSBuildProjectName.Contains('Tests')) == 'true'">false</GeneratePackageOnBuild>
    <GeneratePackageOnBuild Condition="$(GeneratePackageOnBuild)=='' AND '$(Configuration)' == 'Release'">true</GeneratePackageOnBuild>

    <IncludeSymbols Condition="$(GeneratePackageOnBuild) == 'true'">true</IncludeSymbols>
    <SymbolPackageFormat>snupkg</SymbolPackageFormat>
    <EmbedUntrackedSources>true</EmbedUntrackedSources>
    <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
  </PropertyGroup>
  <ItemGroup>
    <SourceRoot Include="$(MSBuildThisFileDirectory)/"/>
    <PackageReference Condition="$(GeneratePackageOnBuild) == 'true'"
                      Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
  </ItemGroup>

  <!-- Populate standard properties. -->
  <PropertyGroup>
    <Product>$(DoProductName)</Product>
    <Company>$(DoProductAuthors)</Company>
    <Authors>$(DoProductAuthors)</Authors>
    <Version>$(DoVersionName)</Version>
    <AssemblyVersion>$(DoMajor).$(DoMinor).0.0</AssemblyVersion>
    <FileVersion>$(DoMajor).$(DoMinor).$(DoPatch).$(DoBuildNumber)</FileVersion>
    <Copyright>$(DoProductCopyright)</Copyright>
    <PackageProjectUrl>https://dataobjects.net/</PackageProjectUrl>
    <PackageIcon>do-nuget.png</PackageIcon>
    <PackageLicenseExpression>MIT</PackageLicenseExpression>
    <PackageTags>DataObjects.Net ORM BLL Persistence</PackageTags>
    <PackageOutputPath>$(BaseOutputPath)packages\</PackageOutputPath>
    <RepositoryUrl>https://github.com/DataObjects-NET/dataobjects-net</RepositoryUrl>
    <RepositoryType>git</RepositoryType>
  </PropertyGroup>

  <ItemGroup>
    <None Include="$(DoPackageIcon)" Pack="true" PackagePath="." Visible="false" />
  </ItemGroup>

  <Import Condition="Exists('User.Directory.Build.props')" Project="User.Directory.Build.props" />
</Project>
