Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix intellisense package xml file failing up-to-date check in libs projects #105243

Merged
merged 1 commit into from
Jul 23, 2024
Merged
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
17 changes: 16 additions & 1 deletion eng/intellisense.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<IntellisensePackageXmlFilePath Condition="'$(IntellisensePackageXmlFilePath)' == '' and Exists($(IntellisensePackageXmlFilePathFromNetFolder))">$(IntellisensePackageXmlFilePathFromNetFolder)</IntellisensePackageXmlFilePath>
<IntellisensePackageXmlFilePath Condition="'$(IntellisensePackageXmlFilePath)' == '' and Exists($(IntellisensePackageXmlFilePathFromDotNetPlatExtFolder))">$(IntellisensePackageXmlFilePathFromDotNetPlatExtFolder)</IntellisensePackageXmlFilePath>

<IntermediateDocFileItemFromIntellisensePackage>$(IntermediateOutputPath)$(TargetName).intellisense-package.xml</IntermediateDocFileItemFromIntellisensePackage>
ViktorHofer marked this conversation as resolved.
Show resolved Hide resolved

<!-- Suppress "CS1591 - Missing XML comment for publicly visible type or member" compiler errors when the intellisense package xml file is used. -->
<NoWarn Condition="'$(SkipIntellisenseNoWarnCS1591)' != 'true'">$(NoWarn);1591</NoWarn>
</PropertyGroup>
Expand All @@ -25,13 +27,26 @@
<PackageDownload Include="Microsoft.Private.Intellisense" Version="[$(MicrosoftPrivateIntellisenseVersion)]" />
</ItemGroup>

<!-- Prepare the intellisense package xml file by copying it to the project's intermediate folder and update its file timestamp.
This is necessary so that all project outputs are newer than all project inputs. Directly copying from the intellisense package
would violate that and break fast up-to-date check. -->
<Target Name="PrepareIntellisensePackageXmlFile"
Inputs="$(IntellisensePackageXmlFilePath)"
Outputs="$(IntermediateDocFileItemFromIntellisensePackage)">
<Copy SourceFiles="$(IntellisensePackageXmlFilePath)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't the copy be enough to give the new file a new creation timestamp? Why is the touch below needed?

Copy link
Member Author

@ViktorHofer ViktorHofer Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is about modification date&time which doesn't get updated by the Copy task.

DestinationFiles="$(IntermediateDocFileItemFromIntellisensePackage)" />

<Touch Files="$(IntermediateDocFileItemFromIntellisensePackage)" />
ViktorHofer marked this conversation as resolved.
Show resolved Hide resolved
</Target>

<!-- Replace the compiler generated xml file in the obj folder with the one that comes from the intellisense package. -->
<Target Name="ChangeDocumentationFileForPackaging"
DependsOnTargets="PrepareIntellisensePackageXmlFile"
BeforeTargets="CopyFilesToOutputDirectory;DocumentationProjectOutputGroup"
Condition="'$(UseCompilerGeneratedDocXmlFile)' != 'true' and '$(IntellisensePackageXmlFilePath)' != ''">
<ItemGroup>
<DocFileItem Remove="@(DocFileItem)" />
<DocFileItem Include="$(IntellisensePackageXmlFilePath)" />
<DocFileItem Include="$(IntermediateDocFileItemFromIntellisensePackage)" />
Copy link
Member

@carlossanlop carlossanlop Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to revert the name to the original after this? I wonder if the new suffix *.intellisense-package* would affect our process. It was my understanding that the intellisense file needs to match the assembly name, except for the extension.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just the name of the intermediate file in the obj directory. We need a different name as we also have the compiler generated xml file. The final output path is the expected one: AssemblyName.xml.

</ItemGroup>
</Target>

Expand Down
Loading