130 lines
6.0 KiB
XML
130 lines
6.0 KiB
XML
<Project>
|
|
|
|
<Target Name="GenerateReferenceSource" Condition=" $(HasReferenceAssembly) ">
|
|
<PropertyGroup>
|
|
<_RefSourceOutputPath>$([System.IO.Directory]::GetParent('$(MSBuildProjectDirectory)'))/ref/</_RefSourceOutputPath>
|
|
<_RefProjectFileOutputPath>$(_RefSourceOutputPath)$(AssemblyName).csproj</_RefProjectFileOutputPath>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<_AllTargetFrameworks Remove="@(_AllTargetFrameworks)" />
|
|
<_AllTargetFrameworks Include="$(TargetFrameworks);$(TargetFramework)" />
|
|
<_DeduplicatedTargetFramework Include="%(_AllTargetFrameworks.Identity)" />
|
|
</ItemGroup>
|
|
|
|
<MSBuild Projects="$(MSBuildProjectFullPath)"
|
|
Targets="_GenerateProjectSourceInner"
|
|
Properties="TargetFramework=%(_DeduplicatedTargetFramework.Identity);CompileUsingReferenceAssemblies=false">
|
|
<Output TaskParameter="TargetOutputs" ItemName="ProjectListContentItem" />
|
|
</MSBuild>
|
|
|
|
<ItemGroup>
|
|
<_ResultTargetFramework Include="%(ProjectListContentItem.TargetFramework)" />
|
|
</ItemGroup>
|
|
|
|
<PropertyGroup>
|
|
<ProjectListContentLines><![CDATA[
|
|
<!-- This file is automatically generated. -->
|
|
<Project Sdk="Microsoft.NET.Sdk">
|
|
<PropertyGroup>
|
|
<TargetFrameworks>@(_ResultTargetFramework)</TargetFrameworks>
|
|
</PropertyGroup>
|
|
@(ProjectListContentItem->'%(Identity)', '%0A')
|
|
</Project>
|
|
]]></ProjectListContentLines>
|
|
</PropertyGroup>
|
|
|
|
<WriteLinesToFile File="$(_RefProjectFileOutputPath)"
|
|
Lines="$([MSBuild]::Escape($(ProjectListContentLines)))"
|
|
Overwrite="true" />
|
|
|
|
<Message Importance="High" Text="Generated $(_RefProjectFileOutputPath)" />
|
|
</Target>
|
|
|
|
<Target Name="_GenerateProjectSourceInner"
|
|
Returns="@(ProjectListContent)"
|
|
DependsOnTargets="Build"
|
|
Condition=" '$(TargetFrameworkIdentifier)' != '.NETFramework' ">
|
|
<PropertyGroup>
|
|
<_RefSourceFileTFM>$(TargetFramework)</_RefSourceFileTFM>
|
|
<_RefSourceFileTFM Condition="$(TargetFramework.StartsWith('netcoreapp'))">netcoreapp</_RefSourceFileTFM>
|
|
<_RefProjectFileTFM>$(TargetFramework)</_RefProjectFileTFM>
|
|
<_RefProjectFileTFM Condition="'$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)'">%24(DefaultNetCoreTargetFramework)</_RefProjectFileTFM>
|
|
|
|
<_RefSourceOutputPath>$([System.IO.Directory]::GetParent('$(MSBuildProjectDirectory)'))/ref/</_RefSourceOutputPath>
|
|
<_RefSourceFileName>$(AssemblyName).$(_RefSourceFileTFM).cs</_RefSourceFileName>
|
|
<_ManualRefSourceFileName>$(AssemblyName).Manual.cs</_ManualRefSourceFileName>
|
|
<_PerTFMManualRefSourceFileName>$(AssemblyName).$(_RefSourceFileTFM).Manual.cs</_PerTFMManualRefSourceFileName>
|
|
<_RefSourceFileOutputPath>$(_RefSourceOutputPath)$(_RefSourceFileName)</_RefSourceFileOutputPath>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<_ReferenceDirectoriesWithDuplicates Include="@(ReferencePath->'%(RootDir)%(Directory)'->TrimEnd('\'))" />
|
|
<_ReferencePathDirectories Include="%(_ReferenceDirectoriesWithDuplicates.Identity)" />
|
|
</ItemGroup>
|
|
|
|
<PropertyGroup>
|
|
<_GenApiFile>$([MSBuild]::NormalizePath('$(ArtifactsDir)', 'log', 'GenAPI.rsp'))</_GenApiFile>
|
|
<_GenAPICommand
|
|
Condition="'$(MSBuildRuntimeType)' == 'core'">"$(DotNetTool)" --roll-forward-on-no-candidate-fx 2 "$(_GenAPIPath)"</_GenAPICommand>
|
|
<_GenAPICmd>$(_GenAPICommand)</_GenAPICmd>
|
|
<_GenAPICmd>$(_GenAPICommand) @"$(_GenApiFile)"</_GenAPICmd>
|
|
<_GenAPICmd
|
|
Condition=" '$(AdditionalGenApiCmdOptions)' != '' ">$(_GenAPICmd) $(AdditionalGenApiCmdOptions)</_GenAPICmd>
|
|
<_GenApiArguments><![CDATA[
|
|
"$(TargetPath)"
|
|
--lib-path "@(_ReferencePathDirectories, '%3B')"
|
|
--out "$(_RefSourceFileOutputPath)"
|
|
--header-file "$(RepoRoot)/eng/LicenseHeader.txt"
|
|
--exclude-api-list "$(RepoRoot)/eng/GenAPI.exclusions.txt"
|
|
]]>
|
|
</_GenApiArguments>
|
|
</PropertyGroup>
|
|
|
|
<WriteLinesToFile File="$(_GenApiFile)" Lines="$(_GenApiArguments)" Overwrite="true" />
|
|
|
|
<MakeDir Directories="$(_RefSourceOutputPath)" />
|
|
<Message Importance="High" Text="Generating $(_RefSourceFileOutputPath)" />
|
|
<Exec Command="$(_GenAPICmd)" />
|
|
|
|
<ItemGroup>
|
|
<_ReferenceAssemblyCompileItems Include="$(_RefSourceFileName)" />
|
|
<_ReferenceAssemblyCompileItems Include="$(_ManualRefSourceFileName)"
|
|
Condition="Exists('$(_RefSourceOutputPath)$(_ManualRefSourceFileName)')" />
|
|
<_ReferenceAssemblyCompileItems Include="$(_PerTFMManualRefSourceFileName)"
|
|
Condition="Exists('$(_RefSourceOutputPath)$(_PerTFMManualRefSourceFileName)')" />
|
|
<_ReferenceAssemblyCompileItems Include="../src/AssemblyInfo.cs"
|
|
Condition="Exists('$(MSBuildProjectDirectory)/AssemblyInfo.cs')" />
|
|
<_ReferenceAssemblyCompileItems Include="../src/Properties/AssemblyInfo.cs"
|
|
Condition="Exists('$(MSBuildProjectDirectory)/Properties/AssemblyInfo.cs')" />
|
|
<FilteredOriginalReferences Include="%(_OriginalReferences.Identity)"
|
|
Condition="'%(_OriginalReferences.NuGetPackageId)' == '' AND '%(_OriginalReferences.PrivateAssets)' != 'All'" />
|
|
|
|
<_ReferenceAssemblyItems
|
|
Include="@(_ReferenceAssemblyCompileItems->'<Compile Include="%(Identity)" />')" />
|
|
<_ReferenceAssemblyItems
|
|
Include="@(FilteredOriginalReferences->'<Reference Include="%(Identity)" />')"
|
|
Condition=" '@(FilteredOriginalReferences)' != '' " />
|
|
<!-- Some src/ projects use Arcade SDK feature to generate InternalsVisibleTo attributes. -->
|
|
<_ReferenceAssemblyItems
|
|
Include="@(InternalsVisibleTo->'<InternalsVisibleTo Include="%(Identity)" Key="%(Key)" />')"
|
|
Condition=" '@(InternalsVisibleTo)' != '' " />
|
|
</ItemGroup>
|
|
|
|
<PropertyGroup>
|
|
<ReferencesContent>
|
|
<![CDATA[
|
|
<ItemGroup Condition="'%24(TargetFramework)' == '$(_RefProjectFileTFM)'">
|
|
@(_ReferenceAssemblyItems, '%0A ')
|
|
</ItemGroup>
|
|
]]>
|
|
</ReferencesContent>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<ProjectListContent Include="$(ReferencesContent)" TargetFramework="$(_RefProjectFileTFM)" />
|
|
</ItemGroup>
|
|
</Target>
|
|
|
|
</Project>
|