Skip to content

Commit a18cba5

Browse files
authored
Merge pull request #664 from mono/develop
bump mdoc to 5.9.2.1
2 parents f21c774 + 2a71fe9 commit a18cba5

9 files changed

Lines changed: 94 additions & 52 deletions

File tree

.config/tsaoptions.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"instanceUrl": "https://ceapex.visualstudio.com",
3+
"projectName": "Engineering",
4+
"areaPath": "Engineering\\Reference",
5+
"iterationPath": "Engineering",
6+
"notificationAliases": [ "[email protected]", "[email protected]" ],
7+
"template": "TFSMSAzure",
8+
"repositoryName": "api-doc-tools",
9+
"codebaseName": "Docs_Mdoc"
10+
}

azure-pipelines.lgtm.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,15 @@ pool:
1717

1818
variables:
1919
Codeql.Enabled: true
20+
Codeql.TSAEnabled: true
2021
solution: 'apidoctools.sln'
2122
buildConfiguration: 'Release'
2223

2324
steps:
25+
- task: CodeQL3000Init@0
26+
inputs:
27+
Enabled: true
28+
2429
- task: CmdLine@2
2530
displayName: make prepare
2631
inputs:
@@ -31,3 +36,7 @@ steps:
3136
inputs:
3237
solution: '$(solution)'
3338
configuration: '$(buildConfiguration)'
39+
40+
- task: CodeQL3000Finalize@0
41+
inputs:
42+
Enabled: true

