Fix incremental build of tasks.proj for mobile (#43674)
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Wed, 21 Oct 2020 15:40:26 +0000 (17:40 +0200)
committerGitHub <noreply@github.com>
Wed, 21 Oct 2020 15:40:26 +0000 (17:40 +0200)
* Fix incremental build of tasks.proj for mobile

The semaphore file that is used as the input for deciding whether to rebuild tasks.proj wasn't properly taking the mobile task projects into account.
This resulted in e.g. WasmAppBuilder not being built if you built for desktop before, resulting in a build error.

We now use the conditioned project references as an input instead of globbing through all nested projects.

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
tools-local/tasks/tasks.proj

index 2885f69..a098f6b 100644 (file)
@@ -1,6 +1,6 @@
 <Project Sdk="Microsoft.Build.Traversal">
   <ItemGroup>
-    <ProjectReference Include="$(MSBuildThisFileDirectory)**\*.csproj" Exclude="$(MSBuildProjectFullPath)" />
+    <ProjectReference Include="$(MSBuildThisFileDirectory)**\*.csproj" />
     <ProjectReference Remove="$(MSBuildThisFileDirectory)mobile.tasks\AndroidAppBuilder\AndroidAppBuilder.csproj"
                       Condition="'$(TargetOS)' != 'Android'" />
     <ProjectReference Remove="$(MSBuildThisFileDirectory)mobile.tasks\AppleAppBuilder\AppleAppBuilder.csproj"
                       Overwrite="true" />
   </Target>
 
-  <Target Name="GetTasksSrc">
+  <Target Name="GetTasksSrc"
+          DependsOnTargets="PrepareProjectReferences">
     <PropertyGroup>
       <TasksIntermediateFile>$([MSBuild]::NormalizePath('$(ArtifactsObjDir)', '$(MSBuildProjectName)', 'Debug', 'build-semaphore.txt'))</TasksIntermediateFile>
     </PropertyGroup>
 
+    <!-- Include both the project file and its sources as an input. -->
     <ItemGroup>
-      <TasksSrc Include="$(MSBuildThisFileDirectory)**\*.cs*;$(MSBuildThisFileDirectory)**\*.*proj" />
+      <TasksSrc Include="%(ProjectReferenceWithConfiguration.Identity)" />
+      <TasksSrc Include="%(ProjectReferenceWithConfiguration.RelativeDir)%(ProjectReferenceWithConfiguration.RecursiveDir)**\*.cs" />
     </ItemGroup>
   </Target>
-</Project>
\ No newline at end of file
+</Project>