diff options
author | Jonathan Pryor <jpryor@novell.com> | 2010-06-10 19:09:05 +0400 |
---|---|---|
committer | Jonathan Pryor <jpryor@novell.com> | 2010-06-10 19:09:05 +0400 |
commit | 2c713a86823574cc046018088ab4981b8f763d96 (patch) | |
tree | f5deafb9c1e1e4154dcdd310a3cc849be7dd1abd /mcs | |
parent | cd91fdc61b6908c9967e3859721cc40aec720c0c (diff) |
* Mono.Documentation/monodocs2html.cs: Regenerate all index.{opts.ext}
files if any of the source .xml files have changed. This allows
new <summary/> values to be inserted into the index.{opts.ext}
files, instead of the index files being "stale". Fixes #573121.
svn path=/branches/mono-2-6/mcs/; revision=158791
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/tools/mdoc/ChangeLog | 7 | ||||
-rw-r--r-- | mcs/tools/mdoc/Mono.Documentation/monodocs2html.cs | 62 |
2 files changed, 52 insertions, 17 deletions
diff --git a/mcs/tools/mdoc/ChangeLog b/mcs/tools/mdoc/ChangeLog index 1fabf4aa6cf..6606a315239 100644 --- a/mcs/tools/mdoc/ChangeLog +++ b/mcs/tools/mdoc/ChangeLog @@ -1,3 +1,10 @@ +2010-04-16 Jonathan Pryor <jpryor@novell.com> + + * Mono.Documentation/monodocs2html.cs: Regenerate all index.{opts.ext} + files if any of the source .xml files have changed. This allows + new <summary/> values to be inserted into the index.{opts.ext} + files, instead of the index files being "stale". Fixes #573121. + 2010-02-28 Jonathan Pryor <jpryor@novell.com> * Mono.Documentation/webdoc.cs: Allow .source files to be provided to diff --git a/mcs/tools/mdoc/Mono.Documentation/monodocs2html.cs b/mcs/tools/mdoc/Mono.Documentation/monodocs2html.cs index 0426cebe749..cf933f8d640 100644 --- a/mcs/tools/mdoc/Mono.Documentation/monodocs2html.cs +++ b/mcs/tools/mdoc/Mono.Documentation/monodocs2html.cs @@ -124,15 +124,13 @@ class MDocToHtmlConverter : MDocCommand { } XmlDocument overview = GetOverview (sourceDirectories); - string overviewDest = opts.dest + "/index." + opts.ext; ArrayList extensions = GetExtensionMethods (overview); // Create the master page XsltArgumentList overviewargs = new XsltArgumentList(); - var regenIndex = sourceDirectories.Any ( - d => !DestinationIsNewer (Path.Combine (d, "index.xml"), overviewDest)); + var regenIndex = ShouldRegenIndexes (opts, overview, sourceDirectories); if (regenIndex) { overviewargs.AddParam("ext", "", opts.ext); overviewargs.AddParam("basepath", "", "./"); @@ -167,20 +165,8 @@ class MDocToHtmlConverter : MDocCommand { } foreach (XmlElement ty in ns.SelectNodes("Type")) { - string typefilebase = ty.GetAttribute("Name"); - string sourceDir = ty.GetAttribute("SourceDirectory"); - string typename = ty.GetAttribute("DisplayName"); - if (typename.Length == 0) - typename = typefilebase; - - if (opts.onlytype != null && !(nsname + "." + typename).StartsWith(opts.onlytype)) - continue; - - string typefile = CombinePath (sourceDir, nsname, typefilebase + ".xml"); - if (typefile == null) - continue; - - string destfile = opts.dest + "/" + nsname + "/" + typefilebase + "." + opts.ext; + string typename, typefile, destfile; + GetTypePaths (opts, ty, out typename, out typefile, out destfile); if (DestinationIsNewer (typefile, destfile)) // target already exists, and is newer. why regenerate? @@ -211,6 +197,48 @@ class MDocToHtmlConverter : MDocCommand { r.Add (n); return r; } + + static bool ShouldRegenIndexes (MDocToHtmlConverterOptions opts, XmlDocument overview, List<string> sourceDirectories) + { + string overviewDest = opts.dest + "/index." + opts.ext; + if (sourceDirectories.Any ( + d => !DestinationIsNewer (Path.Combine (d, "index.xml"), overviewDest))) + return true; + + foreach (XmlElement type in overview.SelectNodes("Overview/Types/Namespace/Type")) { + string _, srcfile, destfile; + GetTypePaths (opts, type, out _, out srcfile, out destfile); + + if (srcfile == null || destfile == null) + continue; + if (DestinationIsNewer (srcfile, destfile)) + return true; + } + + return false; + } + + static void GetTypePaths (MDocToHtmlConverterOptions opts, XmlElement type, out string typename, out string srcfile, out string destfile) + { + srcfile = null; + destfile = null; + + string nsname = type.ParentNode.Attributes ["Name"].Value; + string typefilebase = type.GetAttribute("Name"); + string sourceDir = type.GetAttribute("SourceDirectory"); + typename = type.GetAttribute("DisplayName"); + if (typename.Length == 0) + typename = typefilebase; + + if (opts.onlytype != null && !(nsname + "." + typename).StartsWith(opts.onlytype)) + return; + + srcfile = CombinePath (sourceDir, nsname, typefilebase + ".xml"); + if (srcfile == null) + return; + + destfile = CombinePath (opts.dest, nsname, typefilebase + "." + opts.ext); + } private static void DumpTemplate() { Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("defaulttemplate.xsl"); |