[mapguide-commits] r8824 - in sandbox/jng/aspnet50: Oem/SWIGEx/Lib/csharp Web/src/MapGuideDotNetCoreApi Web/src/MapGuideDotNetCoreApi/Custom
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Nov 10 06:48:53 PST 2015
Author: jng
Date: 2015-11-10 06:48:53 -0800 (Tue, 10 Nov 2015)
New Revision: 8824
Modified:
sandbox/jng/aspnet50/Oem/SWIGEx/Lib/csharp/csharphead.swg
sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/Custom/DnxCoreShims.cs
sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/Custom/EntryPoint.cs
sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/project.json
Log:
Update to use the new target framework moniker for .net core (dotnet5.4). Add also the theoretical native library loading code for the MapGuideApi entry point. This code is theoretical as we will have to wait for the stable RC1 of CoreCLR/DNX in order to be able to actually test this. This code does not and cannot run on a 1.0.0-beta8 CoreCLR/DNX, which is the current stable release as of this commit.
Modified: sandbox/jng/aspnet50/Oem/SWIGEx/Lib/csharp/csharphead.swg
===================================================================
--- sandbox/jng/aspnet50/Oem/SWIGEx/Lib/csharp/csharphead.swg 2015-11-08 18:05:13 UTC (rev 8823)
+++ sandbox/jng/aspnet50/Oem/SWIGEx/Lib/csharp/csharphead.swg 2015-11-10 14:48:53 UTC (rev 8824)
@@ -60,7 +60,7 @@
//NOTE: For .net Core, this will be one monolithic assembly (due to lack of AppDomain class) so no
//need to probe type information from other loaded assemblies, it should all be there and populated
//by the SWIG-generated code
- #if !DNXCORE50
+ #if !DNXCORE50 && !DOTNET5_4
if(type == null)
{
// Find the specified class in the pre-defined assemblies
@@ -102,7 +102,7 @@
static SWIGExceptionHelper() {
SWIGRegisterCustomExceptionCallbacks_$module(customExceptionDelegate);
assemblyNameMap = new System.Collections.Generic.Dictionary<string, string>();
- #if DNXCORE50
+ #if DNXCORE50 || DOTNET5_4
assemblyNameMap["OSGeo.MapGuide"] = "OSGeo.MapGuide";
#else
assemblyNameMap["OSGeo.MapGuide.Foundation"] = "OSGeo.MapGuide.Foundation";
@@ -165,7 +165,7 @@
classMap = new System.Collections.Generic.Dictionary<int, Type>();
classNameMap = new System.Collections.Generic.Dictionary<int, string>();
assemblyNameMap = new System.Collections.Generic.Dictionary<string, string>();
- #if DNXCORE50
+ #if DNXCORE50 || DOTNET5_4
assemblyNameMap["OSGeo.MapGuide"] = "OSGeo.MapGuide";
#else
assemblyNameMap["OSGeo.MapGuide.Foundation"] = "OSGeo.MapGuide.Foundation";
@@ -185,7 +185,7 @@
//NOTE: For .net Core, this will be one monolithic assembly (due to lack of AppDomain class) so no
//need to probe type information from other loaded assemblies, it should all be there and populated
//by the SWIG-generated code
- #if !DNXCORE50
+ #if !DNXCORE50 && !DOTNET5_4
if (type == null)
{
String className = null;
Modified: sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/Custom/DnxCoreShims.cs
===================================================================
--- sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/Custom/DnxCoreShims.cs 2015-11-08 18:05:13 UTC (rev 8823)
+++ sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/Custom/DnxCoreShims.cs 2015-11-10 14:48:53 UTC (rev 8824)
@@ -17,7 +17,7 @@
namespace System
{
- #if DNXCORE50
+ #if DOTNET5_4 || DNXCORE50
public class SystemException : Exception
{
public SystemException() : base() { }
Modified: sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/Custom/EntryPoint.cs
===================================================================
--- sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/Custom/EntryPoint.cs 2015-11-08 18:05:13 UTC (rev 8823)
+++ sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/Custom/EntryPoint.cs 2015-11-10 14:48:53 UTC (rev 8824)
@@ -14,6 +14,10 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
+using System;
+using System.IO;
+using System.Reflection;
+using Microsoft.Extensions.PlatformAbstractions;
namespace OSGeo.MapGuide
{
@@ -22,6 +26,24 @@
/// </summary>
public class MapGuideApi
{
+ static MapGuideApi()
+ {
+ var plat = PlatformServices.Default;
+ if (plat != null)
+ {
+ var lib = plat.LibraryManager.GetLibrary("MapGuideDotNetCoreApi");
+ var asmContext = plat.AssemblyLoadContextAccessor?.Default;
+ if (asmContext != null)
+ {
+ var arch = IntPtr.Size == 4 ? "x86" : "x64";
+ var libName = "MapGuideDotNetCoreUnmanagedApi";
+ var libPath = Path.Combine(lib.Path, $"../../runtimes/win-{arch}/native/{libName}.dll");
+
+ asmContext.LoadUnmanagedLibraryFromPath(libPath);
+ }
+ }
+ }
+
/// <summary>
/// Initializes the MapGuide Web Tier APIs. You must call this method before using any other class or method
/// in the MapGuide API
Modified: sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/project.json
===================================================================
--- sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/project.json 2015-11-08 18:05:13 UTC (rev 8823)
+++ sandbox/jng/aspnet50/Web/src/MapGuideDotNetCoreApi/project.json 2015-11-10 14:48:53 UTC (rev 8824)
@@ -1,4 +1,4 @@
-{
+{
"version": "3.1.0-*",
"description": "MapGuide API for .net Core",
"authors": [ "OSGeo" ],
@@ -19,15 +19,16 @@
}
},
"frameworks": {
- "dnxcore50": {
+ "dotnet5.4": {
"dependencies": {
- "Microsoft.CSharp": "4.0.1-beta-23225",
- "System.Collections": "4.0.11-beta-23225",
- "System.Linq": "4.0.1-beta-23225",
- "System.Runtime": "4.0.21-beta-23225",
- "System.Threading": "4.0.11-beta-23225",
- "System.Runtime.Extensions": "4.0.11-beta-23225",
- "System.Runtime.InteropServices": "4.0.21-beta-23225"
+ "Microsoft.CSharp": "4.0.1-beta-23409",
+ "System.Collections": "4.0.11-beta-23409",
+ "System.Linq": "4.0.1-beta-23409",
+ "System.Runtime": "4.0.21-beta-23409",
+ "System.Threading": "4.0.11-beta-23409",
+ "System.Runtime.Extensions": "4.0.11-beta-23409",
+ "System.Runtime.InteropServices": "4.0.21-beta-23409",
+ "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16127"
}
}
},
More information about the mapguide-commits
mailing list