Add /t:UpdateRepoLineups which will automatically update the build/dependencies.targets file with appropriate versions

This commit is contained in:
Nate McMaster 2017-09-18 10:33:48 -07:00
parent dc50526a6d
commit a10ba83751
3 changed files with 23 additions and 2 deletions

View File

@ -154,11 +154,21 @@
Solutions="@(Solution)" Solutions="@(Solution)"
Artifacts="@(ArtifactInfo)" Artifacts="@(ArtifactInfo)"
ShippedArtifacts="@(ShippedArtifactInfo)" ShippedArtifacts="@(ShippedArtifactInfo)"
StartGraphAt="$(BuildGraphOf)"
Properties="Configuration=$(Configuration);BuildNumber=$(BuildNumber)"> Properties="Configuration=$(Configuration);BuildNumber=$(BuildNumber)">
<Output TaskParameter="RepositoryBuildOrder" ItemName="RepositoryBuildOrder" /> <Output TaskParameter="RepositoryBuildOrder" ItemName="RepositoryBuildOrder" />
</RepoTasks.AnalyzeBuildGraph> </RepoTasks.AnalyzeBuildGraph>
</Target> </Target>
<Target Name="UpdateRepoLineups" DependsOnTargets="ResolveRepoInfo">
<RepoTasks.GenerateLineup
Artifacts="@(ArtifactInfo)"
Repository="%(Repository.Identity)"
OutputPath="$(_CloneRepositoryRoot)%(Repository.Identity)\build\dependencies.targets"
UseFloatingVersions="true"
BuildNumber="$(BuildNumber)" />
</Target>
<Target Name="GenerateLineup" DependsOnTargets="ResolveRepoInfo"> <Target Name="GenerateLineup" DependsOnTargets="ResolveRepoInfo">
<Message Text="Packages that will be produced:" Importance="High" /> <Message Text="Packages that will be produced:" Importance="High" />
<Message Text=" - %(ArtifactInfo.PackageId)/%(Version)" Importance="High" Condition="'%(ArtifactType)' == 'NuGetPackage'" /> <Message Text=" - %(ArtifactInfo.PackageId)/%(Version)" Importance="High" Condition="'%(ArtifactType)' == 'NuGetPackage'" />
@ -166,7 +176,7 @@
<RepoTasks.GenerateLineup <RepoTasks.GenerateLineup
Artifacts="@(ArtifactInfo)" Artifacts="@(ArtifactInfo)"
OutputPath="$(ArtifactsDir)dependencies.targets" OutputPath="$(ArtifactsDir)dependencies.targets"
UseFloatingVersions="true" UseFloatingVersions="false"
BuildNumber="$(BuildNumber)" /> BuildNumber="$(BuildNumber)" />
</Target> </Target>

View File

@ -38,6 +38,8 @@ namespace RepoTasks
[Required] [Required]
public string Properties { get; set; } public string Properties { get; set; }
public string StartGraphAt { get; set; }
/// <summary> /// <summary>
/// The order in which to build repositories /// The order in which to build repositories
/// </summary> /// </summary>

View File

@ -22,6 +22,9 @@ namespace RepoTasks
[Required] [Required]
public string OutputPath { get; set; } public string OutputPath { get; set; }
// Can be set to filter the lists of packages when produce a list for a specific repository
public string Repository { get; set; }
public bool UseFloatingVersions { get; set; } public bool UseFloatingVersions { get; set; }
public string BuildNumber { get; set; } public string BuildNumber { get; set; }
@ -48,7 +51,12 @@ namespace RepoTasks
switch (info) switch (info)
{ {
case ArtifactInfo.Package pkg when (!pkg.IsSymbolsArtifact): case ArtifactInfo.Package pkg when (!pkg.IsSymbolsArtifact):
packages.Add(pkg.PackageInfo); // TODO filter this list based on topological sort info
if (string.IsNullOrEmpty(Repository)
|| !Repository.Equals(pkg.RepoName, StringComparison.OrdinalIgnoreCase))
{
packages.Add(pkg.PackageInfo);
}
break; break;
} }
} }
@ -77,6 +85,7 @@ namespace RepoTasks
}; };
using (var writer = XmlWriter.Create(OutputPath, settings)) using (var writer = XmlWriter.Create(OutputPath, settings))
{ {
Log.LogMessage(MessageImportance.High, $"Generate {OutputPath}");
doc.Save(writer); doc.Save(writer);
} }
return true; return true;