diff options
Diffstat (limited to 'eng/generators.targets')
-rw-r--r-- | eng/generators.targets | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/eng/generators.targets b/eng/generators.targets index 882affe1b25..7cd7b4ca935 100644 --- a/eng/generators.targets +++ b/eng/generators.targets @@ -1,18 +1,18 @@ <Project> <PropertyGroup> - <EnableDllImportGenerator Condition="'$(EnableDllImportGenerator)' == '' - and '$(MSBuildProjectName)' == 'System.Private.CoreLib'">true</EnableDllImportGenerator> - <IncludeDllImportGeneratorSources Condition="'$(IncludeDllImportGeneratorSources)' == ''">true</IncludeDllImportGeneratorSources> + <EnableLibraryImportGenerator Condition="'$(EnableLibraryImportGenerator)' == '' + and '$(MSBuildProjectName)' == 'System.Private.CoreLib'">true</EnableLibraryImportGenerator> + <IncludeLibraryImportGeneratorSources Condition="'$(IncludeLibraryImportGeneratorSources)' == ''">true</IncludeLibraryImportGeneratorSources> </PropertyGroup> <ItemGroup> - <EnabledGenerators Include="DllImportGenerator" Condition="'$(EnableDllImportGenerator)' == 'true'" /> - <!-- If the current project is not System.Private.CoreLib, we enable the DllImportGenerator source generator + <EnabledGenerators Include="LibraryImportGenerator" Condition="'$(EnableLibraryImportGenerator)' == 'true'" /> + <!-- If the current project is not System.Private.CoreLib, we enable the LibraryImportGenerator source generator when the project is a C# source project that either: - references System.Private.CoreLib, or - references System.Runtime.InteropServices --> - <EnabledGenerators Include="DllImportGenerator" - Condition="'$(EnableDllImportGenerator)' == '' + <EnabledGenerators Include="LibraryImportGenerator" + Condition="'$(EnableLibraryImportGenerator)' == '' and '$(IsSourceProject)' == 'true' and '$(MSBuildProjectExtension)' == '.csproj' and ( @@ -22,8 +22,8 @@ and @(ProjectReference->AnyHaveMetadataValue('Identity', '$(CoreLibProject)'))) or ('$(NetCoreAppCurrentTargetFrameworkMoniker)' == '$(TargetFrameworkMoniker)' and '$(DisableImplicitAssemblyReferences)' == 'false'))" /> - <EnabledGenerators Include="DllImportGenerator" - Condition="'$(EnableDllImportGenerator)' == '' + <EnabledGenerators Include="LibraryImportGenerator" + Condition="'$(EnableLibraryImportGenerator)' == '' and '$(IsSourceProject)' == 'true' and '$(MSBuildProjectExtension)' == '.csproj' and ('$(TargetFrameworkIdentifier)' == '.NETStandard' or '$(TargetFrameworkIdentifier)' == '.NETFramework' or ('$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '$(NetCoreAppCurrentVersion)'))))" /> @@ -31,9 +31,9 @@ <!-- Use this complex ItemGroup-based filtering to add the ProjectReference to make sure dotnet/runtime stays compatible with NuGet Static Graph Restore. --> <ItemGroup Condition="'@(EnabledGenerators)' != '' - and @(EnabledGenerators->AnyHaveMetadataValue('Identity', 'DllImportGenerator'))"> + and @(EnabledGenerators->AnyHaveMetadataValue('Identity', 'LibraryImportGenerator'))"> <ProjectReference - Include="$(LibrariesProjectRoot)System.Runtime.InteropServices\gen\DllImportGenerator\DllImportGenerator.csproj" + Include="$(LibrariesProjectRoot)System.Runtime.InteropServices\gen\LibraryImportGenerator\LibraryImportGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" /> <ProjectReference @@ -42,8 +42,8 @@ ReferenceOutputAssembly="false" /> </ItemGroup> <ItemGroup Condition="'@(EnabledGenerators)' != '' - and @(EnabledGenerators->AnyHaveMetadataValue('Identity', 'DllImportGenerator')) - and '$(IncludeDllImportGeneratorSources)' == 'true'"> + and @(EnabledGenerators->AnyHaveMetadataValue('Identity', 'LibraryImportGenerator')) + and '$(IncludeLibraryImportGeneratorSources)' == 'true'"> <Compile Include="$(LibrariesProjectRoot)Common\src\System\Runtime\InteropServices\GeneratedDllImportAttribute.cs" /> <Compile Include="$(LibrariesProjectRoot)Common\src\System\Runtime\InteropServices\StringMarshalling.cs" /> @@ -54,7 +54,7 @@ <Compile Condition="'$(NetCoreAppCurrentTargetFrameworkMoniker)' == '$(TargetFrameworkMoniker)' and ( '$(MSBuildProjectName)' == 'System.Private.CoreLib' - or '$(EnableDllImportGenerator)' == 'true' + or '$(EnableLibraryImportGenerator)' == 'true' or ('@(Reference)' != '' and @(Reference->AnyHaveMetadataValue('Identity', 'System.Memory'))) or ('@(ProjectReference)' != '' @@ -75,18 +75,18 @@ </ItemGroup> <Target Name="ConfigureGenerators" - DependsOnTargets="ConfigureDllImportGenerator" + DependsOnTargets="ConfigureLibraryImportGenerator" BeforeTargets="CoreCompile" /> - <!-- Microsoft.Interop.DllImportGenerator --> - <Target Name="ConfigureDllImportGenerator" - Condition="'@(EnabledGenerators)' != '' and @(EnabledGenerators->AnyHaveMetadataValue('Identity', 'DllImportGenerator'))" + <!-- Microsoft.Interop.LibraryImportGenerator --> + <Target Name="ConfigureLibraryImportGenerator" + Condition="'@(EnabledGenerators)' != '' and @(EnabledGenerators->AnyHaveMetadataValue('Identity', 'LibraryImportGenerator'))" DependsOnTargets="ResolveProjectReferences" BeforeTargets="GenerateMSBuildEditorConfigFileShouldRun"> <PropertyGroup> - <DllImportGenerator_UseMarshalType>true</DllImportGenerator_UseMarshalType> + <LibraryImportGenerator_UseMarshalType>true</LibraryImportGenerator_UseMarshalType> </PropertyGroup> </Target> - <Import Project="$(LibrariesProjectRoot)System.Runtime.InteropServices/gen/DllImportGenerator/Microsoft.Interop.DllImportGenerator.props" /> + <Import Project="$(LibrariesProjectRoot)System.Runtime.InteropServices/gen/LibraryImportGenerator/Microsoft.Interop.LibraryImportGenerator.props" /> </Project> |