<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="UbuntuCoreclrAndCoreFxDependencies.props" />
  <Import Project="DebianPackageBuildDependencies.props" />
  <Import Project="CentosCoreclrAndCoreFxDependencies.props" />

  <Target Name="CheckPrereqs"
      DependsOnTargets="CheckUbuntuAptGetDependencies;
                        CheckCentOsYumDependencies;">

    <Message Text="Using previous stage version:" />
    <Exec Command="$(PreviousStageDotnet) --version" />
  </Target>

  <Target Name="CheckUbuntuAptGetDependencies"
      Condition=" '$(Rid)' == 'ubuntu.14.04-x64' ">

    <Exec Command="dpkg -s %(UbuntuCoreclrAndCoreFxDependencies.Identity)" />

    <Exec Command="dpkg -s %(DebianPackageBuildDependencies.Identity)" Condition="$(SkipBuildingInstallers) != 'true'" />

    <OnError ExecuteTargets="ShowAptGetUsage" />
  </Target>

  <Target Name="ShowAptGetUsage">
    <Message Text="Install the missing dependency with `sudo apt-get install {package}`." />
  </Target>

  <Target Name="CheckCentOsYumDependencies"
      Condition=" '$(OSName)' == 'centos' ">

    <Exec Command="yum list installed %(CentosCoreclrAndCoreFxDependencies.Identity)" />

    <OnError ExecuteTargets="ShowYumUsage" />
  </Target>

  <Target Name="ShowYumUsage">
    <Message Text="Install the missing dependency with `yum install {package}`." />
  </Target>
</Project>
