Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions mcs/tools/mdoc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,12 @@ check-monodocer-dropns-multi: $(PROGRAM)
$(MAKE) Test/DocTest-DropNS-unified-multitest.dll

# mdoc update for both classic and unified
$(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual $(MULTI-CLASSIC) --api-style=classic -multiassembly
$(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual $(MULTI-UNIFIED) --api-style=unified --dropns Test/DocTest-DropNS-unified.dll=MyFramework --dropns Test/DocTest-DropNS-unified-multitest.dll=MyFramework -multiassembly
$(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual $(MULTI-CLASSIC) --api-style=classic
$(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual $(MULTI-UNIFIED) --api-style=unified --dropns Test/DocTest-DropNS-unified.dll=MyFramework --dropns Test/DocTest-DropNS-unified-multitest.dll=MyFramework

# now run it again to verify idempotency
$(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual $(MULTI-CLASSIC) --api-style=classic -multiassembly
$(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual $(MULTI-UNIFIED) --api-style=unified --dropns Test/DocTest-DropNS-unified.dll=MyFramework --dropns Test/DocTest-DropNS-unified-multitest.dll=MyFramework -multiassembly
$(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual $(MULTI-CLASSIC) --api-style=classic
$(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual $(MULTI-UNIFIED) --api-style=unified --dropns Test/DocTest-DropNS-unified.dll=MyFramework --dropns Test/DocTest-DropNS-unified-multitest.dll=MyFramework

diff --exclude=.svn -rup Test/en.expected-dropns-multi Test/en.actual

Expand All @@ -208,8 +208,8 @@ check-monodocer-dropns-multi-withexisting: $(PROGRAM)
$(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-unified.dll --api-style=unified --dropns Test/DocTest-DropNS-unified.dll=MyFramework

# mdoc update for both classic and unified
$(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual $(MULTI-CLASSIC) --api-style=classic -multiassembly
$(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual $(MULTI-UNIFIED) --api-style=unified --dropns Test/DocTest-DropNS-unified.dll=MyFramework --dropns Test/DocTest-DropNS-unified-multitest.dll=MyFramework -multiassembly
$(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual $(MULTI-CLASSIC) --api-style=classic
$(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual $(MULTI-UNIFIED) --api-style=unified --dropns Test/DocTest-DropNS-unified.dll=MyFramework --dropns Test/DocTest-DropNS-unified-multitest.dll=MyFramework

diff --exclude=.svn -rup Test/en.expected-dropns-multi-withexisting Test/en.actual

Expand Down
29 changes: 18 additions & 11 deletions mcs/tools/mdoc/Mono.Documentation/monodocer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class MDocUpdater : MDocCommand

string apistyle = string.Empty;
bool isClassicRun;
bool multiassembly;

bool delete;
bool show_exceptions;
bool no_assembly_versions, ignore_missing_types;
Expand Down Expand Up @@ -194,7 +194,14 @@ public static bool HasDroppedAnyNamespace ()
{
return !string.IsNullOrWhiteSpace (droppedNamespace);
}


/// <summary>Logic flag to signify that we should list assemblies at the method level, since there are multiple
/// assemblies for a given type/method.</summary>
public bool IsMultiAssembly {
get {
return apistyle == "classic" || apistyle == "unified";
}
}

static List<string> droppedAssemblies = new List<string>();

Expand Down Expand Up @@ -281,12 +288,9 @@ public override void Run (IEnumerable<string> args)
{ "preserve",
"Do not delete members that don't exist in the assembly, but rather mark them as preserved.",
v => PreserveTag = "true" },
{ "multiassembly",
"Allow types to be in multiple assemblies.",
v => multiassembly = true },
{ "api-style=",
"Denotes the apistyle. Currently, only `classic` and `unified` are supported. `classic` set of assemblies should be run first, immediately followed by 'unified' assemblies with the `dropns` parameter.",
v => apistyle = v.ToLowerInvariant ()},
v => { apistyle = v.ToLowerInvariant (); }},
};
var assemblies = Parse (p, args, "update",
"[OPTIONS]+ ASSEMBLIES",
Expand Down Expand Up @@ -787,7 +791,7 @@ public static string GetTypeFileName (string typename)
private void AddIndexAssembly (AssemblyDefinition assembly, XmlElement parent)
{
XmlElement index_assembly = null;
if (multiassembly)
if (IsMultiAssembly)
index_assembly = (XmlElement)parent.SelectSingleNode ("Assembly[@Name='"+ assembly.Name.Name +"']");

if (index_assembly == null)
Expand Down Expand Up @@ -867,7 +871,7 @@ private void DoUpdateAssemblies (string source, string dest)

XmlElement index_types = WriteElement(index.DocumentElement, "Types");
XmlElement index_assemblies = WriteElement(index.DocumentElement, "Assemblies");
if (!multiassembly)
if (!IsMultiAssembly)
index_assemblies.RemoveAll ();


Expand Down Expand Up @@ -1765,7 +1769,7 @@ private void UpdateMember (DocsNodeInfo info)
WriteElementText(me, "MemberType", GetMemberType(mi));

if (!no_assembly_versions) {
if (!multiassembly)
if (!IsMultiAssembly)
UpdateAssemblyVersions (me, mi, true);
else {
var node = AddAssemblyNameToNode (me, mi.Module);
Expand Down Expand Up @@ -2013,7 +2017,10 @@ private void UpdateExtensionMethods (XmlElement e, DocsNodeInfo info)
member.AppendChild (link);
AddTargets (em, info);

extensionMethods.Add (em);
var sig = em.SelectSingleNode ("Member/MemberSignature[@Language='C#']/@Value");
if (!IsMultiAssembly || (IsMultiAssembly && sig != null && !extensionMethods.Any (ex => ex.SelectSingleNode ("Member/MemberSignature[@Language='C#']/@Value").Value == sig.Value))) {
extensionMethods.Add (em);
}
}

private static void RemoveExcept (XmlNode node, string[] except)
Expand Down Expand Up @@ -2404,7 +2411,7 @@ private static string GetAssemblyVersion (AssemblyDefinition assembly)

private bool UpdateAssemblyVersions(XmlElement root, AssemblyDefinition assembly, string[] assemblyVersions, bool add)
{
if (multiassembly)
if (IsMultiAssembly)
return false;

XmlElement av = (XmlElement) root.SelectSingleNode ("AssemblyVersions");
Expand Down
3 changes: 3 additions & 0 deletions mcs/tools/mdoc/Test/DocTest-DropNS-classic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public float Hello(int value) {
public string WillDeleteInV2Classic {get;set;}
#endif
}
public static class MyClassExtensions {
public static bool AnExtension (this MyClass value) { return false; }
}

#if DELETETEST
public class TypeOnlyInClassic {}
Expand Down
3 changes: 3 additions & 0 deletions mcs/tools/mdoc/Test/DocTest-DropNS-unified.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public float Hello(int value) {
#endif
}

public static class MyClassExtensions {
public static bool AnExtension (this MyClass value) { return false; }
}
#if DELETETEST
public struct nint {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberType>Constructor</MemberType>
<AssemblyInfo apistyle="classic">
<AssemblyName>DocTest-DropNS-classic</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo apistyle="unified">
<AssemblyName>DocTest-DropNS-unified</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
Expand All @@ -39,9 +41,11 @@
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance float32 Hello(int32 value) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo apistyle="classic">
<AssemblyName>DocTest-DropNS-classic</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo apistyle="unified">
<AssemblyName>DocTest-DropNS-unified</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
Expand All @@ -62,9 +66,11 @@
<MemberSignature Language="ILAsm" Value=".property instance string MyProperty" />
<MemberType>Property</MemberType>
<AssemblyInfo apistyle="classic">
<AssemblyName>DocTest-DropNS-classic</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo apistyle="unified">
<AssemblyName>DocTest-DropNS-unified</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
Expand All @@ -81,6 +87,7 @@
<MemberSignature Language="ILAsm" Value=".property instance float64 OnlyInClassic" />
<MemberType>Property</MemberType>
<AssemblyInfo apistyle="classic">
<AssemblyName>DocTest-DropNS-classic</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
Expand All @@ -97,6 +104,7 @@
<MemberSignature Language="ILAsm" Value=".property instance char OnlyInUnified" />
<MemberType>Property</MemberType>
<AssemblyInfo apistyle="unified">
<AssemblyName>DocTest-DropNS-unified</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<Type Name="MyClassExtensions" FullName="MyFramework.MyNamespace.MyClassExtensions">
<TypeSignature Language="C#" Value="public static class MyClassExtensions" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit MyClassExtensions extends System.Object" />
<AssemblyInfo apistyle="classic">
<AssemblyName>DocTest-DropNS-classic</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo apistyle="unified">
<AssemblyName>DocTest-DropNS-unified</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
</Docs>
<Members>
<Member MemberName="AnExtension">
<MemberSignature Language="C#" Value="public static bool AnExtension (this MyFramework.MyNamespace.MyClass value);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig bool AnExtension(class MyFramework.MyNamespace.MyClass value) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo apistyle="classic">
<AssemblyName>DocTest-DropNS-classic</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo apistyle="unified">
<AssemblyName>DocTest-DropNS-unified</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="MyFramework.MyNamespace.MyClass" RefType="this" />
</Parameters>
<Docs>
<param name="value">To be added.</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
</Members>
</Type>
34 changes: 34 additions & 0 deletions mcs/tools/mdoc/Test/en.expected-dropns-classic-v1/index.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
<Overview>
<Assemblies>
<Assembly Name="DocTest-DropNS-classic" Version="0.0.0.0">
<Attributes>
<Attribute>
<AttributeName>System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute+DebuggingModes.IgnoreSymbolStoreSequencePoints)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true)</AttributeName>
</Attribute>
</Attributes>
</Assembly>
<Assembly Name="DocTest-DropNS-unified" Version="0.0.0.0">
<Attributes>
<Attribute>
Expand All @@ -16,7 +26,31 @@
<Types>
<Namespace Name="MyFramework.MyNamespace">
<Type Name="MyClass" Kind="Class" />
<Type Name="MyClassExtensions" Kind="Class" />
</Namespace>
</Types>
<Title>DocTest-DropNS-classic</Title>
<ExtensionMethods>
<ExtensionMethod>
<Targets>
<Target Type="T:MyFramework.MyNamespace.MyClass" />
</Targets>
<Member MemberName="AnExtension">
<MemberSignature Language="C#" Value="public static bool AnExtension (this MyFramework.MyNamespace.MyClass value);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig bool AnExtension(class MyFramework.MyNamespace.MyClass value) cil managed" />
<MemberType>ExtensionMethod</MemberType>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="MyFramework.MyNamespace.MyClass" RefType="this" />
</Parameters>
<Docs>
<param name="value">To be added.</param>
<summary>To be added.</summary>
</Docs>
<Link Type="MyFramework.MyNamespace.MyClassExtensions" Member="M:MyFramework.MyNamespace.MyClassExtensions.AnExtension(MyFramework.MyNamespace.MyClass)" />
</Member>
</ExtensionMethod>
</ExtensionMethods>
</Overview>
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberType>Constructor</MemberType>
<AssemblyInfo apistyle="classic">
<AssemblyName>DocTest-DropNS-classic</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo apistyle="unified">
<AssemblyName>DocTest-DropNS-unified</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
Expand All @@ -39,9 +41,11 @@
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance float32 Hello(int32 value) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo apistyle="classic">
<AssemblyName>DocTest-DropNS-classic</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo apistyle="unified">
<AssemblyName>DocTest-DropNS-unified</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
Expand All @@ -62,9 +66,11 @@
<MemberSignature Language="ILAsm" Value=".property instance string MyProperty" />
<MemberType>Property</MemberType>
<AssemblyInfo apistyle="classic">
<AssemblyName>DocTest-DropNS-classic</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo apistyle="unified">
<AssemblyName>DocTest-DropNS-unified</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
Expand All @@ -81,6 +87,7 @@
<MemberSignature Language="ILAsm" Value=".property instance float64 OnlyInClassic" />
<MemberType>Property</MemberType>
<AssemblyInfo apistyle="classic">
<AssemblyName>DocTest-DropNS-classic</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
Expand All @@ -97,6 +104,7 @@
<MemberSignature Language="ILAsm" Value=".property instance char OnlyInUnified" />
<MemberType>Property</MemberType>
<AssemblyInfo apistyle="unified">
<AssemblyName>DocTest-DropNS-unified</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<Type Name="MyClassExtensions" FullName="MyFramework.MyNamespace.MyClassExtensions">
<TypeSignature Language="C#" Value="public static class MyClassExtensions" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit MyClassExtensions extends System.Object" />
<AssemblyInfo apistyle="classic">
<AssemblyName>DocTest-DropNS-classic</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo apistyle="unified">
<AssemblyName>DocTest-DropNS-unified</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
</Docs>
<Members>
<Member MemberName="AnExtension">
<MemberSignature Language="C#" Value="public static bool AnExtension (this MyFramework.MyNamespace.MyClass value);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig bool AnExtension(class MyFramework.MyNamespace.MyClass value) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo apistyle="classic">
<AssemblyName>DocTest-DropNS-classic</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo apistyle="unified">
<AssemblyName>DocTest-DropNS-unified</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="MyFramework.MyNamespace.MyClass" RefType="this" />
</Parameters>
<Docs>
<param name="value">To be added.</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
</Members>
</Type>
Loading