diff options
author | Min Huang <huangmin@microsoft.com> | 2022-01-11 15:28:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-11 15:28:26 +0300 |
commit | d2bde523ee4091aadbb0b40d529d71b297179d59 (patch) | |
tree | 8f986377645233d0aa279cfa795c38ba5645a0b9 | |
parent | f0c4e7bb8b3a9a674716eb506aff56d491a34b73 (diff) |
Removed types from FrameworkIndex file if they are forwarded to external assembly (#592)mdoc-5.8.6
* Removed types of exteranl assemblies for forwarded types.
* Update test cases
* Remove null check as discussed
7 files changed, 10 insertions, 43 deletions
diff --git a/mdoc/Mono.Documentation/Updater/Frameworks/FrameworkEntry.cs b/mdoc/Mono.Documentation/Updater/Frameworks/FrameworkEntry.cs index aef861d3..c96739d7 100644 --- a/mdoc/Mono.Documentation/Updater/Frameworks/FrameworkEntry.cs +++ b/mdoc/Mono.Documentation/Updater/Frameworks/FrameworkEntry.cs @@ -247,8 +247,7 @@ namespace Mono.Documentation.Updater.Frameworks typeMap.Add (Str (entry.Name), entry); } - entry.NoteAssembly(type.Module.Assembly, source); - entry.NoteAssembly(source, source); + entry.NoteAssembly(type.Module.Assembly); entry.TimesProcessed++; return entry; } diff --git a/mdoc/Mono.Documentation/Updater/Frameworks/FrameworkIndex.cs b/mdoc/Mono.Documentation/Updater/Frameworks/FrameworkIndex.cs index bc67ce9b..ff936f76 100644 --- a/mdoc/Mono.Documentation/Updater/Frameworks/FrameworkIndex.cs +++ b/mdoc/Mono.Documentation/Updater/Frameworks/FrameworkIndex.cs @@ -116,7 +116,11 @@ namespace Mono.Documentation.Updater.Frameworks )); } - frameworkElement.Add(fx.Types.GroupBy(t => t.Namespace) + var assemblyNameVersionSet = new HashSet<Tuple<string, string>>(fx.AssemblyNames); + + frameworkElement.Add(fx.Types + .Where(t => assemblyNameVersionSet.Contains(t.AssemblyNameAndVersion)) + .GroupBy(t => t.Namespace) .Select(g => new XElement("Namespace", new XAttribute("Name", g.Key), g.Select(t => new XElement("Type", diff --git a/mdoc/Mono.Documentation/Updater/Frameworks/FrameworkTypeEntry.cs b/mdoc/Mono.Documentation/Updater/Frameworks/FrameworkTypeEntry.cs index 204e0fd0..e94ed5c1 100644 --- a/mdoc/Mono.Documentation/Updater/Frameworks/FrameworkTypeEntry.cs +++ b/mdoc/Mono.Documentation/Updater/Frameworks/FrameworkTypeEntry.cs @@ -29,17 +29,13 @@ namespace Mono.Documentation.Updater.Frameworks public int TimesProcessed { get; set; } - public Dictionary<string, bool> AssembliesMemberOf = new Dictionary<string, bool>(); + public Tuple<string, string> AssemblyNameAndVersion; - public void NoteAssembly(AssemblyDefinition noting, AssemblyDefinition source) + public void NoteAssembly(AssemblyDefinition assembly) { - if (noting == null || source == null) - return; - - bool isForward = noting.Name.Name == source.Name.Name; - if (!AssembliesMemberOf.ContainsKey(noting.Name.Name)) + if (assembly != null && AssemblyNameAndVersion == null) { - AssembliesMemberOf.Add(noting.Name.Name, isForward); + AssemblyNameAndVersion = Tuple.Create(assembly.Name.Name, assembly.Name.Version.ToString()); } } diff --git a/mdoc/Test/en.expected-nestedType.typeForwards/FrameworksIndex/Three.xml b/mdoc/Test/en.expected-nestedType.typeForwards/FrameworksIndex/Three.xml index 1b8928b3..4527bcd3 100644 --- a/mdoc/Test/en.expected-nestedType.typeForwards/FrameworksIndex/Three.xml +++ b/mdoc/Test/en.expected-nestedType.typeForwards/FrameworksIndex/Three.xml @@ -4,15 +4,4 @@ <Assembly Name="DocTest-nestedType-typeForwards-Second-First" Version="0.0.0.0" /> <Assembly Name="DocTest-nestedType-typeForwards-Third-First" Version="0.0.0.0" /> </Assemblies> - <Namespace Name="TheNamespace"> - <Type Name="TheNamespace.TheClass" Id="T:TheNamespace.TheClass"> - <Member Id="M:TheNamespace.TheClass.#ctor" /> - </Type> - <Type Name="TheNamespace.TheClass/InnerClass" Id="T:TheNamespace.TheClass.InnerClass"> - <Member Id="M:TheNamespace.TheClass.InnerClass.#ctor" /> - </Type> - <Type Name="TheNamespace.TheClass/InnerClass/Enumerator" Id="T:TheNamespace.TheClass.InnerClass.Enumerator"> - <Member Id="M:TheNamespace.TheClass.InnerClass.Enumerator.#ctor" /> - </Type> - </Namespace> </Framework>
\ No newline at end of file diff --git a/mdoc/Test/en.expected-nestedType.typeForwards/FrameworksIndex/Two.xml b/mdoc/Test/en.expected-nestedType.typeForwards/FrameworksIndex/Two.xml index e009be4d..c51aef57 100644 --- a/mdoc/Test/en.expected-nestedType.typeForwards/FrameworksIndex/Two.xml +++ b/mdoc/Test/en.expected-nestedType.typeForwards/FrameworksIndex/Two.xml @@ -4,15 +4,4 @@ <Assembly Name="DocTest-nestedType-typeForwards-Second-First" Version="0.0.0.0" /> <Assembly Name="DocTest-nestedType-typeForwards-Third-First" Version="0.0.0.0" /> </Assemblies> - <Namespace Name="TheNamespace"> - <Type Name="TheNamespace.TheClass" Id="T:TheNamespace.TheClass"> - <Member Id="M:TheNamespace.TheClass.#ctor" /> - </Type> - <Type Name="TheNamespace.TheClass/InnerClass" Id="T:TheNamespace.TheClass.InnerClass"> - <Member Id="M:TheNamespace.TheClass.InnerClass.#ctor" /> - </Type> - <Type Name="TheNamespace.TheClass/InnerClass/Enumerator" Id="T:TheNamespace.TheClass.InnerClass.Enumerator"> - <Member Id="M:TheNamespace.TheClass.InnerClass.Enumerator.#ctor" /> - </Type> - </Namespace> </Framework>
\ No newline at end of file diff --git a/mdoc/Test/en.expected.typeForwards/FrameworksIndex/Three.xml b/mdoc/Test/en.expected.typeForwards/FrameworksIndex/Three.xml index 2fe83e82..348387c3 100644 --- a/mdoc/Test/en.expected.typeForwards/FrameworksIndex/Three.xml +++ b/mdoc/Test/en.expected.typeForwards/FrameworksIndex/Three.xml @@ -4,9 +4,4 @@ <Assembly Name="DocTest-typeForwards-Second-First" Version="0.0.0.0" /> <Assembly Name="DocTest-typeForwards-Third-First" Version="0.0.0.0" /> </Assemblies> - <Namespace Name="TheNamespace"> - <Type Name="TheNamespace.TheClass" Id="T:TheNamespace.TheClass"> - <Member Id="M:TheNamespace.TheClass.#ctor" /> - </Type> - </Namespace> </Framework>
\ No newline at end of file diff --git a/mdoc/Test/en.expected.typeForwards/FrameworksIndex/Two.xml b/mdoc/Test/en.expected.typeForwards/FrameworksIndex/Two.xml index aebb2223..de8db9c2 100644 --- a/mdoc/Test/en.expected.typeForwards/FrameworksIndex/Two.xml +++ b/mdoc/Test/en.expected.typeForwards/FrameworksIndex/Two.xml @@ -4,9 +4,4 @@ <Assembly Name="DocTest-typeForwards-Second-First" Version="0.0.0.0" /> <Assembly Name="DocTest-typeForwards-Third-First" Version="0.0.0.0" /> </Assemblies> - <Namespace Name="TheNamespace"> - <Type Name="TheNamespace.TheClass" Id="T:TheNamespace.TheClass"> - <Member Id="M:TheNamespace.TheClass.#ctor" /> - </Type> - </Namespace> </Framework>
\ No newline at end of file |