-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Update generators.targets #68860
Update generators.targets #68860
Conversation
Changes: - Improve perf of LibraryImportGenerator condition and simplify it - Use the same msbuild code styling as in other projects in src/libraries - Update comments that were outdated - Remove the item conditions for the regex source generator which doesn't work well with the CPS (common project system) inside VS. - Remove unnecessary property
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries Issue DetailsChanges:
|
@carlossanlop @hoyosjs @joperezr can you please take a look? It's a trivial change that should not add any risk to the product. |
<ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.InteropServices\gen\LibraryImportGenerator\LibraryImportGenerator.csproj; | ||
$(LibrariesProjectRoot)System.Runtime.InteropServices\gen\Microsoft.Interop.SourceGeneration\Microsoft.Interop.SourceGeneration.csproj" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I'd (personally) prefer seeing this as two entries, since two things are being added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above. When you define items with the same metadata (i.e. Condition or in this case the OutputItemType
and ReferenceOutputAssembly
metadata), grouping them together makes more sense IMO.
Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
OutputItemType="Analyzer" | ||
ReferenceOutputAssembly="false" /> | ||
<ItemGroup Condition="'$(EnableRegexGenerator)' == 'true'"> | ||
<ProjectReference Include="$(LibrariesProjectRoot)System.Text.RegularExpressions\gen\System.Text.RegularExpressions.Generator.csproj" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we always try to use Unix-style folder separators everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's the opposite. Under src/libraries we prefer Windows path separators.
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" /> runtime/src/libraries/Microsoft.Extensions.Http/src/Microsoft.Extensions.Http.csproj
Lines 29 to 32 in 0533792
<ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.DependencyInjection.Abstractions\src\Microsoft.Extensions.DependencyInjection.Abstractions.csproj" /> <ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.Logging\src\Microsoft.Extensions.Logging.csproj" /> <ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.Logging.Abstractions\src\Microsoft.Extensions.Logging.Abstractions.csproj" /> <ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.Options\src\Microsoft.Extensions.Options.csproj" /> runtime/src/libraries/System.IO.Ports/src/System.IO.Ports.csproj
Lines 23 to 37 in 0533792
<Compile Include="System\IO\Ports\Handshake.cs" /> <Compile Include="System\IO\Ports\InternalResources.cs" /> <Compile Include="System\IO\Ports\Parity.cs" /> <Compile Include="System\IO\Ports\SerialData.cs" /> <Compile Include="System\IO\Ports\SerialDataReceivedEventArgs.cs" /> <Compile Include="System\IO\Ports\SerialDataReceivedEventHandler.cs" /> <Compile Include="System\IO\Ports\SerialError.cs" /> <Compile Include="System\IO\Ports\SerialErrorReceivedEventArgs.cs" /> <Compile Include="System\IO\Ports\SerialErrorReceivedEventHandler.cs" /> <Compile Include="System\IO\Ports\SerialPinChange.cs" /> <Compile Include="System\IO\Ports\SerialPinChangedEventArgs.cs" /> <Compile Include="System\IO\Ports\SerialPinChangedEventHandler.cs" /> <Compile Include="System\IO\Ports\SerialPort.cs" /> <Compile Include="System\IO\Ports\SerialStream.cs" /> <Compile Include="System\IO\Ports\StopBits.cs" />
Condition="'$(EnableLibraryImportGenerator)' == '' and | ||
'$(IsSourceProject)' == 'true' and | ||
'$(MSBuildProjectExtension)' == '.csproj' and | ||
( | ||
'$(TargetFrameworkMoniker)' != '$(NetCoreAppCurrentTargetFrameworkMoniker)' or | ||
'$(DisableImplicitFrameworkReferences)' != 'true' or | ||
( | ||
'@(Reference)' != '' and | ||
@(Reference->AnyHaveMetadataValue('Identity', 'System.Runtime.InteropServices')) | ||
) or | ||
( | ||
'@(ProjectReference)' != '' and | ||
@(ProjectReference->AnyHaveMetadataValue('Identity', '$(CoreLibProject)')) | ||
) | ||
)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can probably simplify this more now that we aren't injecting as much source as before (only enums and an attribute type on downlevel). This can be left for a future PR though.
Changes:
work well with the CPS (common project system) inside VS.