[mdoc-update] Generate //AssemblyPublicKey && //AssemblyCulture in index.xml.
authorJonathan Pryor <jonpryor@vt.edu>
Mon, 30 Aug 2010 17:47:44 +0000 (13:47 -0400)
committerJonathan Pryor <jonpryor@vt.edu>
Tue, 31 Aug 2010 18:51:41 +0000 (14:51 -0400)
This is so that `mdoc update-ecma-xml` can use this information when
generating the /Library/Types/Type elements, as //AssemblyPublicKey and
//AssemblyCulture are currently missing from `mdoc update-ecma-xml` output.

mcs/tools/mdoc/Mono.Documentation/monodocer.cs
mcs/tools/mdoc/Resources/monodoc-ecma.xsd

index 767a3aa3aa2bb37ae3acdd9d4383acc73e61ac50..dde1efa74eb6408a765a3cb902869d6828a0ea10 100644 (file)
@@ -456,6 +456,23 @@ class MDocUpdater : MDocCommand
                XmlElement index_assembly = parent.OwnerDocument.CreateElement("Assembly");
                index_assembly.SetAttribute ("Name", assembly.Name.Name);
                index_assembly.SetAttribute ("Version", assembly.Name.Version.ToString());
+
+               AssemblyNameDefinition name = assembly.Name;
+               if (name.HasPublicKey) {
+                       XmlElement pubkey = parent.OwnerDocument.CreateElement ("AssemblyPublicKey");
+                       var key = new StringBuilder (name.PublicKey.Length*3 + 2);
+                       key.Append ("[");
+                       foreach (byte b in name.PublicKey)
+                               key.AppendFormat ("{0,2:x2} ", b);
+                       key.Append ("]");
+                       pubkey.InnerText = key.ToString ();
+                       index_assembly.AppendChild (pubkey);
+               }
+
+               XmlElement culture = parent.OwnerDocument.CreateElement ("AssemblyCulture");
+               culture.InnerText = string.IsNullOrEmpty (name.Culture) ? "neutral" : name.Culture;
+               index_assembly.AppendChild (culture);
+
                MakeAttributes (index_assembly, assembly.CustomAttributes, 0);
                parent.AppendChild(index_assembly);
        }
index 6fa76084fd4639625050bf38075af339dabf5a41..af19228b1cd0b09801a4fd5028827a2136980607 100644 (file)
@@ -904,6 +904,8 @@ add masterdoc support?
   <xs:element name="Assembly">
     <xs:complexType>
       <xs:choice minOccurs="0" maxOccurs="unbounded">
+        <xs:element ref="AssemblyPublicKey" />
+        <xs:element ref="AssemblyCulture" />
         <xs:element ref="Attributes" />
       </xs:choice>
       <xs:attribute ref="Name" />