[mapguide-commits] r8375 - in trunk/MgDev: . BuildTools/WebTools/IMake Oem/SWIGEx/Source/Modules
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Oct 1 08:39:33 PDT 2014
Author: jng
Date: 2014-10-01 08:39:33 -0700 (Wed, 01 Oct 2014)
New Revision: 8375
Modified:
trunk/MgDev/
trunk/MgDev/BuildTools/WebTools/IMake/IMake.cpp
trunk/MgDev/Oem/SWIGEx/Source/Modules/csharp.cxx
Log:
Merged revision(s) 8373 from branches/2.6/MgDev:
#2453: Fix API documentation not being transferred to .net exceptions. This updates the following tools:
IMake
- Ensure the "partial" modifier is applied to all .net proxy classes
SWIGEx
- Write out attributes to a separate partial class source file instead of the main class source file. This prevents incorrect ordering of attributes and documentation for classes as they are now specified on the same class, but in separate physical files.
- Write the Serializable attribute using its fully qualified name to avoid having to write namespace import statements on the partial class source file.
........
Property changes on: trunk/MgDev
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365
/sandbox/jng/convenience_apis:8263
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
+ /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/sandbox/jng/convenience_apis:8263
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
Modified: trunk/MgDev/BuildTools/WebTools/IMake/IMake.cpp
===================================================================
--- trunk/MgDev/BuildTools/WebTools/IMake/IMake.cpp 2014-10-01 15:27:31 UTC (rev 8374)
+++ trunk/MgDev/BuildTools/WebTools/IMake/IMake.cpp 2014-10-01 15:39:33 UTC (rev 8375)
@@ -12,7 +12,7 @@
java
};
-static char version[] = "1.2.2";
+static char version[] = "1.2.3";
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;
@@ -1113,7 +1113,7 @@
fprintf(docOutFile, "\n%%typemap(javaclassmodifiers) %s %%{%s public%%}\n", className.c_str(), convertedDoc.c_str());
} else if(language == csharp) {
convertedDoc = doxygenToCsharpDoc(commentStr, true); //EXTERNAL_API only applies to class members, so treat this fragment as PUBLISHED_API
- fprintf(docOutFile, "\n%%typemap(csclassmodifiers) %s %%{%s public%%}\n", className.c_str(), convertedDoc.c_str());
+ fprintf(docOutFile, "\n%%typemap(csclassmodifiers) %s %%{%s public partial%%}\n", className.c_str(), convertedDoc.c_str());
}
}
@@ -1226,6 +1226,16 @@
outputClassDoc(className, commentStr);
commentStr.clear();
classesWithDocs.insert(className);
+ } else if (language == csharp) {
+ //We need to ensure the partial modifier is applied. However since we (ab)use csclassmodifiers to do this, if there's no class documentation
+ //then it won't apply the required partial modifier. So we need to insert some kind of comment string here, so take this opportunity to
+ //note that this class has no documentation.
+ std::string cmnt = "///\n";
+ cmnt += "/// \\brief\n";
+ cmnt += "/// TODO: This class has no class documentation (message inserted by IMake.exe)\n";
+ cmnt += "///";
+ outputClassDoc(className, cmnt);
+ classesWithDocs.insert(className);
}
}
for(int i = begin; i <= end; i++)
Modified: trunk/MgDev/Oem/SWIGEx/Source/Modules/csharp.cxx
===================================================================
--- trunk/MgDev/Oem/SWIGEx/Source/Modules/csharp.cxx 2014-10-01 15:27:31 UTC (rev 8374)
+++ trunk/MgDev/Oem/SWIGEx/Source/Modules/csharp.cxx 2014-10-01 15:39:33 UTC (rev 8375)
@@ -1416,6 +1416,10 @@
"\n",
NIL);
+ // Offload attributes to partial classes so that it doesn't interfere with csclassmodifiers
+ // that could have arbitrary content (ie. Documentation)
+ String *proxy_partial_class_def = NewString("");
+
//Emit namespace if one is specified
if(namespaceName != NULL)
{
@@ -1425,26 +1429,50 @@
"\n",
"{\n",
NIL);
+
+ //Partial class needs to know about this namespace too
+ Printv(proxy_partial_class_def,
+ "namespace ",
+ namespaceName,
+ "\n",
+ "{\n",
+ NIL);
}
- //Add attribute
+ //Add attribute (if any) to partial class definition
if(*Char(attributeTags))
{
- Printv(proxy_class_def,
+ Printv(proxy_partial_class_def,
"[",
attributeTags,
"]\n",
NIL);
}
- //Add serializable attribute
+ //Add serializable attribute (if any) to partial class definition
if(isDeserializable)
{
- Printv(proxy_class_def,
- "[Serializable]\n",
+ Printv(proxy_partial_class_def,
+ "[global::System.Serializable]\n",
NIL);
}
+ //Write remainder of partial class body
+ Printv(proxy_partial_class_def, " partial class ", c_classname, " { }\n", NIL);
+ Printv(proxy_partial_class_def, "}\n", NIL);
+
+ //Write the class body to file
+ String *pfilen = NewStringf("%s%s.partial.cs", SWIG_output_directory(), c_classname);
+ File* f_partial = NewFile(pfilen,"w");
+ if(!f_partial) {
+ Printf(stderr, "Unable to create partial proxy class file: %s\n", pfilen);
+ SWIG_exit(EXIT_FAILURE);
+ }
+ Delete(pfilen); pfilen = NULL;
+ Printv(f_partial, proxy_partial_class_def, NIL);
+ Close(f_partial);
+ Delete(proxy_partial_class_def); proxy_partial_class_def = NULL;
+
Printv(proxy_class_def,
typemapLookup("csclassmodifiers", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers
" class $csclassname", // Class name and bases
More information about the mapguide-commits
mailing list