Identify the difference between skipped and shipped repositories

This commit is contained in:
Nate McMaster 2017-11-10 13:46:15 -08:00
parent 22b2191da2
commit a24bed01d7
4 changed files with 12 additions and 6 deletions

View File

@ -59,7 +59,8 @@
Targets="ResolveSolutions"
Properties="RepositoryRoot=%(Repository.RootPath);Configuration=$(Configuration);BuildNumber=$(BuildNumber)"
ContinueOnError="WarnAndContinue">
<Output TaskParameter="TargetOutputs" ItemName="Solution" />
<Output TaskParameter="TargetOutputs" ItemName="Solution" Condition="'%(Repository.Build)' == 'true'" />
<Output TaskParameter="TargetOutputs" ItemName="_NoBuildSolution" Condition="'%(Repository.Build)' != 'true'" />
</MSBuild>
<!--
@ -78,13 +79,14 @@
Properties="RepositoryRoot=%(ShippedRepository.RootPath);Configuration=$(Configuration);BuildNumber=$(BuildNumber)"
ContinueOnError="WarnAndContinue"
Condition="'%(ShippedRepository.Identity)' != ''">
<Output TaskParameter="TargetOutputs" ItemName="_NoBuildSolution" />
<Output TaskParameter="TargetOutputs" ItemName="_ShippedSolution" />
</MSBuild>
<ItemGroup>
<Solution Update="@(Solution)" Build="true" />
<_ShippedSolution Update="@(_ShippedSolution)" Build="false" Shipped="true" />
<_NoBuildSolution Update="@(_NoBuildSolution)" Build="false" />
<Solution Include="@(_NoBuildSolution)" />
<Solution Include="@(_NoBuildSolution);@(_ShippedSolution)" />
</ItemGroup>
<Error Text="No solutions were found in '$(SubmoduleRoot)'" Condition="@(Solution->Count()) == 0" />

View File

@ -137,7 +137,7 @@ namespace RepoTasks
continue;
}
if (!solution.ShouldBuild)
if (!solution.ShouldBuild && solution.Shipped)
{
reposThatShouldPatch.Add(Path.GetFileName(Path.GetDirectoryName(solution.FullPath)));
}

View File

@ -8,7 +8,7 @@ namespace RepoTasks.ProjectModel
{
internal class SolutionInfo
{
public SolutionInfo(string fullPath, string configName, IReadOnlyList<ProjectInfo> projects, bool shouldBuild)
public SolutionInfo(string fullPath, string configName, IReadOnlyList<ProjectInfo> projects, bool shouldBuild, bool shipped)
{
if (string.IsNullOrEmpty(fullPath))
{
@ -24,11 +24,13 @@ namespace RepoTasks.ProjectModel
ConfigName = configName;
Projects = projects ?? throw new ArgumentNullException(nameof(projects));
ShouldBuild = shouldBuild;
Shipped = shipped;
}
public string FullPath { get; }
public string ConfigName { get; }
public IReadOnlyList<ProjectInfo> Projects { get; }
public bool ShouldBuild { get; }
public bool Shipped { get; }
}
}

View File

@ -85,12 +85,14 @@ namespace RepoTasks.ProjectModel
}
bool.TryParse(solution.GetMetadata("Build"), out var shouldBuild);
bool.TryParse(solution.GetMetadata("Shipped"), out var shipped);
var solutionInfo = new SolutionInfo(
solutionFile,
configName,
projects.ToArray(),
shouldBuild);
shouldBuild,
shipped);
_buildEngine.RegisterTaskObject(key, solutionInfo, RegisteredTaskObjectLifetime.Build, allowEarlyCollection: true);