Skip to content

Commit cca712b

Browse files
authored
Fix bug #755541: add option to import content (#661)
* Fix bug #755541: add option to import content * Fix test cases
1 parent dcd4501 commit cca712b

3 files changed

Lines changed: 43 additions & 31 deletions

File tree

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/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")

0 commit comments

Comments
 (0)