mdoc/Consts.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace Mono.Documentation
33
{
44
public static class Consts
55
{
6-
public static string MonoVersion = "5.9.2";
6+
public static string MonoVersion = "5.9.2.1";
77
public const string DocId = "DocId";
88
public const string CppCli = "C++ CLI";
99
public const string CppCx = "C++ CX";

mdoc/Makefile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ Test/FrameworkTestData: Test/DocTest-addNonGeneric.dll Test/DocTest-DropNS-class
210210
cp Test/DocTest-DropNS-classic.dll Test/FrameworkTestData/One/
211211
cp Test/DocTest-addNonGeneric.dll Test/FrameworkTestData/Two/
212212
cp Test/DocTest-DropNS-classic-secondary.dll Test/FrameworkTestData/Two/
213-
$(MONO) $(PROGRAM) fx-bootstrap Test/FrameworkTestData
213+
$(MONO) $(PROGRAM) fx-bootstrap -fx Test/FrameworkTestData
214214

215215
Test/FrameworkTestData-fx-inheritance: Test/DocTest-framework-inheritance-one.dll Test/DocTest-framework-inheritance-two.dll Test/DocTest-framework-inheritance-three.dll
216216
rm -rf Test/FrameworkTestData-fx-inheritance
@@ -221,7 +221,7 @@ Test/FrameworkTestData-fx-inheritance: Test/DocTest-framework-inheritance-one.dl
221221
cp Test/DocTest-framework-inheritance-one.dll Test/FrameworkTestData-fx-inheritance/One/
222222
cp Test/DocTest-framework-inheritance-two.dll Test/FrameworkTestData-fx-inheritance/Two/
223223
cp Test/DocTest-framework-inheritance-three.dll Test/FrameworkTestData-fx-inheritance/Three/
224-
$(MONO) $(PROGRAM) fx-bootstrap Test/FrameworkTestData-fx-inheritance
224+
$(MONO) $(PROGRAM) fx-bootstrap -fx Test/FrameworkTestData-fx-inheritance
225225

226226
.PHONY: check-monodocer-differentTypeDefinitions
227227
check-monodocer-differentTypeDefinitions : Test/DocTest-differentTypeDefinitions-First.dll Test/DocTest-differentTypeDefinitions-Second.dll
@@ -232,7 +232,7 @@ check-monodocer-differentTypeDefinitions : Test/DocTest-differentTypeDefinitions
232232
mkdir Test/FrameworkTestData-fx-differentTypeDefinitions/One
233233
cp Test/DocTest-differentTypeDefinitions-First.dll Test/FrameworkTestData-fx-differentTypeDefinitions/One
234234
cp Test/DocTest-differentTypeDefinitions-Second.dll Test/FrameworkTestData-fx-differentTypeDefinitions/One
235-
$(MONO) $(PROGRAM) fx-bootstrap Test/FrameworkTestData-fx-differentTypeDefinitions
235+
$(MONO) $(PROGRAM) fx-bootstrap -fx Test/FrameworkTestData-fx-differentTypeDefinitions
236236

237237
$(MONO) $(PROGRAM) update -o Test/en.actual -frameworks Test/FrameworkTestData-fx-differentTypeDefinitions
238238
$(DIFF) Test/en.expected.differentTypeDefinitions Test/en.actual
@@ -247,7 +247,7 @@ check-monodocer-differentTypeParameterNames : Test/DocTest-differentTypeParamete
247247
mkdir Test/FrameworkTestData-fx-differentTypeParameterNames/Two
248248
cp Test/DocTest-differentTypeParameterNames-First.dll Test/FrameworkTestData-fx-differentTypeParameterNames/One
249249
cp Test/DocTest-differentTypeParameterNames-Second.dll Test/FrameworkTestData-fx-differentTypeParameterNames/Two
250-
$(MONO) $(PROGRAM) fx-bootstrap Test/FrameworkTestData-fx-differentTypeParameterNames
250+
$(MONO) $(PROGRAM) fx-bootstrap -fx Test/FrameworkTestData-fx-differentTypeParameterNames
251251

252252
$(MONO) $(PROGRAM) update -o Test/en.actual -frameworks Test/FrameworkTestData-fx-differentTypeParameterNames
253253
$(DIFF) Test/en.expected.differentTypeParameterNames Test/en.actual
@@ -281,7 +281,7 @@ check-monodocer-typeForwards : Test/DocTest-typeForwards-First.dll Test/DocTest-
281281
cp Test/DocTest-typeForwards-Third-First.dll Test/FrameworkTestData-fx-typeForwards/Three
282282
cp Test/DocTest-typeForwards-Second.dll Test/FrameworkTestData-fx-typeForwards/dependencies/Three
283283
cp Test/DocTest-typeForwards-Third.dll Test/FrameworkTestData-fx-typeForwards/dependencies/Three
284-
$(MONO) $(PROGRAM) fx-bootstrap Test/FrameworkTestData-fx-typeForwards
284+
$(MONO) $(PROGRAM) fx-bootstrap -fx Test/FrameworkTestData-fx-typeForwards
285285

286286
# now run mdoc update
287287
$(MONO) $(PROGRAM) update -o Test/en.actual -frameworks Test/FrameworkTestData-fx-typeForwards
@@ -312,7 +312,7 @@ check-monodocer-nestedType-typeForwards : Test/DocTest-nestedType-typeForwards-F
312312
cp Test/DocTest-nestedType-typeForwards-Third-First.dll Test/FrameworkTestData-fx-nestedType-typeForwards/Three
313313
cp Test/DocTest-nestedType-typeForwards-Second.dll Test/FrameworkTestData-fx-nestedType-typeForwards/dependencies/Three
314314
cp Test/DocTest-nestedType-typeForwards-Third.dll Test/FrameworkTestData-fx-nestedType-typeForwards/dependencies/Three
315-
$(MONO) $(PROGRAM) fx-bootstrap Test/FrameworkTestData-fx-nestedType-typeForwards
315+
$(MONO) $(PROGRAM) fx-bootstrap -fx Test/FrameworkTestData-fx-nestedType-typeForwards
316316

317317
# now run mdoc update
318318
$(MONO) $(PROGRAM) update -o Test/en.actual -frameworks Test/FrameworkTestData-fx-nestedType-typeForwards
@@ -697,7 +697,7 @@ Test/FrameworkTestData-frameworkalternate: Test/DocTest-frameworkalternate-one.d
697697
cp Test/DocTest-frameworkalternate-one.dll Test/FrameworkTestData-frameworkalternate/One/
698698
cp Test/DocTest-frameworkalternate-two.dll Test/FrameworkTestData-frameworkalternate/Two/
699699
cp Test/DocTest-frameworkalternate-one.dll Test/FrameworkTestData-frameworkalternate/Three/
700-
$(MONO) $(PROGRAM) fx-bootstrap Test/FrameworkTestData-frameworkalternate
700+
$(MONO) $(PROGRAM) fx-bootstrap -fx Test/FrameworkTestData-frameworkalternate
701701

702702
.PHONY: Test/FrameworkTestData-frameworkalternate-fromold
703703
Test/FrameworkTestData-frameworkalternate-fromold: Test/DocTest-frameworkalternate-one.dll Test/DocTest-frameworkalternate-two.dll
@@ -709,7 +709,7 @@ Test/FrameworkTestData-frameworkalternate-fromold: Test/DocTest-frameworkalterna
709709
cp Test/DocTest-frameworkalternate-one.dll Test/FrameworkTestData-frameworkalternate-fromold/One/
710710
cp Test/DocTest-frameworkalternate-two.dll Test/FrameworkTestData-frameworkalternate-fromold/Two/
711711
cp Test/DocTest-frameworkalternate-one.dll Test/FrameworkTestData-frameworkalternate-fromold/Three/
712-
$(MONO) $(PROGRAM) fx-bootstrap Test/FrameworkTestData-frameworkalternate-fromold
712+
$(MONO) $(PROGRAM) fx-bootstrap -fx Test/FrameworkTestData-frameworkalternate-fromold
713713

714714
Test/DocTest-frameworkalternate-one.dll:
715715
$(CSCOMPILE) $(TEST_CSCFLAGS) -debug -target:library -out:$@ Test/DocTest-frameworkalternate.cs /define:FXONE
@@ -897,7 +897,7 @@ check-type-projection: Test/DocTest-TypeProjection.dll
897897
cp Test/TestTypeMap.xml Test/test-type-projection/
898898
mv Test/test-type-projection/TestTypeMap.xml Test/test-type-projection/TypeMap.xml
899899

900-
$(MONO) $(PROGRAM) fx-bootstrap Test/test-type-projection
900+
$(MONO) $(PROGRAM) fx-bootstrap -fx Test/test-type-projection
901901
$(MONO) $(PROGRAM) update -fx Test/test-type-projection/ -o Test/en.actual/
902902
$(DIFF) Test/en.expected-type-projection Test/en.actual/
903903

@@ -911,7 +911,7 @@ check-long-file-name: Test/DocTest-LongFileName.dll
911911

912912
cp Test/DocTest-LongFileName.dll Test/test-long-file-name/DocTest-LongFileName
913913

914-
$(MONO) $(PROGRAM) fx-bootstrap Test/test-long-file-name
914+
$(MONO) $(PROGRAM) fx-bootstrap -fx Test/test-long-file-name
915915
$(MONO) $(PROGRAM) update -fx Test/test-long-file-name -o Test/en.actual/
916916

917917
run-test-local: check-doc-tools

mdoc/Mono.Documentation/MDocUpdater.cs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -990,10 +990,10 @@ private void AddIndexAssembly (AssemblyDefinition assembly, XmlElement parent, F
990990
{
991991
XmlElement pubkey = WriteElement (index_assembly, "AssemblyPublicKey");
992992
var key = new StringBuilder (name.PublicKey.Length * 3 + 2);
993-
key.Append ("[");
993+
key.Append ('[');
994994
foreach (byte b in name.PublicKey)
995995
key.AppendFormat ("{0,2:x2} ", b);
996-
key.Append ("]");
996+
key.Append (']');
997997
pubkey.InnerText = key.ToString ();
998998
index_assembly.AppendChild (pubkey);
999999
}
@@ -1267,7 +1267,7 @@ public override int Compare (XmlNode x, XmlNode y)
12671267

12681268
static string GetVersion (string v)
12691269
{
1270-
int n = v.IndexOf ("x");
1270+
int n = v.IndexOf ('x');
12711271
if (n < 0)
12721272
return v;
12731273
return v.Substring (0, n - 1);
@@ -1999,20 +1999,22 @@ class MemberComparer : XmlNodeComparer
19991999
public override int Compare (XmlNode x, XmlNode y)
20002000
{
20012001
int r;
2002-
string xMemberName = x.Attributes["MemberName"].Value;
2003-
string yMemberName = y.Attributes["MemberName"].Value;
2002+
string xFullMemberName = x.Attributes["MemberName"].Value;
2003+
string yFullMemberName = y.Attributes["MemberName"].Value;
2004+
string xMemberName = xFullMemberName;
2005+
string yMemberName = yFullMemberName;
20042006

20052007
// generic methods *end* with '>'
20062008
// it's possible for explicitly implemented generic interfaces to
20072009
// contain <...> without being a generic method
2008-
if ((!xMemberName.EndsWith (">") || !yMemberName.EndsWith (">")) &&
2010+
if ((!xMemberName.EndsWith (">", StringComparison.Ordinal) || !yMemberName.EndsWith (">", StringComparison.Ordinal)) &&
20092011
(r = xMemberName.CompareTo (yMemberName)) != 0)
20102012
return r;
20112013

20122014
int lt;
2013-
if ((lt = xMemberName.IndexOf ("<")) >= 0)
2015+
if ((lt = xMemberName.IndexOf ('<')) >= 0)
20142016
xMemberName = xMemberName.Substring (0, lt);
2015-
if ((lt = yMemberName.IndexOf ("<")) >= 0)
2017+
if ((lt = yMemberName.IndexOf ('<')) >= 0)
20162018
yMemberName = yMemberName.Substring (0, lt);
20172019
if ((r = xMemberName.CompareTo (yMemberName)) != 0)
20182020
return r;
@@ -2075,7 +2077,7 @@ public override int Compare (XmlNode x, XmlNode y)
20752077
return r;
20762078
}
20772079

2078-
return 0;
2080+
return xFullMemberName.CompareTo(yFullMemberName);
20792081
}
20802082
}
20812083

@@ -4186,7 +4188,7 @@ private void MakeParameters (XmlElement root, MemberReference mi, FrameworkTypeE
41864188

41874189
public static string GetDocParameterType (TypeReference type, bool useTypeProjection = false)
41884190
{
4189-
var typename = GetDocTypeFullName (type, useTypeProjection).Replace ("@", "&");
4191+
var typename = GetDocTypeFullName (type, useTypeProjection).Replace ('@', '&');
41904192

41914193
if (useTypeProjection || string.IsNullOrEmpty(typename))
41924194
{
@@ -4337,11 +4339,11 @@ private static void AddGenericParameter(StringBuilder sb, MethodDefinition mb)
43374339
IList<GenericParameter> typeParams = mb.GenericParameters;
43384340
if (typeParams.Count > 0)
43394341
{
4340-
sb.Append("<");
4342+
sb.Append('<');
43414343
sb.Append(typeParams[0].Name);
43424344
for (int i = 1; i < typeParams.Count; ++i)
4343-
sb.Append(",").Append(typeParams[i].Name);
4344-
sb.Append(">");
4345+
sb.Append(',').Append(typeParams[i].Name);
4346+
sb.Append('>');
43454347
}
43464348
}
43474349
}
@@ -4420,7 +4422,7 @@ internal static string GetXPathForMember (DocumentationMember member)
44204422
{
44214423
xpath.Append (" and Parameter [").Append (i + 1).Append ("]/@Type=\"");
44224424
xpath.Append (member.Parameters[i]);
4423-
xpath.Append ("\"");
4425+
xpath.Append ('"');
44244426
}
44254427
xpath.Append ("]/..");
44264428
}
@@ -4447,7 +4449,7 @@ public static string GetXPathForMember (XPathNavigator member)
44474449
++i;
44484450
xpath.Append (" and Parameter [").Append (i).Append ("]/@Type=\"");
44494451
xpath.Append (parameters.Current.Value);
4450-
xpath.Append ("\"");
4452+
xpath.Append ('"');
44514453
}
44524454
xpath.Append ("]/..");
44534455
}
@@ -4479,7 +4481,7 @@ public static string GetXPathForMember (MemberReference member)
44794481
{
44804482
xpath.Append (" and Parameter [").Append (i + 1).Append ("]/@Type=\"");
44814483
xpath.Append (GetDocParameterType (parameters[i].ParameterType));
4482-
xpath.Append ("\"");
4484+
xpath.Append ('"');
44834485
}
44844486
xpath.Append ("]/..");
44854487
}

mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/AttributeFormatter.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,23 @@ private bool IsIgnoredAttribute(CustomAttribute customAttribute)
138138
return false;
139139
}
140140

141-
var attrTypeDef = attrType as TypeDefinition;
142-
if (attrTypeDef != null && !DocUtils.IsPublic(attrTypeDef) || (FormatterManager.SlashdocFormatter.GetName(attrType) == null)
141+
if (FormatterManager.SlashdocFormatter.GetName(attrType) == null
143142
|| Array.IndexOf(IgnorableAttributes, attrType.FullName) >= 0)
144143
{
145144
return true;
146145
}
147146

148-
return false;
147+
try
148+
{
149+
var attrTypeDef = attrType.Resolve();
150+
// We probably should return true if attrTypeDef is null, but it would cause too many diffs in dotnet-api-docs repo.
151+
return attrTypeDef != null && !DocUtils.IsPublic(attrTypeDef);
152+
}
153+
catch (Exception ex)
154+
{
155+
Console.WriteLine($"Unable to resolve {attrType.FullName}", ex);
156+
return true;
157+
}
149158
}
150159

151160
// FIXME: get TypeReferences instead of string comparison?

mdoc/Mono.Documentation/frameworksbootstrapper.cs

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,23 @@ namespace Mono.Documentation
1313
{
1414
public class MDocFrameworksBootstrapper : MDocCommand
1515
{
16+
private string frameworkPath;
17+
private bool importContent = true;
18+
1619
public override void Run (IEnumerable<string> args)
1720
{
18-
args = args.Skip (1);
19-
if (args.Count () != 1)
20-
Error ("Need to supply a single directory, which contain folders that represent frameworks.");
21+
var option = new OptionSet()
22+
{
23+
{ "fx|frameworks=", "Directories which contain libraries that span multiple frameworks.", v => frameworkPath = v },
24+
{ "importContent=", "Import XML Comment files to frameworks.xml.", v => bool.TryParse(v, out importContent) }
25+
};
26+
27+
option.Parse(args);
28+
if (string.IsNullOrWhiteSpace(frameworkPath))
29+
{
30+
Error("Framework Path should not be null or empty.");
31+
}
2132

22-
string frameworkPath = args.Single ();
2333
int slashOffset = frameworkPath.EndsWith (Path.DirectorySeparatorChar.ToString (), StringComparison.InvariantCultureIgnoreCase) ? 0 : 1;
2434

2535
if (!Directory.Exists(frameworkPath))
@@ -64,20 +74,23 @@ public override void Run (IEnumerable<string> args)
6474
new XElement("assemblySearchPath", Path.Combine("dependencies", d.Name))));
6575
}
6676

