Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 205 lines (175 sloc) 14.159 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Go" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildProjectDirectory)\Build.tasks" />
  <Import Project="$(MSBuildProjectDirectory)\Microsoft.AspNet.SignalR.versions.targets" />

  <PropertyGroup>
    <Configuration Condition="$(Configuration) == ''">Debug</Configuration>
    <ProjectRoot>$(MSBuildProjectDirectory)\..</ProjectRoot>
    <ArtifactsDir>$(ProjectRoot)\artifacts\$(Configuration)</ArtifactsDir>
    <TestResultsPath>$(ArtifactsDir)\TestResults</TestResultsPath>
    <DocsPath>$(ArtifactsDir)\docs</DocsPath>
    <NuGetToolsPath>$(ProjectRoot)\.nuget</NuGetToolsPath>
    <NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath>
    <ToolsPath>$(ProjectRoot)\tools\</ToolsPath>
    <XunitPath>$(ToolsPath)xunit\</XunitPath>
    <ChutzpahExePath>$(ProjectRoot)\tools\chutzpah\chutzpah.console.exe</ChutzpahExePath>
    <JSTestsBridgeFile>$(ProjectRoot)\tests\Microsoft.AspNet.SignalR.Client.JS.Tests\CommandLineBridge.js</JSTestsBridgeFile>
    <DocuExePath>$(ToolsPath)docu\docu.exe</DocuExePath>
    <ZipExe>$(ToolsPath)7za920\7za.exe</ZipExe>
    <ScriptTempPath>$(ArtifactsDir)\Microsoft.AspNet.SignalR.Client.JS\Scripts</ScriptTempPath>
    <LocalToolsPath></LocalToolsPath>
    <KeyFile Condition="'$(KeyFile)' == ''">$(ProjectRoot)\35MSSharedLib1024.snk</KeyFile>
  </PropertyGroup>

  <!-- Add extra properties to the build for signing -->
  <PropertyGroup Condition="Exists('$(KeyFile)')">
    <ExtraProperties>_SignAssembly=true;_DelaySign=true;AssemblyOriginatorKeyFile=$(KeyFile)</ExtraProperties>
  </PropertyGroup>

  <PropertyGroup>
    <!-- Build number is of the format (CurrentYear - VersionStartYear + 1)(2 digit month)(2 digit day) -->
    <BuildDate>$([MSBuild]::Add(1, $([MSBuild]::Subtract($([System.DateTime]::Now.Year), $(VersionStartYear)))))$([System.DateTime]::Now.ToString("MMdd"))</BuildDate>
    <Revision Condition="$(BUILD_NUMBER) != ''">$(BUILD_NUMBER)</Revision>
    <Revision Condition="$(BUILD_NUMBER) == ''">0</Revision>
    <PrereleaseTag Condition="$(PRERELEASE) != ''">$(BuildQuality)-$([System.DateTime]::Now.ToString("yyMMdd"))</PrereleaseTag>
    <PrereleaseTagWithSeparator Condition="$(PrereleaseTag) != ''">-$(PrereleaseTag)</PrereleaseTagWithSeparator>
    <Version>$(MajorVersion).$(MinorVersion).$(PatchVersion)</Version>
    <FileVersion>$(MajorVersion).$(MinorVersion).$(BuildDate).$(Revision)</FileVersion>
    <PackageVersion>$(MajorVersion).$(MinorVersion).$(PatchVersion)$(PrereleaseTagWithSeparator)</PackageVersion>
  </PropertyGroup>

  <ItemGroup>
    <RegexTransform Include="$(ProjectRoot)\src\Common\CommonVersionInfo.cs">
      <Find>AssemblyVersion\("\d+\.\d+\.\d+"\)</Find>
      <ReplaceWith>AssemblyVersion("$(Version)")</ReplaceWith>
    </RegexTransform>
    <RegexTransform Include="$(ProjectRoot)\src\Common\CommonVersionInfo.cs">
      <Find>AssemblyFileVersion\("\d+\.\d+\.\d+\.\d+"\)</Find>
      <ReplaceWith>AssemblyFileVersion("$(FileVersion)")</ReplaceWith>
    </RegexTransform>
    <RegexTransform Include="$(ProjectRoot)\src\Common\CommonVersionInfo.cs">
      <Find>AssemblyInformationalVersion\("\d+\.\d+\.\d+(-\w+\d*(-\d+)?)?"\)</Find>
      <ReplaceWith>AssemblyInformationalVersion("$(PackageVersion)")</ReplaceWith>
    </RegexTransform>
    <RegexTransform Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Client\Connection.cs">
      <Find>_assemblyVersion = new Version\("\d+\.\d+\.\d+"\)</Find>
      <ReplaceWith>_assemblyVersion = new Version("$(Version)")</ReplaceWith>
    </RegexTransform>
    <RegexTransform Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Client.JS\jquery.signalR.core.js">
      <Find>SignalR JavaScript Library v\d+\.\d+\.\d+(-\w+\d*(-\d+)?)?</Find>
      <ReplaceWith>SignalR JavaScript Library v$(PackageVersion)</ReplaceWith>
    </RegexTransform>
    <RegexTransform Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Core\Scripts\hubs.js">
      <Find>SignalR JavaScript Library v\d+\.\d+\.\d+(-\w+\d*(-\d+)?)?</Find>
      <ReplaceWith>SignalR JavaScript Library v$(PackageVersion)</ReplaceWith>
    </RegexTransform>
  </ItemGroup>

  <Target Name="UpdateVersion">
    <RegexTransform Items="@(RegexTransform)" />
  </Target>

  <UsingTask AssemblyFile="$(XunitPath)xunit.runner.msbuild.dll"
             TaskName="Xunit.Runner.MSBuild.xunit" />

  <ItemGroup>
    <TestProjects Include="$(ArtifactsDir)\Microsoft.AspNet.SignalR.Tests\Microsoft.AspNet.SignalR.Tests.dll" />
    <TestProjects Include="$(ArtifactsDir)\Microsoft.AspNet.SignalR.FunctionalTests\Microsoft.AspNet.SignalR.FunctionalTests.dll" />
  </ItemGroup>

  <Target Name="CI" DependsOnTargets="RunCodeAnalysis; Build; RunTests;">
  </Target>

  <Target Name="Go" DependsOnTargets="RunCodeAnalysis; Build; RunTests;">
  </Target>

  <Target Name="RunTests">
    <Exec Command="$(ChutzpahExePath) $(JSTestsBridgeFile) /silent" />
    <RemoveDir Directories="$(ProjectRoot)\tests\Microsoft.AspNet.SignalR.Client.JS.Tests\temp" ContinueOnError="true"></RemoveDir>
    <Delete Files="$(ProjectRoot)\tests\Microsoft.AspNet.SignalR.Client.JS.Tests\CommandLineBridge.js" ContinueOnError="true"></Delete>

    <xunit Assembly="%(TestProjects.FullPath)" Xml="$(TestResultsPath)\Microsoft.AspNet.SignalR.Tests.XunitResults.xml" Verbose="true" />
  </Target>

  <Target Name="CreateOutputDir">
    <RemoveDir Directories="$(ArtifactsDir)" />
    <MakeDir Directories="$(ArtifactsDir)" Condition="!Exists('$(ArtifactsDir)')" />
    <MakeDir Directories="$(TestResultsPath)" Condition="!Exists('$(TestResultsPath)')" />
    <MakeDir Directories="$(DocsPath)" Condition="!Exists('$(DocsPath)')" />
  </Target>

  <Target Name="Build" DependsOnTargets="CreateOutputDir">
    <MSBuild Projects="$(ProjectRoot)\Microsoft.AspNet.SignalR.sln"
             Targets="Build"
             Properties="Configuration=$(Configuration);ArtifactsDir=$(ArtifactsDir);$(ExtraProperties)" />

    <MSBuild Projects="$(ProjectRoot)\Microsoft.AspNet.SignalR.WP7.sln"
             Targets="Build"
             Condition="(Exists('$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\') And Exists('$(MSBuildExtensionsPath)\Silverlight for Phone\v4.0\Microsoft.Silverlight.WindowsPhone71.Overrides.targets')) Or (Exists('$(LocalToolsPath)\WP7'))"
             Properties="Configuration=$(Configuration);ArtifactsDir=$(ArtifactsDir);$(ExtraProperties)" />

    <MSBuild Projects="$(ProjectRoot)\Microsoft.AspNet.SignalR.Silverlight.sln"
             Targets="Build"
             Condition="(Exists('$(MSBuildExtensionsPath)\Microsoft\Silverlight\v4.0') And Exists('$(MSBuildExtensionsPath)\Microsoft\Silverlight\v5.0\Microsoft.Silverlight.CSharp.targets')) Or (Exists('$(LocalToolsPath)\Silverlight'))"
             Properties="Configuration=$(Configuration);ArtifactsDir=$(ArtifactsDir);$(ExtraProperties)" />

    <MSBuild Projects="$(ProjectRoot)\Microsoft.AspNet.SignalR.WinRT.sln"
             Targets="Build"
             Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\WindowsXaml')"
             Properties="Configuration=$(Configuration);ArtifactsDir=$(ArtifactsDir);$(ExtraProperties)" />
  </Target>

  <Target Name="RunCodeAnalysis" Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v11.0\CodeAnalysis\fxcoptask.dll')">
    <ItemGroup>
      <AnalysisProjects Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Core\Microsoft.AspNet.SignalR.Core.csproj"></AnalysisProjects>
      <AnalysisProjects Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Client\Microsoft.AspNet.SignalR.Client.csproj"></AnalysisProjects>
      <AnalysisProjects Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Client.JS\Microsoft.AspNet.SignalR.Client.JS.csproj"></AnalysisProjects>
      <AnalysisProjects Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Client.Net35\Microsoft.AspNet.SignalR.Client.Net35.csproj"></AnalysisProjects>
      <AnalysisProjects Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Hosting.AspNet\Microsoft.AspNet.SignalR.Hosting.AspNet.csproj"></AnalysisProjects>
      <AnalysisProjects Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Hosting.Common\Microsoft.AspNet.SignalR.Hosting.Common.csproj"></AnalysisProjects>
      <AnalysisProjects Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Hosting.Self\Microsoft.AspNet.SignalR.Hosting.Self.csproj"></AnalysisProjects>
      <AnalysisProjects Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Redis\Microsoft.AspNet.SignalR.Redis.csproj"></AnalysisProjects>
      <AnalysisProjects Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.SqlServer\Microsoft.AspNet.SignalR.SqlServer.csproj"></AnalysisProjects>
    </ItemGroup>

    <MSBuild Projects="%(Projects.Identity)"
             Targets="Rebuild"
             Properties="RunCodeAnalysis=true;Configuration=$(Configuration);" />
  </Target>

  <Target Name="BuildDocs" DependsOnTargets="CreateOutputDir">
    <ItemGroup>
      <DocProjects Include="$(ArtifactsDir)\Microsoft.AspNet.SignalR.Core\Microsoft.AspNet.SignalR.Core.dll" />
      <DocProjects Include="$(ArtifactsDir)\Microsoft.AspNet.SignalR.Client\Microsoft.AspNet.SignalR.Client.dll" />
      <DocProjects Include="$(ArtifactsDir)\Microsoft.AspNet.SignalR.Hosting.AspNet\Microsoft.AspNet.SignalR.Hosting.AspNet.dll" />
      <DocProjects Include="$(ArtifactsDir)\Microsoft.AspNet.SignalR.Hosting.Self\Microsoft.AspNet.SignalR.Hosting.Self.dll" />
      <DocProjects Include="$(ArtifactsDir)\Microsoft.AspNet.SignalR.Hosting.Common\Microsoft.AspNet.SignalR.Hosting.Common.dll" />
    </ItemGroup>
    <Exec Command="&quot;$(DocuExePath)&quot; @(DocProjects, ' ')" WorkingDirectory="$(DocsPath)" />
    <Exec Command="&quot;$(ZipExe)&quot; a ..\..\docs.v$(PackageVersion).zip" WorkingDirectory="$(DocsPath)\output" />
  </Target>

  <Target Name="BuildPackages" DependsOnTargets="CreateOutputDir">
    <Message Importance="high" Text="Using build resources from local tools path $(LocalToolsPath)" />

    <ItemGroup>
      <JsPackage Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Client.JS\Properties\Microsoft.AspNet.SignalR.Js.nuspec" />
      <MetaPackage Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Core\Properties\Microsoft.AspNet.SignalR.All.nuspec" />
      <Projects Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Core\Microsoft.AspNet.SignalR.Core.csproj" />
      <Projects Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Hosting.AspNet\Microsoft.AspNet.SignalR.Hosting.AspNet.csproj" />
      <Projects Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Client\Microsoft.AspNet.SignalR.Client.csproj" />
      <Projects Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Hosting.Self\Microsoft.AspNet.SignalR.Hosting.Self.csproj" />
      <Projects Include="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Hosting.Common\Microsoft.AspNet.SignalR.Hosting.Common.csproj" />
      <WinRTClient Include="$(ArtifactsDir)\Microsoft.AspNet.SignalR.Client.WinRT\Microsoft.AspNet.SignalR.Client.*"></WinRTClient>
    </ItemGroup>

    <!-- To workaround a bug in nuget -->
    <MakeDir Directories="$(ArtifactsDir)\Microsoft.AspNet.SignalR.Client\winrt" />
    <Copy SourceFiles="%(WinRTClient.Identity)" DestinationFolder="$(ArtifactsDir)\Microsoft.AspNet.SignalR.Client\winrt" />

    <MSBuild Projects="%(Projects.Identity)"
             Targets="Build"
             Properties="BuildPackage=true;Version=$(PackageVersion);PackageOutputDir=$(ArtifactsDir);Configuration=$(Configuration)" />

    <!-- Only build WP7 and Silverlight projects if SDK's avaliable -->
    <MSBuild Projects="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Client.WP7\Microsoft.AspNet.SignalR.Client.WP7.csproj"
             Targets="Build"
             Condition="(Exists('$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\') And Exists('$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\v4.0\Microsoft.Silverlight.WindowsPhone71.Overrides.targets')) Or (Exists('$(LocalToolsPath)\WP7'))"
             Properties="BuildPackage=true;Version=$(PackageVersion);PackageOutputDir=$(ArtifactsDir);Configuration=$(Configuration);LocalToolsPath=$(LocalToolsPath);" />

    <MSBuild Projects="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Client.Silverlight\Microsoft.AspNet.SignalR.Client.Silverlight.csproj"
             Targets="Build"
             Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\Silverlight\v4.0') Or Exists('$(LocalToolsPath)\Silverlight\v4.0')"
             Properties="BuildPackage=true;Version=$(PackageVersion);PackageOutputDir=$(ArtifactsDir);Configuration=$(Configuration);LocalToolsPath=$(LocalToolsPath);" />

    <MSBuild Projects="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Client.Silverlight5\Microsoft.AspNet.SignalR.Client.Silverlight5.csproj"
             Targets="Build"
             Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\Silverlight\v5.0\Microsoft.Silverlight.CSharp.targets') Or Exists('$(LocalToolsPath)\Silverlight\v5.0')"
             Properties="BuildPackage=true;Version=$(PackageVersion);PackageOutputDir=$(ArtifactsDir);Configuration=$(Configuration);LocalToolsPath=$(LocalToolsPath);" />

    <RemoveDir Directories="$(ScriptTempPath)" />
    <MakeDir Directories="$(ScriptTempPath)" />

    <Copy SourceFiles="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Client.JS\bin\jquery.signalR.js"
          DestinationFiles="$(ScriptTempPath)\jquery.signalR-$(PackageVersion).js" />
    <Copy SourceFiles="$(ProjectRoot)\src\Microsoft.AspNet.SignalR.Client.JS\bin\jquery.signalR.min.js"
          DestinationFiles="$(ScriptTempPath)\jquery.signalR-$(PackageVersion).min.js" />

    <Exec Command="&quot;$(NuGetExePath)&quot; pack &quot;%(JsPackage.Identity)&quot; -o &quot;$(ArtifactsDir)&quot; -p Version=$(PackageVersion) -basePath &quot;$(ScriptTempPath)&quot;"
            LogStandardErrorAsError="true" />

    <Exec Command="&quot;$(NuGetExePath)&quot; pack &quot;%(MetaPackage.Identity)&quot; -o &quot;$(ArtifactsDir)&quot; -p Version=$(PackageVersion) -exclude **\*.cs"
          LogStandardErrorAsError="true" />
  </Target>
</Project>
Something went wrong with that request. Please try again.