[mapguide-commits] r9770 - in sandbox/jng/vanilla_swig/Bindings: . src/Bindings/DotNet/Geometry src/Bindings/DotNet/PlatformBase src/IMake src/Managed/DotNet/OSGeo.MapGuide.Web src/Managed/DotNet/OSGeo.MapGuide.Web/custom src/Test/DotNet/src/TestCommon src/Test/DotNet/src/TestCommon/ResourceService src/Test/DotNet/src/TestMapGuideApi src/Test/DotNet/src/TestMapGuideApi/ExternalTests src/Test/DotNet/src/TestMisc src/Test/DotNet/src/TestRunner

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Nov 12 05:03:52 PST 2020


Author: jng
Date: 2020-11-12 05:03:51 -0800 (Thu, 12 Nov 2020)
New Revision: 9770

Added:
   sandbox/jng/vanilla_swig/Bindings/nuget.config
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Web/custom/
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Web/custom/EntryPoint.cs
Modified:
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Geometry/GeometryApiGen.xml
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/PlatformBase/PlatformBaseApiGen.xml
   sandbox/jng/vanilla_swig/Bindings/src/IMake/IMake.cpp
   sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestCommon/ResourceService/Operations.cs
   sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestCommon/TestCommon.csproj
   sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi/ExternalTests/MapTests.cs
   sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi/TestMapGuideApi.csproj
   sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/TestMisc.csproj
   sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner/TestRunner.csproj
Log:
- Fix missing .net properties for Geometry and PlatformBase wrappers
- Add MapGuideApi.MgInitializeWebTier entry point to OSGeo.MapGuide.Web (it simply forwards to the same method on the IM class)
- Update .net test suites to consume the produced nuget packages
- Fix up exception handling to match the new flattened exception model

Added: sandbox/jng/vanilla_swig/Bindings/nuget.config
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/nuget.config	                        (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/nuget.config	2020-11-12 13:03:51 UTC (rev 9770)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <packageSources>
+        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
+        <add key="local" value="packages/DotNet/Release" />
+    </packageSources>
+    <config>
+        <add key="globalPackagesFolder" value="packages/Installed" />
+    </config>
+</configuration>
\ No newline at end of file

Modified: sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Geometry/GeometryApiGen.xml
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Geometry/GeometryApiGen.xml	2020-11-10 13:47:09 UTC (rev 9769)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Geometry/GeometryApiGen.xml	2020-11-12 13:03:51 UTC (rev 9770)
@@ -51,6 +51,7 @@
 -->
 <SwigInline>
   %include "GeometryApi_Doc.i" //doc fragments
+  %include "GeometryApi_Properties.i" //.net property wrappers
   %include "language.i"   //typemaps specific for each language
   // IMPORTANT: Must %import dependencies *after* %include-ing language.i, otherwise
   // SWIG runtime glue code for $LANGUAGE isn't generated

Modified: sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/PlatformBase/PlatformBaseApiGen.xml
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/PlatformBase/PlatformBaseApiGen.xml	2020-11-10 13:47:09 UTC (rev 9769)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/PlatformBase/PlatformBaseApiGen.xml	2020-11-12 13:03:51 UTC (rev 9770)
@@ -52,6 +52,7 @@
 -->
 <SwigInline>
   %include "PlatformBaseApi_Doc.i" //doc fragments
+  %include "PlatformBaseApi_Properties.i" //.net property wrappers
   %include "language.i"   //typemaps specific for each language
   // IMPORTANT: Must %import dependencies *after* %include-ing language.i, otherwise
   // SWIG runtime glue code for $LANGUAGE isn't generated

Modified: sandbox/jng/vanilla_swig/Bindings/src/IMake/IMake.cpp
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/IMake/IMake.cpp	2020-11-10 13:47:09 UTC (rev 9769)
+++ sandbox/jng/vanilla_swig/Bindings/src/IMake/IMake.cpp	2020-11-12 13:03:51 UTC (rev 9770)
@@ -13,7 +13,7 @@
     java
 };
 
-static char version[] = "1.5.1";
+static char version[] = "1.5.2";
 static char EXTERNAL_API_DOCUMENTATION[] = "(NOTE: This API is not officially supported and may be subject to removal in a future release without warning. Use with caution.)";
 
 static string module;
@@ -38,6 +38,8 @@
 static Language language;
 static bool verbose;
 static bool absPaths;
