[xbuild] Fix #628525. Fix incremental rebuild.
authorAnkit Jain <radical@corewars.org>
Thu, 5 Aug 2010 11:53:56 +0000 (17:23 +0530)
committerAnkit Jain <radical@corewars.org>
Thu, 5 Aug 2010 12:04:57 +0000 (17:34 +0530)
When doing a rebuild for an already built project, the common
files (CopyLocal) should not be deleted by a project, as
other projects might be depending on them. This becomes a problem
when a common output dir is used.

mcs/tools/xbuild/xbuild/2.0/Microsoft.Common.targets
mcs/tools/xbuild/xbuild/3.5/Microsoft.Common.targets
mcs/tools/xbuild/xbuild/4.0/Microsoft.Common.targets

index 008c27d12f665f1a5b0a7944e8834b1d872ed309..7eeb83e3ef77fe01c64b35963f471db24c8cfa27 100644 (file)
                        SourceFiles="@(ReferenceCopyLocalPaths)"
                        DestinationFiles="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')"
                        SkipUnchangedFiles="true">
-                       <Output TaskParameter = "DestinationFiles" ItemName = "FileWrites"/>
+                       <Output TaskParameter = "DestinationFiles" ItemName = "FileWritesShareable"/>
                </Copy>
        </Target>
 
                        <Output TaskParameter="Filtered" ItemName="CombinedFileWrites"/>
                </RemoveDuplicates>
 
+               <!-- CopyLocal files: In case all the projects build to common output
+                    directory, then other projects might depend on some of these
+                    CopyLocal files, so delete only the ones under *this* project
+                    directory -->
+               <FindUnderPath Path="$(MSBuildProjectDirectory)" Files="@(FileWritesShareable)">
+                       <Output TaskParameter="InPath" ItemName="FileWrites"/>
+               </FindUnderPath>
+
                <WriteLinesToFile
                        File="$(IntermediateOutputPath)$(CleanFile)"
                        Lines="@(CombinedFileWrites)"
index 008c27d12f665f1a5b0a7944e8834b1d872ed309..7eeb83e3ef77fe01c64b35963f471db24c8cfa27 100644 (file)
                        SourceFiles="@(ReferenceCopyLocalPaths)"
                        DestinationFiles="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')"
                        SkipUnchangedFiles="true">
-                       <Output TaskParameter = "DestinationFiles" ItemName = "FileWrites"/>
+                       <Output TaskParameter = "DestinationFiles" ItemName = "FileWritesShareable"/>
                </Copy>
        </Target>
 
                        <Output TaskParameter="Filtered" ItemName="CombinedFileWrites"/>
                </RemoveDuplicates>
 
+               <!-- CopyLocal files: In case all the projects build to common output
+                    directory, then other projects might depend on some of these
+                    CopyLocal files, so delete only the ones under *this* project
+                    directory -->
+               <FindUnderPath Path="$(MSBuildProjectDirectory)" Files="@(FileWritesShareable)">
+                       <Output TaskParameter="InPath" ItemName="FileWrites"/>
+               </FindUnderPath>
+
                <WriteLinesToFile
                        File="$(IntermediateOutputPath)$(CleanFile)"
                        Lines="@(CombinedFileWrites)"
index cf0bd6d65a89df6cbab545b464f16405c26cfa1d..6545fc826d5f632b36bbdd613c06c33b6cee71c6 100644 (file)
                        SourceFiles="@(ReferenceCopyLocalPaths)"
                        DestinationFiles="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')"
                        SkipUnchangedFiles="true">
-                       <Output TaskParameter = "DestinationFiles" ItemName = "FileWrites"/>
+                       <Output TaskParameter = "DestinationFiles" ItemName = "FileWritesShareable"/>
                </Copy>
        </Target>
 
                        <Output TaskParameter="Filtered" ItemName="CombinedFileWrites"/>
                </RemoveDuplicates>
 
+               <!-- CopyLocal files: In case all the projects build to common output
+                    directory, then other projects might depend on some of these
+                    CopyLocal files, so delete only the ones under *this* project
+                    directory -->
+               <FindUnderPath Path="$(MSBuildProjectDirectory)" Files="@(FileWritesShareable)">
+                       <Output TaskParameter="InPath" ItemName="FileWrites"/>
+               </FindUnderPath>
+
                <WriteLinesToFile
                        File="$(IntermediateOutputPath)$(CleanFile)"
                        Lines="@(CombinedFileWrites)"