Skip to content

Switch GenAPI to an msbuild task for perf #8507

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

Merged
merged 2 commits into from
Feb 24, 2022

Conversation

ViktorHofer
Copy link
Member

Make GenAPI an msbuild task so that it can run as part of msbuild,
in-proc. Expose all current command line options as msbuild properties
and also apply some additional code clean-up (auto fixes by VS).

This improvements makes a dotnet/runtime build 50s faster on my machine
when GenAPI is used during the build to produce reference sources.

The GenAPI target continues to be invokable with the usual command.

Make GenAPI an msbuild task so that it can run as part of msbuild,
in-proc. Expose all current command line options as msbuild properties
and also apply some additional code clean-up (auto fixes by VS).

This improvements makes a dotnet/runtime build 50s faster on my machine
when GenAPI is used during the build to produce reference sources.
@joperezr
Copy link
Member

Left a few nits, but otherwise looks good.

@ViktorHofer
Copy link
Member Author

ViktorHofer commented Feb 24, 2022

This will break both dotnet/wpf and dotnet/runtime which are consumer of this package and set the now removed GenAPIAdditionalParameters property. I will send two PRs to update their usage. cc @rladuca

@ViktorHofer ViktorHofer enabled auto-merge (squash) February 24, 2022 08:17
@rladuca
Copy link
Member

rladuca commented Feb 24, 2022

This will break both dotnet/wpf and dotnet/runtime which are consumer of this package and set the now removed GenAPIAdditionalParameters property. I will send two PRs to update their usage. cc @rladuca

I am not involved with WPF anymore, @dotnet/wpf-developers FYI.

@ViktorHofer
Copy link
Member Author

@joperezr thanks for the review. Would appreciate an approval so that I get this merged :)

Copy link
Member

@joperezr joperezr left a comment

Choose a reason for hiding this comment

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

Code changes LGTM. One last thing to consider is that I'm not sure if any other repos are using GenAPI for a different purpose today. I know we used it at some point in dotnet/iot and so of course this would break us as well. I don't think this should block your PR, but keep in mind that we may want to also provide an out-of-proc solution in case we get reports from people that used to depend on this package and can't/won't modify their ingestion to invoke it via a build task.

@ViktorHofer ViktorHofer merged commit e44123d into dotnet:main Feb 24, 2022
@ViktorHofer ViktorHofer deleted the GenAPITask branch February 24, 2022 22:47
@ericstj
Copy link
Member

ericstj commented Feb 25, 2022

@ViktorHofer
Copy link
Member Author

ViktorHofer commented Feb 25, 2022

Here are the PRs changing GenAPI's usage:

Based on https://sourcegraph.com/search?q=context:global+Microsoft.DotNet.GenAPI&patternType=literal there are only few consumers of GenAPI which invoke it outside of msbuild, most prominently mono/mono and xamarin/xamarin-android.

@akoeplinger
Copy link
Member

@ViktorHofer I'd like to keep an additional .exe build of GenAPI since it is much easier to quickly debug and play around with it rather than an msbuild task.

@ViktorHofer
Copy link
Member Author

@akoeplinger I saw your message but I don't yet have a good answer to it. I tried supporting both console and msbuild task frontends in the past with a shared backend but this proved more difficult and I couldn't get the logger working with cci. GenAPI would probably be a great dotnet tool as well so that could also be considered.

mawosoft added a commit to mawosoft/arcade that referenced this pull request Apr 8, 2022
Follow-up to PR dotnet#8507. Task parameters of type Enum cannot be passed in a project file.
Change task parameter type to string for WriterType, SyntaxWriterType, and DocIdKinds.
Do the necessary conversion inside the property getters/setters with private backing fields.
ViktorHofer pushed a commit that referenced this pull request Apr 11, 2022
…9008)

* Update GenAPI to make Enum task parameters usable in project files.
Follow-up to PR #8507. Task parameters of type Enum cannot be passed in a project file.
Change task parameter type to string for WriterType, SyntaxWriterType, and DocIdKinds.
Do the necessary conversion inside the property getters/setters with private backing fields.

* Add proper default handling for Enum string task parameters.

* Fix OutputPath parameter handling when it is an existing directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants