-
Notifications
You must be signed in to change notification settings - Fork 747
CoreCLR msbuild (xplat) support. Initial compilable version. #518
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
@dmitriyse can you merge |
2017: <Project Sdk="Microsoft.NET.Sdk"> 2000+: <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> Msbuild and VS uses totally different toolsets for those project types. |
Also I think we need use only xplat in the future. So current build system should become legacy. But some part of time (migration period) both build system should co-exits. So current build system and xplat build system should have the same set of solution configurations. |
@dmitriyse can you point to any Microsoft references for understanding about the migration of build systems? Also have you read this document, which suggests that it is possible to support both runtimes from the same solution? https://docs.microsoft.com/en-us/dotnet/core/porting/project-structure |
P.S. Sorry, but I will create PR only for parts that I use in my commercial projects. I have no free time to support xplat build system for all pythonnet targets. But my contributions contain well-tested in the production solutions, and even if some PR is not complete, it can be merged into the main repo to move work forward. |
Thank you for pointing. I will review this article, probably there is some better solution than in this PR. |
Codecov Report
@@ Coverage Diff @@
## master #518 +/- ##
==========================================
+ Coverage 76.47% 77.34% +0.87%
==========================================
Files 64 65 +1
Lines 5535 5611 +76
Branches 889 889
==========================================
+ Hits 4233 4340 +107
+ Misses 1014 983 -31
Partials 288 288
Continue to review full report at Codecov.
|
Unfortunately, no. I wasn't faced with any one. |
@dmitriyse note that you skipped the first option suggested in that article :) |
This is the revolution way. xbuild and old msbuild (prior to 15.x) will fail to build anything. |
I agree w @denfromufa that I'd rather combine the solution files into a single solution. If this means that contributors will need to use VS2017 to build but otherwise it outputs the same, I'm ok with this. Most windows users likely install from If combining them creates issues for mono, then I'd hold off altogether. My main concern for it is based on the clean-up I did earlier in the year in which we had 3 or 4 different solution files because of multiple upgrades of VS and then those files lingered around for a long time. |
What do you mean ?
We can contain one set of csproj files and one sln file only if we totally move to VS 2017/Xplat build system. (And MonoDevelop users should migrate to JetBrains Project Rider. ) So the choice is between
I prefer option 2) - use two sets of csproj files, because option 3) is a different type of hell with merging with even more required efforts to maintain two sln files (and csproj files). |
NetCoreApp 2.0 offer ability to reference binaries that targets framework 4.6.1 and earlier. I did not try this ability. But in this case existing pythonnet binaries can be referenced to Linux CoreCLR 2.0 projects as is. But even if this magic is really exists, we needs to duplicate all CI builds for CoreCLR 2.0 hosts. |
Off topic. I have a bunch of stability&performance fixes for pythonnet/CoreCLR from the high-load production project (Currently they are contained here https://github.com/dmitriyse/pythonnet/tree/pythonnet-plus). Lacks of official support of CoreCLR stops me from creating pull requests. |
@dmitriyse even if we decide together to split into 2 projects/solutions, still this pull request does not include testing for new set of .NET Core DLLs. Can you please add this? After some more thinking, I might actually incline towards two solutions. The reason is that the current setup.py assumes .NET Framework for Windows, and Mono for other platforms. But we need a new setup.py that uses .NET Core on all platforms. |
Yes, I will try to inject some option in the setup.py to allow build the same output but with xplat build tools and new *.15.csproj + *.15.sln files.
Only with this set of CI builds we can ensure that codebase have no regression. Current PR relates only for new build system. NetStandard 2.0 target should be added by this PR #519 |
@dmitriyse what I meant earlier is due to the fact that Linux users will be building the project alot more often than windows users, so if there's any regressions introduced there because of having a single solution on then I'd rather keep the current solution file. I'm ok with having the dual solutions as long as we add the CI for them and open an issue to eventually merge them back into one but leave a transition period in which we'll have both solution files in existence. On the CI, I'm ok tripling the build time for now so that we test out all configurations. After the PR is merged in, I'll rewrite the CI config to test all PY version on one configuration, and then limit the other configuration to subset of them. |
Eventually we can totally move from mono/msbuild < 15.0 to xplat/msbuild >15,0 and keep all users onboard. Eventually even MonoDevelop/XamarinStudio will obtain xplat/NetCoreApp 2.0 support (The work is in progress http://lastexitcode.com/blog/2016/06/05/AspNetCoreRC2SupportInXamarinStudio). Thank you for acceptance. I will try to find a time soon to improve setup.py as a part of this PR. |
Now it's not the same pull requests :). New tooling requires completely different .sln and csproj files. Netcoreapp 2.0 target covered by anther PR. We needs to ensure that with the same sources and the same build targets new build system works good. This is prerequisite step before Netcoreapp 2.0. Because Netcoreapp2.0 can be build only with CoreCLR tooling. |
@vmuriart, you can create new CI configs with setup.py build_ext --inplace --xplat build command and CoreCLR 2.0 Preview 2.0+ installed. Currently --xplat option implementation is just in very beginning, but it passes package restore and build. |
@dmitriyse i don't see |
looks like hitting this issue with python 3.6: |
I did not figure out that I can change build options just in the PR to perform tests, until it's merged to the master. P.S. |
DEBUG;TRACE fix for the case VS + non empty PYTHONNET_DEFINE_CONSTANTS
…troduced. + Fix for building mono versions under windows.
"""Return full path to one of the Microsoft build tools""" | ||
try: | ||
basePathes = subprocess.check_output( | ||
["vswhere", "-latest", |
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.
@dmitriyse can you change this to tools\vswhere\vswhere.exe
like I did in my pull request #540?
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 added tools\vswhere\vswhere.exe file into the repository instead of chocolatey installation.
See PR #546
_custom_define_constants = False | ||
elif DEVTOOLS == "dotnet": | ||
_xbuild = 'dotnet msbuild' | ||
_config = "{0}Mono".format(CONFIG) |
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.
@dmitriyse why dotnet DEVTOOLS corresponds to Mono _config?
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.
The first problem:
DebugMonoPY3, ReleaseMono, etc. build configuration is a historically names from times where nothing than mono had exists for the linux.
Now it is more correctly to name DebugLinuxPY3, ReleaseLinux, etc.
But we "cannot just rename" build configurations without affecting users.
We should introduce new build configurations (DebugLinuxPY3, ReleaseLinux), give a time to users to migrate to new names, and than remove old names DebugMonoPY3, ReleaseMono, etc.
The second problem:
We cannot use dotnet build command under windows due to DllExport project msbuild targets. We needs to use msbuild >=15 under windows
The result:
DEVTOOLS=dotnet ==> linux (--xplat) === ReleaseLinuxPY3 <== ReleaseMonoPY3
So currently we have DOVTOOLS=dotnet <===> ReleaseMonoPY3
If I am wrong in somewhere in my conclusions, lets improve something.
@dmitriyse you mentioned that you are not using MonoDevelop, how are you testing these 2 solutions on Linux and OSX? Are you using Rider IDE on these platforms? I tested and both solutions look good on Windows in VS 2017, just don't try to open both solutions at the same time :) |
@dmitriyse can you please avoid a lot of duplication in travis.yml in the matrix by using excludes? https://docs.travis-ci.com/user/customizing-the-build/#Excluding-Jobs |
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.
This works for me, denfromufa is right about the matrix thing, but that can easily be added in a new PR. Let's go ahead and merge this first.
@filmor @dmitriyse note that some comments are still not addressed: |
I will "address" those today. Please sorry for delay. |
Answering to the #518 (comment) But fortunately we have a little yaml reference sugar, I will try to apply it. |
I was managed to solve copy-past .travis.yaml problem with help of yaml references Solution is included into #546 |
I tried Project rider 2017.1.2 for the pythonnet.15.sln and...
Probably full support will be added soon. But in general Project rider works great and looks like a very mature tool. P.S. some fix for better usability inside IDEs are added to #546 |
We can advertise full migration to --xplat in the 2.5 release. IDEs already can handle development in any OS. |
…et#518) * Full featured xplat build. * .Net 45 TargetingPack System.XML.dll naming fix. (For xplat linux build). * Setup.py --xplat option refactored. Travis-ci build matrix extended. * AppVeyor matrix extended, xplat build added. * appveyor.yml yaml syntax fix. * NUnit dependency upgraded to 3.7. Changelog improved. * Build order improvement. * Mono builds now can be build on Windows. DEBUG;TRACE fix for the case VS + non empty PYTHONNET_DEFINE_CONSTANTS * PYTHONNET_PY3_VERSION, PYTHONNET_PY2_VERSION build related environment vars introduced. * Small compile fixes. * PYTHONNET_WIN_DEFINE_CONSTANTS and PYTHONNET_MONO_DEFINE_CONSTANTS introduced. + Fix for building mono versions under windows.
What does this implement/fix? Explain your changes.
This is initial step in a long road to add "xplat" build tools support into python.net.
...
Does this close any currently open issues?
Not closes but will helps to solve those:
#96
...
Any other comments?
Or even do everything in the master, because this xplat support should be implemented as side-by-side to the current build system.
Later in the branch coreclr2 we can track master and also allow to build NetStandart 2.0 target.
...
Checklist
Check all those that are applicable and complete.
AUTHORS
CHANGELOG