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

Remove race condition from DllImportGenerator build #61695

Merged
merged 6 commits into from
Nov 18, 2021
12 changes: 1 addition & 11 deletions eng/generators.targets
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
and @(EnabledGenerators->AnyHaveMetadataValue('Identity', 'DllImportGenerator'))
and '$(IncludeDllImportGeneratorSources)' == 'true'">
<ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.InteropServices\gen\DllImportGenerator\DllImportGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.InteropServices\gen\Microsoft.Interop.SourceGeneration\Microsoft.Interop.SourceGeneration.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<Compile Include="$(LibrariesProjectRoot)Common\src\System\Runtime\InteropServices\GeneratedDllImportAttribute.cs" />

<!-- Only add the following files if we are on the latest TFM (that is, net7). -->
Expand All @@ -67,17 +68,6 @@
<DllImportGenerator_UseInternalUnsafeType>true</DllImportGenerator_UseInternalUnsafeType>
<DefineConstants>$(DefineConstants);DLLIMPORTGENERATOR_INTERNALUNSAFE</DefineConstants>
</PropertyGroup>

<MSBuild Projects="$(LibrariesProjectRoot)System.Runtime.InteropServices\gen\DllImportGenerator\DllImportGenerator.csproj"
RemoveProperties="TargetFramework">
<Output TaskParameter="TargetOutputs" PropertyName="DllImportGeneratorOutputPath" />
</MSBuild>

<!-- We add the copy of Microsoft.Interop.SourceGeneration.dll that lives next to Microsoft.Interop.DllImportGenerator.dll
to work around https://github.com/dotnet/roslyn/issues/56442 -->
<ItemGroup>
<Analyzer Include="$([MSBuild]::NormalizePath('$([System.IO.Path]::GetDirectoryName('$(DllImportGeneratorOutputPath)'))', 'Microsoft.Interop.SourceGeneration.dll'))" />
</ItemGroup>
<PropertyGroup>
<DefineConstants>$(DefineConstants);DLLIMPORTGENERATOR_ENABLED</DefineConstants>
</PropertyGroup>
Expand Down