[mapguide-commits] r9955 - in sandbox/jng/vanilla_swig: . Bindings Bindings/src/Managed/DotNet Bindings/src/Managed/DotNet/MapViewerStub

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Aug 10 08:57:44 PDT 2022


Author: jng
Date: 2022-08-10 08:57:43 -0700 (Wed, 10 Aug 2022)
New Revision: 9955

Added:
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapViewerStub/
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapViewerStub/MapViewerStub.csproj
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapViewerStub/Program.cs
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapViewerStub/README.md
Modified:
   sandbox/jng/vanilla_swig/Bindings/TODO.txt
   sandbox/jng/vanilla_swig/build.bat
   sandbox/jng/vanilla_swig/clean.bat
Log:
- Add new MapViewerStub project whose purpose is to be built against our generated nuget packages and when published, produces a nice list of dlls that we need to copy over to the bin folder of mapviewernet and our .net samples
- Ensure MapViewerStub is published and relevant dlls copied in build.bat
- Update clean.bat to also clean any locally cached MapGuide nuget package directories if they exist


Modified: sandbox/jng/vanilla_swig/Bindings/TODO.txt
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/TODO.txt	2022-08-10 15:12:45 UTC (rev 9954)
+++ sandbox/jng/vanilla_swig/Bindings/TODO.txt	2022-08-10 15:57:43 UTC (rev 9955)
@@ -85,15 +85,14 @@
    - [x] schemareport
    - [x] mapadmin
    - [x] fusion
-   - [ ] mapviewernet
+   - [x] mapviewernet
       - It looks like mapviewernet *can* work with the netstandard2.0 package, but there is some setup work required first
-        - [ ] Create a new stub net48 project that consumes the created nuget packages
-        - [ ] Perform a framework-dependent publish of this project as part of build (do this after the .net bindings are built)
-        - [ ] Tools like buffer are throwing "potentially dangerous Request.Form" errors. Need to find the right setting to apply to revert to legacy behavior.
+        - [x] Create a new stub net48 project that consumes the created nuget packages
+        - [x] Perform a framework-dependent publish of this project as part of build (do this after the .net bindings are built). Copy all the dlls in this published dir to mapviewernet/bin
+        - [x] Tools like buffer are throwing "potentially dangerous Request.Form" errors. Need to find the right setting to apply to revert to legacy behavior.
         - Copy the publish output into the mapviewernet/bin directory on install layout preparation. We expect this to have
            - The OSGeo.* assemblies
            - The supporting native dlls
-           - netstandard.dll
      - If raw .aspx files cannot consume our netstandard2.0 package, retian Oem/SwigEx for the purpose of building "legacy" .net bindings
         - ( ) If this is indeed the case, replace the NMake-based .net projects (that call csc.exe) with SDK-style csproj files that target net48
    - [x] MapGuide Developer's Guide

Index: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapViewerStub
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapViewerStub	2022-08-10 15:12:45 UTC (rev 9954)
+++ sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapViewerStub	2022-08-10 15:57:43 UTC (rev 9955)

