Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "none",
"comment": "Delete .PCH ",
"packageName": "react-native-windows",
"email": "[email protected]",
"commit": "42a383343b2b7624fb05efd5253064d9102746de",
"date": "2019-12-13T19:33:23.242Z"
}
22 changes: 22 additions & 0 deletions vnext/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,26 @@
<Message Text="=> VCTargetsPath [$(VCTargetsPath)]" />
</Target>

<Target Name="_ComputePrecompToCleanUp">
<ItemGroup>
<PCHFileToClean Include="$(IntDir)\**\*.pch" />
<_PCHFileToCleanWithTimestamp Include="@(PCHFileToClean)" Condition="'%(Identity)' != ''">
<LastWriteTime>$([System.IO.File]::GetLastWriteTime('%(Identity)'))</LastWriteTime>
</_PCHFileToCleanWithTimestamp>
</ItemGroup>
</Target>
<!--
As a cppwinrt project, .pch is very big, and delete it in pipeline after build
Instead of outright deleting the PCHs, we want to trick the "project freshness detector" by
emitting empty files that look suspiciously like the PCHs it's expecting.
It's of utmost importance that their timestamps match up. -->
<Target Name="CleanUpPrecompHeaders"
DependsOnTargets="_ComputePrecompToCleanUp"
AfterTargets="AfterBuild"
Condition="'$(AGENT_ID)' != ''">
<!-- We just need to keep *ReactNativeWindows*'s PCHs because they get rebuilt more often. -->
<Delete Files="@(_PCHFileToCleanWithTimestamp)"/>
<Touch Files="@(_PCHFileToCleanWithTimestamp)" Time="%(LastWriteTime)" AlwaysCreate="true" />
<Message Text="PCH and Precomp object @(_PCHFileToCleanWithTimestamp) has been deleted for $(ProjectName)." />
</Target>
</Project>