Skip to content

Simplify target to enable config binding src generator from NuGet package, ensure it runs for all TFMs, and rename enabling property - #84379

Merged
layomia merged 5 commits into
dotnet:mainfrom
layomia:binder-gen-packaging-target
Apr 9, 2023
Merged

Simplify target to enable config binding src generator from NuGet package, ensure it runs for all TFMs, and rename enabling property#84379
layomia merged 5 commits into
dotnet:mainfrom
layomia:binder-gen-packaging-target

Conversation

@layomia

Copy link
Copy Markdown
Contributor

@layomialayomia added this to the 8.0.0 milestone Apr 5, 2023
@layomialayomia self-assigned this Apr 5, 2023
@layomia
layomia marked this pull request as ready for review April 5, 2023 20:39
@ghost

ghost commented Apr 5, 2023

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/area-extensions-configuration
See info in area-owners.md if you want to be subscribed.

Issue Details
Author:layomia
Assignees:layomia
Labels:

area-Extensions-Configuration

Milestone:8.0.0

@layomia
layomiaforce-pushed the binder-gen-packaging-target branch from 923793c to 98917deCompareApril 5, 2023 21:14
@layomia
layomiaforce-pushed the binder-gen-packaging-target branch from 98917de to 1994914CompareApril 5, 2023 21:15

@ericstjericstj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - just a non-blocking nit.

</PropertyGroup>

<ItemGroup>
<Content Include="buildTransitive\$(MSBuildProjectName).*"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<ContentInclude="buildTransitive\$(MSBuildProjectName).*"
<ContentInclude="buildTransitive\$(PackageId).targets"

nit: I tend to avoid a wildcard unless it's needed since it hurts evaluation perf. nit: $(PackageId) should be used rather than $(MSBuildProjectName) since they can differ, but the PackageID is the one that needs to match.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could update the docs (and the other places that do this as well) to be consistent across the repo?

```xml
<ItemGroup>
<ContentInclude="buildTransitive\$(MSBuildProjectName).*"
PackagePath="buildTransitive\netstandard2.0\;
buildTransitive\$(NetFrameworkMinimum)\;
buildTransitive\$(NetCoreAppMinimum)\" />
</ItemGroup>
```

I believe the * is there to support both .props and .targets. But @ViktorHofer would know for sure.

@layomia

layomia commented Apr 7, 2023

Copy link
Copy Markdown
ContributorAuthor

The AddNETStandardCompatErrorFileForPackaging target infra to emit a warning for unsupported package-consuming TFMs causes the analyzer removal target to get dropped for unsupported TFMs (e.g. net461 and netcoreapp3.1)

<TargetName="AddNETStandardCompatErrorFileForPackaging"

This is undesirable and can lead to undefined behavior. The latest commit 9eab1ce fixes this issue, enforcing that the removal target runs for all TFMs & also emitting the compat warning for unsupported TFMs. This fix is hardcoded for now. We need to also fix it for the other source-generator targets for multi-targeting and disabling, and come up with the right templating across all the targets & packages. cc @ViktorHofer

@layomialayomia changed the title Simplify target to enable config binding src generator and rename enabling propertySimplify target to enable config binding src generator from NuGet package, ensure it runs for all TFMs, and rename enabling propertyApr 9, 2023
@layomia
layomia merged commit e039add into dotnet:mainApr 9, 2023
</Target>

<Target Name="NETStandardCompatError_Microsoft_Extensions_Configuration_Binder"
Condition="'$(SuppressTfmSupportBuildWarnings)' == ''">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this to '$(SuppressTfmSupportBuildWarnings)' != 'true'. While at it, can you please also change that here:

Condition="'%24(SuppressTfmSupportBuildWarnings)' == ''">

</ItemGroup>
</Target>

<Target Name="NETStandardCompatError_Microsoft_Extensions_Configuration_Binder"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please file a tracking issue to discuss how to support both the NETStandardCompatError infrastructure and target framework agnostic msbuild infrastructure.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you go: #84570.

@ViktorHoferViktorHofer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM aside from two comments.

@layomialayomia added the source-generator Indicates an issue with a source generator feature label May 17, 2023
@ghostghost locked as resolved and limited conversation to collaborators Jun 17, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Extensions-Configurationsource-generatorIndicates an issue with a source generator feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@layomia@ViktorHofer@eerhardt@ericstj