Use clone uris and commit hash that the CI specifies

This commit is contained in:
Pranav K 2017-07-07 12:26:56 -07:00
parent d518d653d2
commit 81363a4e5f
2 changed files with 66 additions and 49 deletions

View File

@ -2,54 +2,53 @@
<ItemDefinitionGroup> <ItemDefinitionGroup>
<Repository> <Repository>
<Branch>dev</Branch> <Branch>dev</Branch>
<CloneUrl>git@github.com:aspnet/%(Identity)</CloneUrl>
</Repository> </Repository>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<Repository Include="Antiforgery" Commit="" /> <Repository Include="Antiforgery" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="AzureIntegration" Commit="" /> <Repository Include="AzureIntegration" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="BasicMiddleware" Commit="" /> <Repository Include="BasicMiddleware" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="BrowserLink" Commit="" /> <Repository Include="BrowserLink" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="Caching" Commit="" /> <Repository Include="Caching" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="Common" Commit="" /> <Repository Include="Common" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="Configuration" Commit="" /> <Repository Include="Configuration" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="CORS" Commit="" /> <Repository Include="CORS" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="DataProtection" Commit="" /> <Repository Include="DataProtection" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="DependencyInjection" Commit="" /> <Repository Include="DependencyInjection" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="Diagnostics" Commit="" /> <Repository Include="Diagnostics" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="DotNetTools" Commit="" /> <Repository Include="DotNetTools" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="EntityFramework" Commit="" /> <Repository Include="EntityFramework" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="EventNotification" Commit="" /> <Repository Include="EventNotification" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="FileSystem" Commit="" /> <Repository Include="FileSystem" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="Hosting" Commit="" /> <Repository Include="Hosting" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="HtmlAbstractions" Commit="" /> <Repository Include="HtmlAbstractions" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="HttpAbstractions" Commit="" /> <Repository Include="HttpAbstractions" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="HttpSysServer" Commit="" /> <Repository Include="HttpSysServer" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="Identity" Commit="" /> <Repository Include="Identity" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="IISIntegration" Commit="" /> <Repository Include="IISIntegration" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="JavaScriptServices" Commit="" /> <Repository Include="JavaScriptServices" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="JsonPatch" Commit="" /> <Repository Include="JsonPatch" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="KestrelHttpServer" Commit="" /> <Repository Include="KestrelHttpServer" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="Localization" Commit="" /> <Repository Include="Localization" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="Logging" Commit="" /> <Repository Include="Logging" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="MetaPackages" Commit="" /> <Repository Include="MetaPackages" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="Microsoft.Data.Sqlite" Commit="" /> <Repository Include="Microsoft.Data.Sqlite" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="MusicStore" Commit="" /> <Repository Include="MusicStore" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="Mvc" Commit="" /> <Repository Include="Mvc" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="MvcPrecompilation" Commit="" /> <Repository Include="MvcPrecompilation" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="Options" Commit="" /> <Repository Include="Options" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="Proxy" Commit="" /> <Repository Include="Proxy" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="Razor" Commit="" /> <Repository Include="Razor" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="ResponseCaching" Commit="" /> <Repository Include="ResponseCaching" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="Routing" Commit="" /> <Repository Include="Routing" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="Scaffolding" Commit="" /> <Repository Include="Scaffolding" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="Security" Commit="" /> <Repository Include="Security" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="ServerTests" Commit="" /> <Repository Include="ServerTests" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="Session" Commit="" /> <Repository Include="Session" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="SignalR" Commit="" /> <Repository Include="SignalR" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="StaticFiles" Commit="" /> <Repository Include="StaticFiles" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="Testing" Commit="" /> <Repository Include="Testing" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
<Repository Include="WebSockets" Commit="" /> <Repository Include="WebSockets" Commit="" CloneUrl="git@github.com:aspnet/%(Identity)" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -199,27 +199,45 @@
XmlInputPath="$(RepositoryFileWithCommit)" XmlInputPath="$(RepositoryFileWithCommit)"
Query="//Repository[@Include='%(Repository.Identity)']/@Commit" Query="//Repository[@Include='%(Repository.Identity)']/@Commit"
Value="%(Repository.Commit)" /> Value="%(Repository.Commit)" />
<XmlPoke
XmlInputPath="$(RepositoryFileWithCommit)"
Query="//Repository[@Include='%(Repository.Identity)']/@CloneUrl"
Value="%(Repository.CloneUrl)" />
</Target> </Target>
<!-- Based on the solution here: http://stackoverflow.com/a/11331566 --> <!-- Based on the solution here: http://stackoverflow.com/a/11331566 -->
<Target Name="_GetRepositoryCommits" Outputs="%(Repository.Identity)"> <Target Name="_GetRepositoryCommits" Outputs="%(Repository.Identity)">
<PropertyGroup> <PropertyGroup>
<!--
Attempt to read environment variables set up by the CI's VCS Root if available.
* vcsroot.<RepositoryName>.url gives us the clone URL for a repository
* build.vcs.number.<RepositoryName> gives us the commit hash for a repository.
-->
<_CloneUrl>$([System.Environment]::GetEnvironmentVariable("vcsroot.%(Repository.Identity).url"))</_CloneUrl>
<_CommitHash>$([System.Environment]::GetEnvironmentVariable("build.vcs.number.%(Repository.Identity)"))</_CommitHash>
<RepositoryCloneDirectory>$(_CloneRepositoryRoot)%(Repository.Identity)</RepositoryCloneDirectory> <RepositoryCloneDirectory>$(_CloneRepositoryRoot)%(Repository.Identity)</RepositoryCloneDirectory>
</PropertyGroup> </PropertyGroup>
<Warning Text="%(Repository.Identity) has not been cloned." <Warning Text="%(Repository.Identity) has not been cloned."
Condition="!Exists('$(RepositoryCloneDirectory)')" /> Condition="!Exists('$(RepositoryCloneDirectory)')" />
<GetGitCommitInfo WorkingDirectory="$(RepositoryCloneDirectory)" Condition="Exists('$(RepositoryCloneDirectory)')"> <GetGitCommitInfo
<Output TaskParameter="CommitHash" PropertyName="_Hash" /> WorkingDirectory="$(RepositoryCloneDirectory)"
Condition="'$(_CommitHash)'=='' AND Exists('$(RepositoryCloneDirectory)')">
<Output TaskParameter="CommitHash" PropertyName="_CommitHash" />
</GetGitCommitInfo> </GetGitCommitInfo>
<ItemGroup> <ItemGroup>
<Repository Update="%(Identity)" Commit="$(_Hash)" /> <Repository Update="%(Identity)" Commit="$(_CommitHash)" />
<Repository Update="%(Identity)" CloneUrl="$(_CloneUrl)" Condition="'$(_CloneUrl)'!=''" />
</ItemGroup> </ItemGroup>
<PropertyGroup> <PropertyGroup>
<_Hash></_Hash> <_CommitHash></_CommitHash>
<_CloneUrl></_CloneUrl>
</PropertyGroup> </PropertyGroup>
</Target> </Target>