Skip to content

[Xamarin.Android.Build.Tasks] Use class-parse.exe out of MSBuild process #6551

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 1 commit into from
Dec 14, 2021

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented Dec 7, 2021

Context: dotnet/java-interop#499

There are potentially some conflicts with using Xamarin.Android.Tools.Bytecode directly in the MSBuild process, as it now imports protobuf-net which is a commonly used library.

To ensure it isn't running in-process, switch our targets to shell out to class-parse[.exe/.dll].

Additionally add class-parse.dll, etc. to the .NET 6 install pack. We are already shipping class-parse.exe, etc. in the Classic installer even though it wasn't used, so no additional installer changes are needed there.

As expected, moving this out-of-process is slightly slower, but still acceptable.

Before
292 ms  ClassParse                                 1 calls

After
425 ms  ClassParse                                 1 calls

Additionally adds java-resolution-report.log to <FileWrites /> which was added in dotnet/java-interop#849.

@jpobst jpobst force-pushed the out-of-proc-class-parse branch 3 times, most recently from 89c9866 to a02297e Compare December 8, 2021 02:51
@jpobst jpobst marked this pull request as ready for review December 9, 2021 16:35
Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

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

Could you measure the build time before & after?

I think you could build a binding with -clp:performancesummary or -bl and just see how long this task takes.

classPath.SaveXmlDescription (output);
var cmd = GetCommandLineBuilder ();

var responseFile = Path.Combine (Path.GetDirectoryName (OutputFile), "class-parse.rsp");
Copy link
Member

Choose a reason for hiding this comment

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

If class-parse.exe succeeds, should we delete this file immediately? Just leave it on disk if there is a non-zero exit code?

Otherwise, should something delete it when you run the Clean target?

Copy link
Contributor Author

@jpobst jpobst Dec 13, 2021

Choose a reason for hiding this comment

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

Good suggestions, added performance data and <FileWrites /> for response file.

@jpobst jpobst force-pushed the out-of-proc-class-parse branch from a02297e to 7fdad64 Compare December 13, 2021 21:37
Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

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

Looks good if CI ends up green 👍

@jonpryor jonpryor merged commit 014c1cb into main Dec 14, 2021
@jonpryor jonpryor deleted the out-of-proc-class-parse branch December 14, 2021 16:36
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants