-
Notifications
You must be signed in to change notification settings - Fork 64
[java-interop] Update to SDK style project. #657
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
Conversation
6a7c90e to
fa04024
Compare
src/java-interop/java-interop.csproj
Outdated
| Files="$(OutputPath)\lib$(OutputName).dylib" | ||
| Condition=" '$(OS)' != 'Windows_NT' " | ||
| /> | ||
| </Target> |
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 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?
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.
🤷 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.
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.
It might be VS for Mac.
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.
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.
- https://xamarin.github.io/bugzilla-archives/42/42603/bug.html
- https://xamarin.github.io/bugzilla-archives/14/14004/bug.html
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…
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 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. 😉
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.
Updated.
Updates
java-interop.csprojto SDK style. This is a bit tricky because this is not a C# assembly, it is just hijacking a.csprojand 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
MSBuildsupport when working with SDK style projects the better.The automatic downloading of the
NoTargetspackage didn't work with ourglobalPackagesFolderset to$\..\packages, so that was changed topackages, 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.