67-
var maxVersions = assemblyVersionMappings.SelectMany(f => f.Value)
68-
.GroupBy(m => m.Key)
69-
.ToDictionary(g => g.Key, g => g.Max(m => m.Value));
70-
71-
foreach (var framework in frameworks)
77+
if (importContent)
7278
{
73-
foreach (var assembly in assemblyVersionMappings[framework.Attribute("Name").ToString().Split('"')[1]])
74-
{
75-
if (maxVersions.ContainsKey(assembly.Key) && assembly.Value == maxVersions[assembly.Key])
76-
{
77-
framework.Add(new XElement("import", string.Format("{0}\\{1}", framework.Attribute("Source").ToString().Split('"')[1], assembly.Key)));
78-
}
79-
}
80-
}
79+
var maxVersions = assemblyVersionMappings.SelectMany(f => f.Value)
80+
.GroupBy(m => m.Key)
81+
.ToDictionary(g => g.Key, g => g.Max(m => m.Value));
82+
83+
foreach (var framework in frameworks)
84+
{
85+
foreach (var assembly in assemblyVersionMappings[framework.Attribute("Name").ToString().Split('"')[1]])
86+
{
87+
if (maxVersions.ContainsKey(assembly.Key) && assembly.Value == maxVersions[assembly.Key])
88+
{
89+
framework.Add(new XElement("import", string.Format("{0}\\{1}", framework.Attribute("Source").ToString().Split('"')[1], assembly.Key)));
90+
}
91+
}
92+
}
93+
}
8194

