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)"
Artifacts="@(ArtifactInfo)"
ShippedArtifacts="@(ShippedArtifactInfo)"
StartGraphAt="$(BuildGraphOf)"
Properties="Configuration=$(Configuration);BuildNumber=$(BuildNumber)">
<Output TaskParameter="RepositoryBuildOrder" ItemName="RepositoryBuildOrder" />
</RepoTasks.AnalyzeBuildGraph>
</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">
<Message Text="Packages that will be produced:" Importance="High" />
<Message Text=" - %(ArtifactInfo.PackageId)/%(Version)" Importance="High" Condition="'%(ArtifactType)' == 'NuGetPackage'" />
@ -166,7 +176,7 @@
<RepoTasks.GenerateLineup
Artifacts="@(ArtifactInfo)"
OutputPath="$(ArtifactsDir)dependencies.targets"
UseFloatingVersions="true"
UseFloatingVersions="false"
BuildNumber="$(BuildNumber)" />
</Target>

View File

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

View File

@ -22,6 +22,9 @@ namespace RepoTasks
[Required]
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 string BuildNumber { get; set; }
@ -48,7 +51,12 @@ namespace RepoTasks
switch (info)
{
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;
}
}
@ -77,6 +85,7 @@ namespace RepoTasks
};
using (var writer = XmlWriter.Create(OutputPath, settings))
{
Log.LogMessage(MessageImportance.High, $"Generate {OutputPath}");
doc.Save(writer);
}
return true;