Просмотр исходного кода

Identify the difference between skipped and shipped repositories

Nate McMaster 8 лет назад
Родитель
Сommit
a24bed01d7

+ 5 - 3
build/repo.targets

@@ -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" />

+ 1 - 1
build/tasks/AnalyzeBuildGraph.cs

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

+ 3 - 1
build/tasks/ProjectModel/SolutionInfo.cs

@@ -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; }
     }
 }

+ 3 - 1
build/tasks/ProjectModel/SolutionInfoFactory.cs

@@ -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);