Changes between Initial Version and Version 1 of MapGuideRfc154


Ignore:
Timestamp:
Nov 30, 2015, 8:27:03 AM (8 years ago)
Author:
jng
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MapGuideRfc154

    v1 v1  
     1= !MapGuide RFC 154 - .net Core support =
     2
     3This page contains a change request (RFC) for the !MapGuide Open Source project.
     4More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page.
     5
     6== Status ==
     7
     8||RFC Template Version||(1.0)||
     9||Submission Date||1 Dec 2015||
     10||Last Modified||1 Dec 2015||
     11||Author||Jackie Ng||
     12||RFC Status||draft||
     13||Implementation Status||||
     14||Proposed Milestone||3.1||
     15||Assigned PSC guide(s)||(when determined)||
     16||'''Voting History'''||(vote date)||
     17||+1||||
     18||+0||||
     19||-0||||
     20||-1||||
     21||no vote|| ||
     22
     23== Overview ==
     24
     25This RFC proposes to add a MapGuide API wrapper that supports .net Core
     26
     27== Motivation ==
     28
     29The next version of ASP.net is multi platform. Our current .net wrapper is windows-only and will not work in this new cross platform world.
     30
     31Such support in this new cross-platform .net requires a new wrapper that can target it
     32
     33== Proposed Solution ==
     34
     35We'll add a new MapGuideDotNetCoreApi project to the WebTier solution. This will use the SWIG configuration that was for the .net API before the assembly split (RFC68), a single monolithic glue dll and .net assembly. The current split assembly configuration is not possible due to use of reflection APIs that do not exist in the .net core API surface.
     36
     37MapGuideDotNetCoreApi will also have a Linux target for building this glue library
     38
     39For the .net core wrapper assembly, it will be built using the DNX/project.json system
     40
     41=== Build strategy ===
     42
     43In the .net Core world, the final build artifact and unit of distribution is not an assembly (or set of assemblies), but a NuGet package.
     44
     45For the simplest packaging and deployment story, our .net wrapper should exist as a single NuGet package that bundles all the necessary unmanaged libraries for all the platforms we intend to support:
     46
     47 * Windows (x86)
     48 * Windows (x64)
     49 * Linux (x86)
     50 * Linux (x64)
     51
     52Supporting a true cross-platform .net wrapper presents a unique build challenge in that it is difficult to have all unmanaged/glue libraries for Windows and Linux present in a single build run.
     53
     54Based on [http://blog.3d-logic.com/2015/11/10/using-native-libraries-in-asp-net-5/ current guidance], it is suggested for Linux that the necessary glue libraries should be assumed to be already present on the system, so nothing is bundled into the nuget package for Linux in this respect.
     55
     56The build strategy for this wrapper therefore is as follows:
     57
     58 * Build MapGuide for Windows (x86|x64) as normal
     59 * As part of each windows build, collect and archive the necessary artifacts (the SWIG-generated wrapper source and the unmanaged/glue libraries) needed for the .net wrapper to function
     60 * Store/upload these archived artifacts to a staging area
     61
     62Then the build process for the wrapper itself is:
     63 
     64 * Download/extract the various archives into their respective /runtimes/$PLATFORM/native subdirectory. Such directories will be included in the final nuget package.
     65 * dnvm use [latest version] -r coreclr
     66 * dnu pack --configuration Release
     67
     68On Windows, we will be bundling the full set of unmanaged libraries (the SWIG glue library and its dependencies). DNX can recognize and load the correct unmanaged libraries from the /runtimes/$PLATFORM/native subdirectory of the nuget package.
     69
     70On Linux, the SWIG glue library itself as the other dependencies are assumed to reside in a well-known location (/usr/local/mapguideopensource-3.1.0/webserverextensions/lib), which an can be appended to LD_LIBRARY_PATH before running your MapGuide application with DNX.
     71
     72=== .net - Native String Marshaling on Linux ===
     73
     74MapGuide uses std::wstring/wchar_t for all of its APIs that accept and return strings. wchar_t has a different size on Linux than it does on Windows, meaning the strings that travel across the .net - native boundary will turn into garbage due to the size difference of wchar_t. To rectify this, the SWIG typemaps for .net core will use the same string conversion logic as the SWIG typemaps for Java, using the UnicodeString helper class in the MdfModel library to:
     75
     76 * Convert UTF-16 input strings from .net into UTF-32 wide strings for the wrapped API call
     77 * Convert UTF-32 wide strings from a wrapped API call into UTF-16 strings for returning to .net
     78
     79== Implications ==
     80
     81This API wrapper will be an out-of-band package. It will not be included with the Windows/Linux installer packages. The delivery channel is strictly NuGet. Like our current NuGet packages, the developer is expected to use the same matching version of the NuGet package for the particular version of MapGuide they wish to target.
     82
     83Although .net Core also supports Mac OSX and FreeBSD, our .net wrapper does not and is not supported on these platforms.
     84
     85This RFC only affects ASP.net 5 under the CoreCLR profile. ASP.net 5 under the full .net Framework can use the existing NuGet package offerings.
     86
     87The canonical deployment strategy of ASP.net 5 applications is to host it on the [https://github.com/aspnet/KestrelHttpServer Kestrel HTTP server] and reverse-proxy to it from the front-facing web server:
     88
     89 * On Windows, this is IIS with the HttpPlatformHandler extension
     90 * On Linux, this is any http server with reverse proxying capabilities. Although the official documentation recommends nginx as the front-facing server, our deployment story on Linux will be using the bundled Apache httpd server with mod_proxy to reverse proxy into Kestrel.
     91
     92For Linux, the usage and availability of the MapGuide API for .net core will be restricted to any Linux distribution where binaries exist for the CoreCLR. Currently, this is only Ubuntu 14.04 64-bit, which is the version of Ubuntu we intend to support for this release of MapGuide. CoreCLR is not available for Ubuntu 14.04 32-bit.
     93
     94== Test Plan ==
     95
     96We'll port the existing .net web tier test suite over to CoreCLR/DNX and verify the full test suite passes on both Windows and Linux
     97
     98== Funding / Resources ==
     99
     100Community