+static bool bLegacyDotNetPropGeneration = true;
+static bool bFirstPropWrite = true;
 
 static set<string> wroteDestructorsFor;
 
@@ -1467,11 +1469,27 @@
                         }
                         else
                         {
+                            if (bFirstPropWrite)
+                            {
+                                if (!bLegacyDotNetPropGeneration)
+                                {
+                                    fprintf(propertyFile, "%%include <attribute.i>\n");
+                                }
+                                bFirstPropWrite = false;
+                            }
+
                             printf("Appending autogen property file %s\n", fname.c_str());
                             if (firstProp) {
-                                //Start SWIG typemap section for this class
-                                fprintf(propertyFile, "//BEGIN - Property typemaps for %s\n", className.c_str());
-                                fprintf(propertyFile, "%%typemap(cscode) %s %%{\n", className.c_str());
+                                if (bLegacyDotNetPropGeneration) 
+                                {
+                                    //Start SWIG typemap section for this class
+                                    fprintf(propertyFile, "//BEGIN - Property typemaps for %s\n", className.c_str());
+                                    fprintf(propertyFile, "%%typemap(cscode) %s %%{\n", className.c_str());
+                                }
+                                else 
+                                {
+                                    fprintf(propertyFile, "//Properties for %s\n", className.c_str());
+                                }
                                 firstProp = false;
                             }
                         }
@@ -1497,14 +1515,38 @@
                         string::size_type pos = propType.find('*');
                         if (string::npos != pos) propType[pos] = ' ';
 
-                        fprintf(propertyFile, "public %s%s %s\n{\n",
-                                        inherited? "new ": "",
-                                        propType.c_str(), propName.c_str());
+                        if (bLegacyDotNetPropGeneration)
+                        {
+                            fprintf(propertyFile, "public %s%s %s\n{\n",
+                                inherited ? "new " : "",
+                                propType.c_str(), propName.c_str());
+
+                            if (setProp) { fprintf(propertyFile, "   set { Set%s(value); }\n", propName.c_str()); }
+                            if (getProp) { fprintf(propertyFile, "   get { return Get%s(); }\n", propName.c_str()); }
+
+                            fprintf(propertyFile, "}\n"); \
+                        }
+                        else
+                        {
+                            if (getProp && setProp) 
+                            {
+                                fprintf(propertyFile, "%%attribute(%s, %s, %s, Get%s, Set%s);\n",
+                                    className.c_str(),
+                                    propType.c_str(),
+                                    propName.c_str(),
+                                    propName.c_str(),
+                                    propName.c_str());
+                            }
+                            else if (getProp)
+                            {
+                                fprintf(propertyFile, "%%attribute(%s, %s, %s, Get%s);\n",
+                                    className.c_str(),
+                                    propType.c_str(),
+                                    propName.c_str(),
+                                    propName.c_str());
+                            }
+                        }
                         
-                        if (setProp) { fprintf(propertyFile, "   set { Set%s(value); }\n", propName.c_str()); }
-                        if (getProp) { fprintf(propertyFile, "   get { return Get%s(); }\n", propName.c_str()); }
-
-                        fprintf(propertyFile, "}\n");\
                     }
                 }
             }
@@ -1549,8 +1591,11 @@
 
     if (NULL != propertyFile)
     {
-        //End SWIG typemap section for class
-        fprintf(propertyFile, "%%} //END - Properties typemap for %s\n", className.c_str());
+        if (bLegacyDotNetPropGeneration)
+        {
+            //End SWIG typemap section for class
+            fprintf(propertyFile, "%%} //END - Properties typemap for %s\n", className.c_str());
+        }
         fclose(propertyFile);
     }
 }

