Skip to content
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

[java-interop] Update to SDK style project. #657

Merged
merged 1 commit into from
Jun 8, 2020
Merged

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented Jun 3, 2020

Updates java-interop.csproj to SDK style. This is a bit tricky because this is not a C# assembly, it is just hijacking a .csproj and overriding some targets to build a C lib.

It felt cleaner to go with a more "supported" version of doing this, so the project is built on Microsoft.Build.NoTargets which is designed to run arbitrary commands without building an assembly.

Also switches to stable Mono. Not sure if this is necessary but the more modern the MSBuild support when working with SDK style projects the better.

The automatic downloading of the NoTargets package didn't work with our globalPackagesFolder set to $\..\packages, so that was changed to packages, which is what XA uses and it works.

Ran a XA build against this change to ensure the resulting library still works: dotnet/android#4759.

@jpobst jpobst force-pushed the sdk-java-interop branch 6 times, most recently from 6a7c90e to fa04024 Compare June 3, 2020 19:59
@jpobst jpobst marked this pull request as ready for review June 3, 2020 20:41
Files="$(OutputPath)\lib$(OutputName).dylib"
Condition=" '$(OS)' != 'Windows_NT' "
/>
</Target>
Copy link
Member

Choose a reason for hiding this comment

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

I think the reason these targets were in a separate file, is because VS will auto-format the file in weird ways.

Is this not an issue anymore with SDK-style projects?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤷 Must not be, I've removed most of the .targets files in this repo as I move them to SDK style, and I use VS exclusively.

Copy link
Member

Choose a reason for hiding this comment

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

It might be VS for Mac.

Copy link
Member

Choose a reason for hiding this comment

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

If we're going Modern, these targets should be in Directory.Build.targets.

Additionally, it is Xamarin Studio (née Visual Studio for Mac) which is responsible for reformatting files and otherwise breaking things, e.g.

I can't find a bug specific to reformatting .csproj files and losing whitespace changes, but the above two issues deal with reformatting .csproj files and otherwise breaking things…

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tested in VSMac and it does indeed correct our crazy indentation: https://gist.github.com/jpobst/9473335ecd4d3fe4e7bdfeb30dcee9ac. I'll move it back to java-interop.targets so we can keep our insanity even if someone ever uses VSMac. 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@jpobst jpobst force-pushed the sdk-java-interop branch from fa04024 to 048cf40 Compare June 4, 2020 16:11
@jonpryor jonpryor merged commit 1b59dcc into master Jun 8, 2020
@jonpryor jonpryor deleted the sdk-java-interop branch June 8, 2020 19:49
@jpobst jpobst added this to the 10.5 (16.8 / 8.8) milestone Jun 15, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 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