8295
var doc = new XDocument(new XElement("Frameworks", frameworks));
8396

@@ -90,5 +103,4 @@ public override void Run (IEnumerable<string> args)
90103
Console.WriteLine ($"Framework configuration file written to {configPath}");
91104
}
92105
}
93-
}
94-
106+
}

mdoc/compareXmlFiles.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ function Git-Push([string]$rootPath, [string] $token, [string] $commitMessage, [
5353

5454
function Run-Mdoc([string] $mdocPath, [string] $fwPath, [string] $xmlPath)
5555
{
56-
Write-Host "$mdocPath fx-bootstrap $fwPath"
57-
& $mdocPath fx-bootstrap $fwPath
56+
Write-Host "$mdocPath fx-bootstrap -fx $fwPath"
57+
& $mdocPath fx-bootstrap -fx $fwPath
5858

5959
$dnpath = [System.IO.Path]::GetDirectoryName((get-command dotnet).Source)
6060
$langs=@("VB.NET","F#","C++/CLI")

mdoc/mdoc.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package >
33
<metadata>
44
<id>mdoc</id>
5-
<version>5.9.2</version>
5+
<version>5.9.2.1</version>
66
<title>mdoc</title>
77
<authors>Microsoft</authors>
88
<owners>Microsoft</owners>

0 commit comments

Comments
 (0)