Property changes on: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapViewerStub
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,2 ##
+bin
+obj
Added: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapViewerStub/MapViewerStub.csproj
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapViewerStub/MapViewerStub.csproj	                        (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapViewerStub/MapViewerStub.csproj	2022-08-10 15:57:43 UTC (rev 9955)
@@ -0,0 +1,24 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net48</TargetFramework>
+    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
+  </PropertyGroup>
+
+  <!-- 
+  The MapGuide build system will write the following XML fragment below.
+
+  DO NOT COMMIT this change
+   -->
+  <!--    
+  <ItemGroup>
+    <PackageReference Include="OSGeo.MapGuide.Foundation" Version="4.0.0" />
+    <PackageReference Include="OSGeo.MapGuide.Geometry" Version="4.0.0" />
+    <PackageReference Include="OSGeo.MapGuide.MapGuideCommon" Version="4.0.0" />
+    <PackageReference Include="OSGeo.MapGuide.PlatformBase" Version="4.0.0" />
+    <PackageReference Include="OSGeo.MapGuide.Web" Version="4.0.0" />
+  </ItemGroup>
+  -->
+  
+</Project>

Added: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapViewerStub/Program.cs
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapViewerStub/Program.cs	                        (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapViewerStub/Program.cs	2022-08-10 15:57:43 UTC (rev 9955)
@@ -0,0 +1,21 @@
+using OSGeo.MapGuide;
+
+namespace MapViewerStub
+{
+    public class Program
+    {
+        public static void Main()
+        {
+            // Foundation
+            var sc = new MgStringCollection();
+            // Geometry
+            var csf = new MgCoordinateSystemFactory();
+            // PlatformBase
+            var fs = new MgFeatureSchema();
+            // MapGuideCommon
+            var scn = new MgSiteConnection();
+            // Web
+            var hr = new MgHttpRequest("");
+        }
+    }
+}
\ No newline at end of file

Added: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapViewerStub/README.md
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapViewerStub/README.md	                        (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapViewerStub/README.md	2022-08-10 15:57:43 UTC (rev 9955)
@@ -0,0 +1,5 @@
+# About MapViewerStub
+
+This purpose of this project is to produce any easy-to-copy list of all the MapGuide .net assemblies along with their native dependencies. This list of dlls will be copied to mapviewernet\bin as part of installation layout preparation.
+
+Refer to `build.bat` in the repository root to see how this project is being used
\ No newline at end of file

Modified: sandbox/jng/vanilla_swig/build.bat
===================================================================
--- sandbox/jng/vanilla_swig/build.bat	2022-08-10 15:12:45 UTC (rev 9954)
+++ sandbox/jng/vanilla_swig/build.bat	2022-08-10 15:57:43 UTC (rev 9955)
@@ -1,4 +1,4 @@
- at echo off
+ at echo on
 rem MapGuide build script for windows
 rem
 rem Author: Jackie Ng (jumpinjackie at gmail.com)
@@ -356,8 +356,6 @@
 %XCOPY_SINGLE% "%MG_WEB_BIN%\%TYPEBUILD%\*.dll" "%MG_OUTPUT_WEB%\Php\ext"
 echo [install]: Web Tier - mapviewernet
 %XCOPY% "%MG_WEB_SRC%\mapviewernet" "%MG_OUTPUT_WEB%\www\mapviewernet"
-echo [install]: Web Tier - mapviewernet - MapGuide API unmanaged binaries
-%XCOPY_SINGLE% "%MG_WEB_BIN%\%TYPEBUILD%\*.dll" "%MG_OUTPUT_WEB%\www\mapviewernet\bin"
 echo [install]: Web Tier - mapviewerjava
 %XCOPY% "%MG_WEB_SRC%\mapviewerjava" "%MG_OUTPUT_WEB%\www\mapviewerjava"
 echo [install]: Web Tier - mapviewerjava - WEB-INF
@@ -368,9 +366,33 @@
 %XCOPY_SINGLE% "%CD%\packages\Java\%CONFIGURATION%\x64\*.jar" "%MG_OUTPUT_WEB%\www\WEB-INF\lib"
 %XCOPY_SINGLE% "%CD%\packages\Java\%CONFIGURATION%\x64\*.dll" "%MG_OUTPUT_WEB%\Tomcat\bin"
 echo [install]: Web Tier - .net Bindings
-%XCOPY% "%CD%\packages\DotNet\%CONFIGURATION%\netstandard2.0" "%MG_OUTPUT_WEB%\www\mapviewernet\bin"
+SET MG_NUGET_PKG_DIR=%CD%\packages\DotNet\%CONFIGURATION%
+SET MG_ASSEMBLIES_DIR=%CD%\Bindings\src\Managed\DotNet\MapViewerStub\bin\%PLATFORM_CLR%\%CONFIGURATION%\net48\win-x64\publish
+REM We need the full .net assembly set and its native dependencies for mapviewernet
+REM To easily produce this list for copying to mapviewernet, we will do a framework-dependent
+REM publish of MapViewerStub for this very purpose
+REM
+REM Before we begin, do a sanity check: Our source nuget package dir should have the built nuget packages
+echo [install]: Sanity checking that nuget packages have been built and exist in the expected directory
+if not exist "%MG_NUGET_PKG_DIR%\*.nupkg" (
+    echo [error]: No NuGet packages found in expected directory. Building the bindings should have put nuget packages in here.
+    exit /B 1
+)
+REM Now do the publish
+pushd "%CD%\Bindings\src\Managed\DotNet\MapViewerStub"
+dotnet add package OSGeo.MapGuide.Foundation -s "%MG_NUGET_PKG_DIR%"
+dotnet add package OSGeo.MapGuide.Geometry -s "%MG_NUGET_PKG_DIR%"
+dotnet add package OSGeo.MapGuide.PlatformBase -s "%MG_NUGET_PKG_DIR%"
+dotnet add package OSGeo.MapGuide.MapGuideCommon -s "%MG_NUGET_PKG_DIR%"
+dotnet add package OSGeo.MapGuide.Web -s "%MG_NUGET_PKG_DIR%"
+dotnet publish --configuration %CONFIGURATION%
+popd
+REM The publish output dir should now have the full MapGuide .net assemblies and their native dependencies.
+REM Copy them all to the destination mapviewernet bin directory
+echo [install]: Copying full dll list to mapviewernet
+%XCOPY_SINGLE% "%MG_ASSEMBLIES_DIR%\*.dll" "%MG_OUTPUT_WEB%\www\mapviewernet\bin"
 if not exist "%MG_OUTPUT_WEB%\nuget" mkdir "%MG_OUTPUT_WEB%\nuget"
-copy /Y "%CD%\packages\DotNet\%CONFIGURATION%\*.nupkg" "%MG_OUTPUT_WEB%\nuget"
+%XCOPY_SINGLE% "%CD%\packages\DotNet\%CONFIGURATION%\*.nupkg" "%MG_OUTPUT_WEB%\nuget"
 REM Required for Web Tier unit tests
 echo [build]: Web Tier - Clean fusion
 call %ANT% clean -f "%MG_OEM%\fusion\build.xml"
@@ -422,8 +444,8 @@
 echo [install]: Viewer API documentation
 %XCOPY% "%MG_DOC%\viewerapi" "%MG_OUTPUT_WEB%\www\help\viewerapi"
 echo [install]: Copy dlls into .net samples
-%XCOPY% "%MG_OUTPUT_WEB%\www\mapviewernet\bin\*.dll" "%MG_OUTPUT_WEB%\www\dotnetsamples\bin"
-%XCOPY% "%MG_OUTPUT_WEB%\www\mapviewernet\bin\*.dll" "%MG_OUTPUT_WEB%\www\dotnetviewersample\bin"
+%XCOPY_SINGLE% "%MG_ASSEMBLIES_DIR%\*.dll" "%MG_OUTPUT_WEB%\www\dotnetsamples\bin"
+%XCOPY_SINGLE% "%MG_ASSEMBLIES_DIR%\*.dll" "%MG_OUTPUT_WEB%\www\dotnetviewersample\bin"
 if not exist "%MG_DEV%\UnitTest\TestData\Samples\Sheboygan\Sheboygan.mgp" (
     echo [build]: Sheboygan Sample data set
     pushd %MG_DEV%\UnitTest\TestData\Samples\Sheboygan

Modified: sandbox/jng/vanilla_swig/clean.bat
===================================================================
--- sandbox/jng/vanilla_swig/clean.bat	2022-08-10 15:12:45 UTC (rev 9954)
+++ sandbox/jng/vanilla_swig/clean.bat	2022-08-10 15:57:43 UTC (rev 9955)
@@ -12,6 +12,13 @@
 if exist packages\DotNet rd /S /Q packages\DotNet
 if exist packages\Java rd /S /Q packages\Java
 if exist packages\Php rd /S /Q packages\Php
+REM If these exist, it may trip up the publishing of MapViewerStub because these may be stale, we always
+REM want to build MapViewerStub from freshly installed .nupkg files and never from this cached location
+if exist packages\Installed\osgeo.mapguide.foundation rd /S /Q packages\Installed\osgeo.mapguide.foundation
+if exist packages\Installed\osgeo.mapguide.geometry rd /S /Q packages\Installed\osgeo.mapguide.geometry
+if exist packages\Installed\osgeo.mapguide.mapguidecommon rd /S /Q packages\Installed\osgeo.mapguide.mapguidecommon
+if exist packages\Installed\osgeo.mapguide.platformbase rd /S /Q packages\Installed\osgeo.mapguide.platformbase
+if exist packages\Installed\osgeo.mapguide.web rd /S /Q packages\Installed\osgeo.mapguide.web
 echo [clean]: Common
 if exist Common\bin rd /S /Q Common\bin
 if exist Common\lib rd /S /Q Common\lib



More information about the mapguide-commits mailing list