Skip to content

Commit 1832ec1

Browse files
KevinRansombaronfel
authored andcommitted
Fix rebuild (#9770)
1 parent 2dfe719 commit 1832ec1

2 files changed

Lines changed: 45 additions & 10 deletions

File tree

FSharpBuild.Directory.Build.targets

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,49 @@
6969
<Target Name="BeforeResGen"
7070
Inputs="@(EmbeddedResource->'$(IntermediateOutputPath)%(Filename)%(Extension)')"
7171
Outputs="@(EmbeddedResource->'$(IntermediateOutputPath)resources\%(Filename)%(Extension)')"
72-
DependsOnTargets="CopyVsixResources"
7372
Condition="'$(Configuration)' != 'Proto' and '$(Language)'=='F#' and '$(DisableCompilerRedirection)' != 'true' ">
7473

75-
<!-- <SubstituteText EmbeddedResources="@(EmbeddedResource)">
74+
<MakeDir Directories="$(IntermediateOutputPath)" Condition="!Exists('$(IntermediateOutputPath)')" />
75+
<MakeDir Directories="$(IntermediateOutputPath)resources\" Condition="!Exists('$(IntermediateOutputPath)resources\')" />
76+
77+
<SubstituteText EmbeddedResources="@(EmbeddedResource)">
7678
<Output TaskParameter="CopiedFiles" ItemName="CopiedFiles" />
77-
</SubstituteText> -->
79+
</SubstituteText>
7880

7981
<ItemGroup>
82+
<IntermediateFiles Include="$(IntermediateOutputPath)\*.resx" />
83+
<IntermediateResourcesFiles Include="$(IntermediateOutputPath)resources\*.resx" />
84+
</ItemGroup>
85+
86+
<!-- IntermediateFiles Hashes -->
87+
<GetFileHash Files="@(IntermediateFiles)">
88+
<Output
89+
TaskParameter="Items"
90+
ItemName="IntermediateFilesHashes" />
91+
</GetFileHash>
92+
93+
<Hash ItemsToHash="@(IntermediateFilesHashes->'%(FileHash)')">
94+
<Output TaskParameter="HashResult" PropertyName="IntermediateFilesHash" />
95+
</Hash>
96+
97+
<!-- CopiedFilesForHash Hashes -->
98+
<GetFileHash Files="@(IntermediateResourceFilesForHash)">
99+
<Output
100+
TaskParameter="Items"
101+
ItemName="IntermediateResourceFilesHashes" />
102+
</GetFileHash>
103+
104+
<Hash ItemsToHash="@(IntermediateResourceFilesHashes->'%(FileHash)')">
105+
<Output TaskParameter="HashResult" PropertyName="IntermediateResourceFilesHash" />
106+
</Hash>
107+
108+
<!-- Update EmbeddedResources -->
109+
<ItemGroup Condition="'$(IntermediateFilesHash)' != '$(IntermediateResourceFilesHash)'">
80110
<EmbeddedResource Remove="@(EmbeddedResource)"/>
81111
<!-- <EmbeddedResource Include="@(CopiedFiles)"/> -->
82112
</ItemGroup>
83113

84-
<MakeDir Directories="$(IntermediateOutputPath)" Condition="!Exists('$(IntermediateOutputPath)')" />
85-
<MakeDir Directories="$(IntermediateOutputPath)resources\" Condition="!Exists('$(IntermediateOutputPath)resources\')" />
86-
</Target>
87-
88-
<Target Name="CopyVsixResources">
89-
<Copy SourceFiles="@(CopyVsixResources)" DestinationFolder="$(IntermediateOutputPath)\resources\Resources" />
114+
<Copy SourceFiles="@(CopyVsixResources)" DestinationFolder="$(IntermediateOutputPath)\resources\Resources" Condition="'$(IntermediateFilesHash)' != '$(IntermediateResourceFilesHash)'" />
90115
</Target>
91116

92117
</Project>

eng/tests/UpToDate.ps1

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,19 @@ try {
2323
# gather assembly timestamps
2424
$ArtifactsBinDir = Join-Path $RepoRoot "artifacts" | Join-Path -ChildPath "bin" -Resolve
2525
$FSharpAssemblyDirs = Get-ChildItem -Path $ArtifactsBinDir -Filter "FSharp.*"
26-
$FSharpAssemblyPaths = $FSharpAssemblyDirs | ForEach-Object { Get-ChildItem -Path (Join-Path $ArtifactsBinDir $_) -Recurse -Filter "$_.dll" } | ForEach-Object { $_.FullName }
26+
$FscAssemblyDir = Get-ChildItem -Path $ArtifactsBinDir -Filter "fsc"
27+
$FsiAssemblyDir = Get-ChildItem -Path $ArtifactsBinDir -Filter "fsi"
28+
$FsiAnyCpuAssemblyDir = Get-ChildItem -Path $ArtifactsBinDir -Filter "fsiAnyCpu"
29+
$DmAssemblyDir = Get-ChildItem -Path $ArtifactsBinDir -Filter "Microsoft.DotNet.DependencyManager"
30+
$ProjectSystemAssemblyDirs = Get-ChildItem -Path $ArtifactsBinDir -Filter "ProjectSystem*"
31+
$FSharpDirs = @($FSharpAssemblyDirs) + @($FscAssemblyDir) + @($FsiAssemblyDir) + @($FsiAnyCpuAssemblyDir) + @($DmAssemblyDir) + @($ProjectSystemAssemblyDirs)
32+
$FSharpDllPaths = $FSharpDirs | ForEach-Object { Get-ChildItem -Path (Join-Path $ArtifactsBinDir $_) -Recurse -Filter "*.dll" } | ForEach-Object { $_.FullName }
33+
$FSharpExePaths = $FSharpDirs | ForEach-Object { Get-ChildItem -Path (Join-Path $ArtifactsBinDir $_) -Recurse -Filter "*.exe" } | ForEach-Object { $_.FullName }
34+
$FSharpAssemblyPaths = @($FSharpDllPaths) + @($FSharpExePaths)
2735

2836
$InitialAssembliesAndTimes = @{}
2937
foreach ($asm in $FSharpAssemblyPaths) {
38+
Write-Host "Assembly : $asm"
3039
$LastWriteTime = (Get-Item $asm).LastWriteTimeUtc
3140
$InitialAssembliesAndTimes.Add($asm, $LastWriteTime)
3241
}
@@ -53,6 +62,7 @@ try {
5362
$InitialTime = $InitialAssembliesAndTimes[$asm]
5463
$FinalTime = $FinalAssembliesAndTimes[$asm]
5564
if ($InitialTime -ne $FinalTime) {
65+
Write-Host "Rebuilt assembly: $asm"
5666
$RecompiledFiles += $asm
5767
}
5868
}

0 commit comments

Comments
 (0)