Added: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Web/custom/EntryPoint.cs
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Web/custom/EntryPoint.cs	                        (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Web/custom/EntryPoint.cs	2020-11-12 13:03:51 UTC (rev 9770)
@@ -0,0 +1,41 @@
+//
+//  Copyright (C) 2004-2020 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+namespace OSGeo.MapGuide
+{
+    /// <summary>
+    /// This is the entry point of the MapGuide API
+    /// </summary>
+    public class MapGuideApi
+    {
+        static MapGuideApi()
+        {
+
+        }
+
+        /// <summary>
+        /// Initializes the MapGuide Web Tier APIs. You must call this method before using any other class or method
+        /// in the MapGuide API
+        /// </summary>
+        /// <param name="configFile">The path to the web tier configuration file</param>
+        /// <remarks>Subsequent calls do nothing and return immediately</remarks>
+        public static void MgInitializeWebTier(string configFile)
+        {
+            WebUnmanagedApiPINVOKE.MgInitializeWebTier(configFile);
+        }
+    }
+}
\ No newline at end of file

Modified: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestCommon/ResourceService/Operations.cs
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestCommon/ResourceService/Operations.cs	2020-11-10 13:47:09 UTC (rev 9769)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestCommon/ResourceService/Operations.cs	2020-11-12 13:03:51 UTC (rev 9770)
@@ -261,7 +261,7 @@
                 //
                 //As a workaround, when such bad paths are encountered (that should present themselves as thrown
                 //MgFileNotFoundException objects), return the result that is expected on Windows: An empty result.
-                if (!CommonUtility.IsWindows() && (ex is MgFileNotFoundException)) {
+                if (!CommonUtility.IsWindows() && (ex.GetExceptionCode() == MgExceptionCodes.MgFileNotFoundException)) {
                     return TestResult.FromByteReader(null);
                 } else {
                     return TestResult.FromMgException(ex, param);

Modified: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestCommon/TestCommon.csproj
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestCommon/TestCommon.csproj	2020-11-10 13:47:09 UTC (rev 9769)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestCommon/TestCommon.csproj	2020-11-12 13:03:51 UTC (rev 9770)
@@ -14,5 +14,6 @@
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="Microsoft.Data.SQLite" Version="2.0.1" />
+    <PackageReference Include="OSGeo.MapGuide.PlatformBase" Version="4.0.0" />
   </ItemGroup>
 </Project>
\ No newline at end of file

Modified: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi/ExternalTests/MapTests.cs
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi/ExternalTests/MapTests.cs	2020-11-10 13:47:09 UTC (rev 9769)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi/ExternalTests/MapTests.cs	2020-11-12 13:03:51 UTC (rev 9770)
@@ -72,7 +72,7 @@
 
                 Assert.Fail("Expected MgUnsupportedTileProviderException to be thrown");
             }
-            catch (MgUnsupportedTileProviderException)
+            catch (MgException ex) when (ex.GetExceptionCode() == MgExceptionCodes.MgUnsupportedTileProviderException)
             {
 
             }

Modified: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi/TestMapGuideApi.csproj
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi/TestMapGuideApi.csproj	2020-11-10 13:47:09 UTC (rev 9769)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi/TestMapGuideApi.csproj	2020-11-12 13:03:51 UTC (rev 9770)
@@ -17,5 +17,7 @@
   </ItemGroup>
   <ItemGroup>
     <PackageReference Include="Microsoft.Data.SQLite" Version="2.0.1" />
+    <PackageReference Include="OSGeo.MapGuide.MapGuideCommon" Version="4.0.0" />
+    <PackageReference Include="OSGeo.MapGuide.Web" Version="4.0.0" />
   </ItemGroup>
 </Project>
\ No newline at end of file

Modified: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/TestMisc.csproj
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/TestMisc.csproj	2020-11-10 13:47:09 UTC (rev 9769)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/TestMisc.csproj	2020-11-12 13:03:51 UTC (rev 9770)
@@ -4,7 +4,11 @@
     <OutputType>Exe</OutputType>
     <TargetFramework>netcoreapp2.1</TargetFramework>
   </PropertyGroup>
+
   <ItemGroup>
+    <PackageReference Include="CommandLineParser" Version="2.2.1" />
+    <PackageReference Include="OSGeo.MapGuide.MapGuideCommon" Version="4.0.0" />
+    <PackageReference Include="OSGeo.MapGuide.Web" Version="4.0.0" />
   </ItemGroup>
 
 </Project>

Modified: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner/TestRunner.csproj
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner/TestRunner.csproj	2020-11-10 13:47:09 UTC (rev 9769)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner/TestRunner.csproj	2020-11-12 13:03:51 UTC (rev 9770)
@@ -19,5 +19,6 @@
   </ItemGroup>
   <ItemGroup>
     <PackageReference Include="CommandLineParser" Version="2.2.1" />
+    <PackageReference Include="OSGeo.MapGuide.Web" Version="4.0.0" />
   </ItemGroup>
 </Project>
\ No newline at end of file



More information about the mapguide-commits mailing list