diff --git a/mdoc/Consts.cs b/mdoc/Consts.cs index e0b10fceb..7d64b319e 100644 --- a/mdoc/Consts.cs +++ b/mdoc/Consts.cs @@ -3,7 +3,7 @@ namespace Mono.Documentation { public static class Consts { - public static string MonoVersion = "5.8.9.1"; + public static string MonoVersion = "5.8.9.2"; public const string DocId = "DocId"; public const string CppCli = "C++ CLI"; public const string CppCx = "C++ CX"; diff --git a/mdoc/Mono.Documentation/MDocUpdater.cs b/mdoc/Mono.Documentation/MDocUpdater.cs index 8b858eddd..269e36eac 100644 --- a/mdoc/Mono.Documentation/MDocUpdater.cs +++ b/mdoc/Mono.Documentation/MDocUpdater.cs @@ -988,7 +988,7 @@ private void AddIndexAssembly (AssemblyDefinition assembly, XmlElement parent, F AssemblyNameDefinition name = assembly.Name; if (name.HasPublicKey) { - XmlElement pubkey = parent.OwnerDocument.CreateElement ("AssemblyPublicKey"); + XmlElement pubkey = WriteElement (index_assembly, "AssemblyPublicKey"); var key = new StringBuilder (name.PublicKey.Length * 3 + 2); key.Append ("["); foreach (byte b in name.PublicKey) @@ -1000,7 +1000,7 @@ private void AddIndexAssembly (AssemblyDefinition assembly, XmlElement parent, F if (!string.IsNullOrEmpty (name.Culture)) { - XmlElement culture = parent.OwnerDocument.CreateElement ("AssemblyCulture"); + XmlElement culture = WriteElement (index_assembly, "AssemblyCulture"); culture.InnerText = name.Culture; index_assembly.AppendChild (culture); } diff --git a/mdoc/Mono.Documentation/Updater/DocumentationEnumerator.cs b/mdoc/Mono.Documentation/Updater/DocumentationEnumerator.cs index 3b710a98e..abe87e2ca 100644 --- a/mdoc/Mono.Documentation/Updater/DocumentationEnumerator.cs +++ b/mdoc/Mono.Documentation/Updater/DocumentationEnumerator.cs @@ -256,8 +256,8 @@ private static IEnumerable GetReflectionMembersCore (TypeDefini // 1. "Normal" (non-generic) member names: GetEnumerator // - Lookup as-is. // 2. Explicitly-implemented interface member names: System.Collections.IEnumerable.Current - // - try as-is, and try type.member (due to "kludge" for property - // support. + // - try as-is, try global::namespace.type.member, and try + // type.member (due to "kludge" for property support. // 3. "Normal" Generic member names: Sort (CSC) // - need to remove generic parameters --> "Sort" // 4. Explicitly-implemented interface members for generic interfaces: @@ -294,6 +294,13 @@ private static IEnumerable GetReflectionMembersCore (TypeDefini }; + // An explicitly-implemented interface member may have been updated to use a global alias. + foreach (MemberReference mi in type.GetMembers ($"global::{docName}")) + { + memberCount++; + yield return mi; + } + // might be a property; try only type.member instead of // namespace.type.member. var typeMember = DocUtils.GetTypeDotMember (docName); diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs index 976d1b64f..39fc085b8 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Runtime.Remoting.Contexts; using System.Text; using Mono.Cecil; diff --git a/mdoc/Mono.Documentation/Updater/XmlSyncer.cs b/mdoc/Mono.Documentation/Updater/XmlSyncer.cs deleted file mode 100644 index dda4cd0e2..000000000 --- a/mdoc/Mono.Documentation/Updater/XmlSyncer.cs +++ /dev/null @@ -1,269 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Xml; -using Mono.Cecil; -using Mono.Documentation.Updater.Frameworks; - -namespace Mono.Documentation.Updater -{ - public static class XmlSyncer - { - public static void MakeParameters (XmlElement root, MemberReference member, IList parameters, FrameworkTypeEntry typeEntry, ref bool fxAlternateTriggered) - { - XmlElement e = DocUtils.WriteElement (root, "Parameters"); - - /// addParameter does the work of adding the actual parameter to the XML - Action addParameter = (ParameterDefinition param, XmlElement nextTo, string paramType, int index, bool addIndex, string fx, bool addfx) => - { - var pe = root.OwnerDocument.CreateElement ("Parameter"); - - if (nextTo == null) - e.AppendChild (pe); - else - e.InsertAfter (pe, nextTo); - - pe.SetAttribute ("Name", param.Name); - pe.SetAttribute ("Type", paramType); - if (param.ParameterType is ByReferenceType) - { - if (param.IsOut) - pe.SetAttribute ("RefType", "out"); - else - pe.SetAttribute ("RefType", "ref"); - } - if (addIndex) - pe.SetAttribute ("Index", index.ToString ()); - if (addfx) - pe.SetAttribute (Consts.FrameworkAlternate, fx); - - MakeAttributes (pe, GetCustomAttributes (param.CustomAttributes, "")); - }; - - /// addFXAttributes, adds the index attribute to all existing elements. - /// Used when we first detect the scenario which requires this. - Action addFXAttributes = nodes => - { - var i = 0; - foreach (var node in nodes.Cast ()) - { - node.SetAttribute ("Index", i.ToString ()); - i++; - } - }; - - int parameterIndex = 0; - int parameterIndexOffset = 0; - - var paramNodes = e.GetElementsByTagName ("Parameter"); - bool inFXMode = frameworksCache.Frameworks.Count () > 1; - - foreach (ParameterDefinition p in parameters) - { - var ptype = GetDocParameterType (p.ParameterType); - if (parameterIndex >= paramNodes.Count) - { - // this parameter hasn't been added yet - bool hasParameterName = string.IsNullOrWhiteSpace (p.Name); - addParameter (p, null, ptype, parameterIndex, false, "", false); - } - else // there's enough nodes, see if it truly exists - { - //look for < parameter > that matches position - XmlElement parameterNode = e.ChildNodes[parameterIndex + parameterIndexOffset] as XmlElement; - - - if (parameterNode != null) - { - //Assert Type Matches (if not, throw?) - if (parameterNode.HasAttribute ("Name") && parameterNode.Attributes["Name"].Value == p.Name) - { - // we're good, continue on. - } - else - { // name doesn't match - if (parameterNode.HasAttribute ("Index")) - { - // TODO: add a FrameworkAlternate check, and set offset correctly - int pindex; - if (int.TryParse (parameterNode.GetAttribute ("Index"), out pindex) && pindex < parameterIndex) - { - parameterIndexOffset++; - - continue; - } - } - else - { - if (!inFXMode) throw new Exception ("shit"); - addFXAttributes (paramNodes); - //-find type in previous frameworks - - - string fxList = FXUtils.PreviouslyProcessedFXString (typeEntry); - - //-find < parameter where index = currentIndex > - var currentNode = paramNodes[parameterIndex] as XmlElement; - currentNode.SetAttribute (Consts.FrameworkAlternate, fxList); - - addParameter (p, parameterNode, ptype, parameterIndex - parameterIndexOffset, true, typeEntry.Framework.Name, true); - parameterIndexOffset++; - fxAlternateTriggered = true; - } - } - - } - else - { // no element at this index - // TODO: does this ever happen? - throw new Exception ("This wasn't supposed to happen"); - //addParameter (p); - } - /* - - If found - - Assert Type Matches (if not, throw?) - -If Name Matches … - - if “FrameworkAlternate” - -Add typeEntry.Framework.Name to list - - done! - -Else (exists, but name doesn’t match … FrameworkAlternate path) - - check if inFXMode if not, throw - -AddFXParameters - - adds Index to all existing - -Add FrameworkAlternate = allPreviousFrameworks and Index = currentIndex - - Add new node with Index = currentIndex - - else not found - -add - */ - } - parameterIndex++; - } - //-purge `typeEntry.Framework` from any that - // has FrameworkAlternate, and “name” doesn’t match any - // `parameters` - var alternates = paramNodes - .Cast () - .Select (p => new - { - Element = p, - Name = p.GetAttribute ("Name"), - FrameworkAlternate = p.GetAttribute (Consts.FrameworkAlternate) - }) - .Where (p => - !string.IsNullOrWhiteSpace (p.FrameworkAlternate) && - p.FrameworkAlternate.Contains (typeEntry.Framework.Name) && - !parameters.Any (param => param.Name == p.Name)) - .ToArray (); - if (alternates.Any ()) - { - foreach (var a in alternates) - { - string newValue = FXUtils.RemoveFXFromList (a.FrameworkAlternate, typeEntry.Framework.Name); - if (string.IsNullOrWhiteSpace (newValue)) - { - a.Element.RemoveAttribute (Consts.FrameworkAlternate); - } - else - { - a.Element.SetAttribute (Consts.FrameworkAlternate, newValue); - } - } - } - - return; - /* - // old code - foreach (ParameterDefinition p in parameters) - { - XmlElement pe; - - // param info - var ptype = GetDocParameterType (p.ParameterType); - var newPType = ptype; - - if (MDocUpdater.SwitchingToMagicTypes) - { - newPType = NativeTypeManager.ConvertFromNativeType (ptype); - } - - // now find the existing node, if it's there so we can reuse it. - var nodes = root.SelectSingleNode ("Parameters").SelectNodes ("Parameter") - .Cast ().Where (x => x.GetAttribute ("Name") == p.Name) - .ToArray (); - - // FYI: Exists? No? - if (nodes.Count () == 0) - { - // TODO: instead of this. Needs to be replaced with a better - // check for Parameter index ... should I add parameter index? - - // are we in frameworks mode? - // add Index to all existing parameter nodes if they don't have them - // match existing to position and type - bool _inFXMode = typeEntry.Framework.Frameworks.Count () > 1; - - // when I find the one, name won't match ... - - // find all "previous" frameworks - // Add FrameworkAlternate with previous frameworks to found/pre-existing node - var allPreviousTypes_ = typeEntry.Framework.Frameworks - .Where (f => f.index < typeEntry.Framework.index) - .Select (f => f.FindTypeEntry (typeEntry)) - .ToArray (); - - var allPreviousFrameworks = allPreviousTypes.Value.Select (previous => previous.Framework.Name).ToArray (); - string fxList = string.Join (";", allPreviousFrameworks); - - // find the parameters in `root` that have an index == this parameter's index - // if they don't match, then we need to make a new one for this - - // Create new "Parameter" node, with FrameworkAlternate = this - - // Legacy: wasn't found, let's make sure it wasn't just cause the param name was changed - nodes = root.SelectSingleNode ("Parameters").SelectNodes ("Parameter") - .Cast () - .Skip (parameterIndex) // this makes sure we don't inadvertently "reuse" nodes when adding new ones - .Where (x => x.GetAttribute ("Name") != p.Name && (x.GetAttribute ("Type") == ptype || x.GetAttribute ("Type") == newPType)) - .Take (1) // there might be more than one that meets this parameter ... only take the first. - .ToArray (); - } - - AddXmlNode (nodes, - x => x.GetAttribute ("Type") == ptype, - x => x.SetAttribute ("Type", ptype), - () => - { - pe = root.OwnerDocument.CreateElement ("Parameter"); - e.AppendChild (pe); - - pe.SetAttribute ("Name", p.Name); - pe.SetAttribute ("Type", ptype); - if (p.ParameterType is ByReferenceType) - { - if (p.IsOut) - pe.SetAttribute ("RefType", "out"); - else - pe.SetAttribute ("RefType", "ref"); - } - - MakeAttributes (pe, GetCustomAttributes (p.CustomAttributes, "")); - return pe; - }, - member); - - parameterIndex++; - } - - // TODO: was there a `Parameter` that we didn't process that has FrameworkAlternate? - // if yes, remove this framework from that FrameworkAlternate - // if that makes the list empty, remove the node and corresponding /Docs/parameter node - */ - } - - - - - } -} diff --git a/mdoc/mdoc.csproj b/mdoc/mdoc.csproj index e87db9c61..f0051cc03 100644 --- a/mdoc/mdoc.csproj +++ b/mdoc/mdoc.csproj @@ -1,144 +1,20 @@  - + - Debug - AnyCPU - 8.0.30703 - 2.0 - {7DA7CD97-614F-4BCD-A2FA-B379590CEA48} + net471 Exe - mdoc - mdoc - v4.7.1 + false + false + $(MSBuildThisFileDirectory)..\bin\$(Configuration) - - True - full - False - ..\bin\Debug - DEBUG;NET_4_5 - prompt - 4 - AnyCPU - True - false - - - none - true - ..\bin\Release - prompt - 4 - AnyCPU - True - false - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + defaulttemplate.xsl @@ -156,6 +32,7 @@ stylesheet.xsl + Resources\mdoc-html-format.xsl @@ -170,16 +47,14 @@ Resources\mono-ecma-css.xsl + + - - {6e644802-b579-4037-9809-9cf4c7172c9d} - monodoc - + - diff --git a/mdoc/mdoc.nuspec b/mdoc/mdoc.nuspec index b73cc40dd..a491afc93 100644 --- a/mdoc/mdoc.nuspec +++ b/mdoc/mdoc.nuspec @@ -2,7 +2,7 @@ mdoc - 5.8.9.1 + 5.8.9.2 mdoc Microsoft Microsoft diff --git a/monodoc/Test/Monodoc.Test.csproj b/monodoc/Test/Monodoc.Test.csproj index 37d9b5762..e721e11c2 100644 --- a/monodoc/Test/Monodoc.Test.csproj +++ b/monodoc/Test/Monodoc.Test.csproj @@ -1,59 +1,19 @@  - + - Debug - AnyCPU - 8.0.30703 - 2.0 - {1EE70E2C-A289-4C36-AD0A-3D0C6CE56615} - Library - Monodoc.Test - Monodoc.Test - v4.7.1 - - - + net471 + false - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - - - true - bin\Release - prompt - 4 - - - - - + + - - - - - - - - - - - - {6e644802-b579-4037-9809-9cf4c7172c9d} - monodoc - + + - \ No newline at end of file