Skip to content

Commit

Permalink
Make sure that intellisense files are copied (dotnet#87603)
Browse files Browse the repository at this point in the history
Fixes dotnet#87585

When looking at the 8.0 Preview 5 SDK, xml files are missing for certain
assemblies. This is likely because of the TargetFramework condition in
intellisense.targets. Instead of conditioning on the rid-less net8.0
TFM, use the sfx.proj which already assemblies the shared framework and
targeting pack layout to copy the documentation files.

Additionally, remove the XmlDocDir and copy the files into the targeting
pack folder which was a difference between the "real" targeting pack and
the "fake" one that libraries generates.
  • Loading branch information
ViktorHofer committed Jun 19, 2023
1 parent 60d00ec commit 8b25fd3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
1 change: 0 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@
<RepoTasksDir>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'src', 'tasks'))</RepoTasksDir>
<IbcOptimizationDataDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'ibc'))</IbcOptimizationDataDir>
<MibcOptimizationDataDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'mibc'))</MibcOptimizationDataDir>
<XmlDocDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'docs'))</XmlDocDir>
<DocsDir>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'docs'))</DocsDir>

<AppleAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleAppBuilder', 'Debug', '$(NetCoreAppToolCurrent)'))</AppleAppBuilderDir>
Expand Down
19 changes: 8 additions & 11 deletions eng/intellisense.targets
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
<PackageDownload Include="Microsoft.Private.Intellisense" Version="[$(MicrosoftPrivateIntellisenseVersion)]" />
</ItemGroup>

<!-- TODO: Remove this target when no library relies on the intellisense documentation file anymore.-->
<!-- Replace the default xml file generated in the obj folder with the one that comes from the docs feed. -->
<!-- Replace the compiler generated xml file in the obj folder with the one that comes from the intellisense package. -->
<Target Name="ChangeDocumentationFileForPackaging"
BeforeTargets="CopyFilesToOutputDirectory;DocumentationProjectOutputGroup"
Condition="'$(IntellisensePackageXmlFilePath)' != ''">
Expand All @@ -42,15 +41,13 @@
</ItemGroup>
</Target>

<!-- Copy the intellisense file to the folder we use to produce the targeting pack.
The condition is for the RID agnostic build of source assemblies that are part of the .NET Core shared framework. -->
<Target Name="CopyDocumentationFileToXmlDocDir"
AfterTargets="CopyFilesToOutputDirectory"
Condition="'$(IsNetCoreAppSrc)' == 'true' and '$(TargetFramework)' == '$(NetCoreAppCurrent)'">
<Copy SourceFiles="@(DocFileItem)"
DestinationFolder="$(XmlDocDir)"
SkipUnchangedFiles="true"
UseHardlinksIfPossible="true" />
<!-- Allow P2Ps to retrieve the DocFileItem path. -->
<Target Name="AnnotateTargetPathWithTargetPlatformMonikerWithDocFileItem"
DependsOnTargets="ChangeDocumentationFileForPackaging"
AfterTargets="GetTargetPathWithTargetPlatformMoniker">
<ItemGroup>
<TargetPathWithTargetPlatformMoniker DocFileItem="@(DocFileItem)" />
</ItemGroup>
</Target>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<Target Name="AddFrameworkFilesToPackage" DependsOnTargets="ResolveLibrariesFromLocalBuild" BeforeTargets="GetFilesToPackage">
<ItemGroup>
<ReferencePath Include="@(LibrariesRefAssemblies)" />
<DocFilesToPackage Include="$(XmlDocDir)%(LibrariesRefAssemblies.FileName).xml" Condition="Exists('$(XmlDocDir)%(LibrariesRefAssemblies.FileName).xml')"/>
<DocFilesToPackage Include="$(MicrosoftNetCoreAppRefPackRefDir)%(LibrariesRefAssemblies.FileName).xml" Condition="Exists('$(MicrosoftNetCoreAppRefPackRefDir)%(LibrariesRefAssemblies.FileName).xml')"/>
<Analyzer Include="$(MicrosoftNetCoreAppRefPackDir)/analyzers/**/*.*" />
<FilesToPackage Include="@(Analyzer)" ExcludeFromValidation="true" TargetPath="analyzers/%(RecursiveDir)" />
</ItemGroup>
Expand Down
16 changes: 16 additions & 0 deletions src/libraries/sfx.proj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@

<!-- Generate the targeting pack's framework list so that out-of-band projects can leverage it. -->
<Import Project="frameworklist.targets" />

<!-- Copy the intellisense file to the targeting pack directory. -->
<Target Name="CopyDocumentationFiles"
AfterTargets="Build"
Condition="'$(RefOnly)' != 'true'">
<ItemGroup>
<DocumentationFileToCopy Include="@(SharedFrameworkAssembly->Metadata('DocFileItem'))"
Condition="!$(NetCoreAppLibraryNoReference.Contains('%(Filename);'))" />
</ItemGroup>

<Copy SourceFiles="@(DocumentationFileToCopy)"
DestinationFolder="$(MicrosoftNetCoreAppRefPackRefDir)"
SkipUnchangedFiles="true"
UseHardlinksIfPossible="true" />
</Target>

<!-- Import the illink file which contains some of the logic required to illink the shared framework assemblies. -->
<Import Project="$(RepositoryEngineeringDir)illink.targets" />

Expand Down

0 comments on commit 8b25fd3

Please sign in to comment.