azure-webjobs-sdk-dashboard.../Dashboard.proj

184 строки
8.0 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="FunctionalTest" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildInParallel Condition=" '$(BuildInParallel)' == ''">true</BuildInParallel>
<NuGetExe>tools\NuGet.exe</NuGetExe>
<SkipStrongNamesExe>packages\Microsoft.Web.SkipStrongNames.1.0.0\tools\SkipStrongNames.exe</SkipStrongNamesExe>
<SkipStrongNamesXml>tools\SkipStrongNames.xml</SkipStrongNamesXml>
<PublishPath Condition=" '$(PublishPath)' == '' ">bin</PublishPath>
<SetConfiguration Condition=" '$(Configuration)' != '' ">Configuration=$(Configuration)</SetConfiguration>
<SetPlatform Condition=" '$(Platform)' != '' ">Platform=$(Platform)</SetPlatform>
</PropertyGroup>
<ItemGroup>
<!-- The Assembly items below MUST be kept in dependency order. -->
<Build Include="test\Dashboard.EndToEndTests\Dashboard.EndToEndTests.csproj">
<PublishType>Assembly</PublishType>
<PublishPath>$(PublishPath)\Binaries</PublishPath>
</Build>
</ItemGroup>
<UsingTask TaskName="SkipStrongNames.CheckSkipStrongNamesStatus" AssemblyFile="$(SkipStrongNamesExe)" />
<Target Name="DownloadNuGet">
<DownloadNuGet OutputFileName="$(NuGetExe)" MinimumVersion="2.7.0" />
</Target>
<Target Name="RestoreSkipStrongNames" DependsOnTargets="DownloadNuGet">
<Exec Command='"$(NuGetExe)" restore .nuget\packages.config -PackagesDirectory packages -NonInteractive -Verbosity quiet -ConfigFile .nuget\NuGet.Config' />
</Target>
<Target Name="CheckSkipStrongNames" DependsOnTargets="RestoreSkipStrongNames">
<CheckSkipStrongNamesStatus AssembliesFile="$(SkipStrongNamesXml)">
<Output TaskParameter="Status" PropertyName="Status" />
</CheckSkipStrongNamesStatus>
<Error Text="Unit tests will not run correctly unless SkipStrongNames is Enabled. Current status: $(Status). Run the EnableSkipStrongNames target to fix this problem." Condition="'$(Status)' != 'Enabled'" />
</Target>
<Target Name="EnableSkipStrongNames" DependsOnTargets="RestoreSkipStrongNames">
<Exec Command='"$(SkipStrongNamesExe)" -e "$(SkipStrongNamesXml)"' />
<CheckSkipStrongNamesStatus AssembliesFile="$(SkipStrongNamesXml)">
<Output TaskParameter="Status" PropertyName="Status" />
</CheckSkipStrongNamesStatus>
<Message Text="SkipStrongNames: $(Status)" Importance="High" />
</Target>
<Target Name="DisableSkipStrongNames" DependsOnTargets="RestoreSkipStrongNames">
<Exec Command='"$(SkipStrongNamesExe)" -d "$(SkipStrongNamesXml)"' />
<CheckSkipStrongNamesStatus AssembliesFile="$(SkipStrongNamesXml)">
<Output TaskParameter="Status" PropertyName="Status" />
</CheckSkipStrongNamesStatus>
<Message Text="SkipStrongNames: $(Status)" Importance="High" />
</Target>
<Target Name="RestorePackages" DependsOnTargets="DownloadNuGet">
<Message Text="Restoring NuGet packages..." Importance="High" />
<Exec Command='"$(NuGetExe)" restore Dashboard.sln -PackagesDirectory packages -NonInteractive -Verbosity quiet -ConfigFile .nuget\NuGet.Config' />
</Target>
<Target Name="GetBinplace">
<PropertyGroup>
<NestedBuildProperties Condition=" '$(SetConfiguration)' != '' or '$(SetPlatform)' != ''">$(SetConfiguration); $(SetPlatform)</NestedBuildProperties>
</PropertyGroup>
<ItemGroup>
<Binplace Include="tools\Binplace\%(Build.PublishType).proj">
<Properties>ProjectFile=%(FullPath); BinplaceOutputPath=$([System.IO.Path]::GetFullPath('%(PublishPath)')); Properties=$(NestedBuildProperties)</Properties>
</Binplace>
</ItemGroup>
</Target>
<Target Name="Build" DependsOnTargets="RestorePackages;GetBinplace">
<MSBuild Projects="@(Binplace)"
BuildInParallel="$(BuildInParallel)"/>
</Target>
<UsingTask TaskName="Xunit.Runner.MSBuild.xunit" AssemblyFile="packages\xunit.MSBuild.2.0.0.0\tools\xunit.runner.msbuild.dll"/>
<Target Name="FunctionalTest" DependsOnTargets="Build">
<ItemGroup>
<FunctionalTestProjects Include="test\Dashboard.EndToEndTests\Dashboard.EndToEndTests.csproj"/>
</ItemGroup>
<MSBuild Projects="@(FunctionalTestProjects)"
Properties="$(SetConfiguration); $(SetPlatform)"
BuildInParallel="$(BuildInParallel)">
<Output TaskParameter="TargetOutputs" ItemName="FunctionalTestAssemblies"/>
</MSBuild>
<xunit Assemblies="@(FunctionalTestAssemblies)"/>
</Target>
<Target Name="Clean" DependsOnTargets="GetBinplace">
<MSBuild Projects="@(Binplace)"
Targets="Clean"
BuildInParallel="$(BuildInParallel)"/>
</Target>
<Target Name="Rebuild" DependsOnTargets="Clean;Build"/>
<Target Name="GetOfficialProjects" Returns="@(OfficialProjects)">
<ItemGroup>
<OfficialProjects Include="%(Build.FullPath)">
<PublishType>%(Build.PublishType)</PublishType>
<PublishPath>$([System.IO.Path]::GetFullPath('%(Build.PublishPath)'))</PublishPath>
</OfficialProjects>
</ItemGroup>
</Target>
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll">
<ParameterGroup>
<OutputFileName ParameterType="System.String" Required="true" />
<MinimumVersion ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System.Diagnostics" />
<Using Namespace="System.Net" />
<Code Type="Fragment" Language="cs">
<![CDATA[
Version minimumRequiredVersion;
if (!Version.TryParse(MinimumVersion, out minimumRequiredVersion))
{
Log.LogError("MinimumVersion '{0}' is not a valid Version.", MinimumVersion);
}
try
{
OutputFileName = Path.GetFullPath(OutputFileName);
if (File.Exists(OutputFileName))
{
// If NuGet.exe exists but is less than the minimum required version, delete it so that the
// latest version will be downloaded.
FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(OutputFileName);
string toParse;
if (versionInfo != null && versionInfo.ProductVersion != null)
{
toParse = versionInfo.ProductVersion;
}
else
{
toParse = null;
}
Version current;
Version parsed;
if (toParse != null && Version.TryParse(toParse, out parsed))
{
current = parsed;
}
else
{
// Treat a missing or invalid version like V0.0 (which will trigger a delete and download).
current = new Version(0, 0);
}
if (current < minimumRequiredVersion)
{
File.Delete(OutputFileName);
}
}
if (!File.Exists(OutputFileName))
{
Log.LogMessage("Downloading latest version of NuGet.exe...");
WebClient webClient = new WebClient();
webClient.DownloadFile("https://nuget.org/nuget.exe", OutputFileName);
}
return true;
}
catch (Exception ex)
{
Log.LogErrorFromException(ex);
return false;
}
]]>
</Code>
</Task>
</UsingTask>
</Project>