diff options
author | Min Huang <huangmin@microsoft.com> | 2021-12-14 09:16:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-14 09:16:22 +0300 |
commit | dd3404f0a60f215c43a970284317b93fdcf39cd2 (patch) | |
tree | c0f3c93ca09eba990cdce2c03282b86a0d025374 | |
parent | 29784969b6e8407cee26b67bf11aba1e6c8338e2 (diff) |
Fix long file name issue for Azure PowerShell .NET Reference (#589)
* Fixed long file name for Azure PowerShell .NET Reference
* update
* fix path with forward slash issue
* Updated
* Add log to debug CI pipeline
* Handle relative path
* Check platform info for long path handling
* Remove debug log
* Add unit test
* Remove expected long name file because it cause git push/pull issue
* Retarget Mono.Cecil library to net471
-rw-r--r-- | mdoc/Makefile | 20 | ||||
-rw-r--r-- | mdoc/Mono.Documentation/MDocUpdater.cs | 15 | ||||
-rw-r--r-- | mdoc/Test/DocTest-LongFileName.cs | 10 | ||||
-rw-r--r-- | mdoc/mdoc.csproj | 3 | ||||
-rw-r--r-- | mdoc/packages.config | 3 |
5 files changed, 41 insertions, 10 deletions
diff --git a/mdoc/Makefile b/mdoc/Makefile index c695e157..22899c9e 100644 --- a/mdoc/Makefile +++ b/mdoc/Makefile @@ -174,6 +174,10 @@ Test/DocTest-nestedType-typeForwards-First.dll: rm -f $@ $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ Test/DocTest-nestedType-typeForwards.cs /define:FIRST +Test/DocTest-LongFileName.dll: + rm -f DocTest-LongFileName.dll + $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ Test/DocTest-LongFileName.cs + .PHONY: Test/DocTest-nestedType-typeForwards-Second.dll Test/DocTest-nestedType-typeForwards-Second.dll: rm -f $@ @@ -874,6 +878,19 @@ check-type-projection: Test/DocTest-TypeProjection.dll $(MONO) $(PROGRAM) update -fx Test/test-type-projection/ -o Test/en.actual/ $(DIFF) Test/en.expected-type-projection Test/en.actual/ +check-long-file-name: Test/DocTest-LongFileName.dll + rm -Rf Test/en.actual + rm -Rf Test/test-long-file-name + + mkdir Test/test-long-file-name + mkdir Test/test-long-file-name/DocTest-LongFileName + mkdir Test/en.actual + + cp Test/DocTest-LongFileName.dll Test/test-long-file-name/DocTest-LongFileName + + $(MONO) $(PROGRAM) fx-bootstrap Test/test-long-file-name + $(MONO) $(PROGRAM) update -fx Test/test-long-file-name -o Test/en.actual/ + run-test-local: check-doc-tools run-test-update : check-doc-tools-update @@ -930,7 +947,8 @@ check-doc-tools: \ check-monodocer-embedded-type \ check-ignored-namespace-generic \ check-multiple-mdoc \ - check-type-projection + check-type-projection \ + check-long-file-name #check-monodocer-dropns-delete check-doc-tools-update: check-monodocer-since-update \ diff --git a/mdoc/Mono.Documentation/MDocUpdater.cs b/mdoc/Mono.Documentation/MDocUpdater.cs index a5aa56cd..35d17843 100644 --- a/mdoc/Mono.Documentation/MDocUpdater.cs +++ b/mdoc/Mono.Documentation/MDocUpdater.cs @@ -5,6 +5,7 @@ using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; +using System.Runtime.InteropServices; using System.Text; using System.Xml; using System.Xml.Linq; @@ -16,7 +17,7 @@ using Mono.Documentation.Updater.Frameworks; using Mono.Documentation.Updater.Statistics; using Mono.Documentation.Util; using Mono.Options; - +using SchwabenCode.QuickIO; using MyXmlNodeList = System.Collections.Generic.List<System.Xml.XmlNode>; using StringList = System.Collections.Generic.List<string>; using StringToXmlNodeMap = System.Collections.Generic.Dictionary<string, System.Xml.XmlNode>; @@ -692,8 +693,8 @@ namespace Mono.Documentation index_remarks.InnerText = "To be added."; index_docs.AppendChild (index_remarks); - WriteFile (outdir + "/ns-" + ns + ".xml", FileMode.CreateNew, - writer => WriteXml (index.DocumentElement, writer)); + var nsDocPath = DocUtils.PathCombine(outdir, $"ns-{ns}.xml"); + WriteFile (nsDocPath, FileMode.CreateNew, writer => WriteXml (index.DocumentElement, writer)); } public void DoUpdateTypes (string basepath, List<string> typenames, string dest) @@ -1039,7 +1040,7 @@ namespace Mono.Documentation private void DoUpdateAssemblies (string source, string dest) { - string indexfile = dest + "/index.xml"; + string indexfile = DocUtils.PathCombine(dest, "index.xml"); XmlDocument index; if (System.IO.File.Exists (indexfile)) { @@ -1417,10 +1418,8 @@ namespace Mono.Documentation private static TextWriter OpenWrite (string path, FileMode mode) { - var w = new StreamWriter ( - new FileStream (path, mode), - new UTF8Encoding (false) - ); + var fs = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? QuickIOFile.Open(Path.GetFullPath(path), mode) : new FileStream(path, mode); + var w = new StreamWriter (fs, new UTF8Encoding (false)); w.NewLine = "\n"; return w; } diff --git a/mdoc/Test/DocTest-LongFileName.cs b/mdoc/Test/DocTest-LongFileName.cs new file mode 100644 index 00000000..bc911792 --- /dev/null +++ b/mdoc/Test/DocTest-LongFileName.cs @@ -0,0 +1,10 @@ +namespace Mono.DocTest.LooooooooooooooooooooooooooooooooooooooooooooooooooooogNamespace +{ + public class LoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooogNameClass + { + public int Test(int arg) + { + return 0; + } + } +}
\ No newline at end of file diff --git a/mdoc/mdoc.csproj b/mdoc/mdoc.csproj index 9de40804..259f5feb 100644 --- a/mdoc/mdoc.csproj +++ b/mdoc/mdoc.csproj @@ -46,6 +46,9 @@ <Reference Include="Mono.Cecil.Rocks, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.10.0-beta5\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
</Reference>
+ <Reference Include="SchwabenCode.QuickIO, Version=2.6.2.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\QuickIO.NET.2.6.2.0\lib\net45\SchwabenCode.QuickIO.dll</HintPath>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
diff --git a/mdoc/packages.config b/mdoc/packages.config index 5770ac17..48672eab 100644 --- a/mdoc/packages.config +++ b/mdoc/packages.config @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Mono.Cecil" version="0.10.0-beta5" targetFramework="net45" />
+ <package id="Mono.Cecil" version="0.10.0-beta5" targetFramework="net471" />
+ <package id="QuickIO.NET" version="2.6.2.0" targetFramework="net471" />
</packages>
\ No newline at end of file |