Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs/tools
diff options
context:
space:
mode:
authorJonathan Pryor <jpryor@novell.com>2010-02-27 01:27:00 +0300
committerJonathan Pryor <jpryor@novell.com>2010-02-27 01:27:00 +0300
commit170e3d25119fbe93b34a52d20c59150b6c0b7bb7 (patch)
treece95de4d90279999ac147b9e0325772cfaab2af9 /mcs/tools
parentc5a5132df0d4f5c5dbf7ccbba3330aababf6ddcf (diff)
* Makefile: Add a System.Core.dll reference; embed monodoc.xml as a
resource. * Monodoc/provider.cs: Add a RootTree.LoadTree(string,XmlDocument,IEnumerable<string>) method. This is so 'mdoc export-html-webdoc' doesn't need to rely on the system-wide .source files (allowing execution w/o changing/replacing the system-wide .source files) and so MonoDevelop can support multiple .source files spread throughout the system sanely. * Monodoc/ecma-provider.cs: Always add the extension methods contained in the current EcmaHelpSource, instead of implicitly requiring that the current EcmaHelpSource also be contained within RootTree.HelpSources. This simplifies logic in 'mdoc'. svn path=/branches/mono-2-6/mcs/; revision=152588
Diffstat (limited to 'mcs/tools')
-rw-r--r--mcs/tools/monodoc/ChangeLog15
-rw-r--r--mcs/tools/monodoc/Makefile3
-rw-r--r--mcs/tools/monodoc/Monodoc/ecma-provider.cs24
-rw-r--r--mcs/tools/monodoc/Monodoc/provider.cs143
4 files changed, 120 insertions, 65 deletions
diff --git a/mcs/tools/monodoc/ChangeLog b/mcs/tools/monodoc/ChangeLog
index a1db250ea50..c2c291722e8 100644
--- a/mcs/tools/monodoc/ChangeLog
+++ b/mcs/tools/monodoc/ChangeLog
@@ -1,3 +1,18 @@
+2010-02-26 Jonathan Pryor <jpryor@novell.com>
+
+ * Makefile: Add a System.Core.dll reference; embed monodoc.xml as a
+ resource.
+ * Monodoc/provider.cs: Add a
+ RootTree.LoadTree(string,XmlDocument,IEnumerable<string>) method.
+ This is so 'mdoc export-html-webdoc' doesn't need to rely on the
+ system-wide .source files (allowing execution w/o changing/replacing
+ the system-wide .source files) and so MonoDevelop can support
+ multiple .source files spread throughout the system sanely.
+ * Monodoc/ecma-provider.cs: Always add the extension methods contained
+ in the current EcmaHelpSource, instead of implicitly requiring that
+ the current EcmaHelpSource also be contained within
+ RootTree.HelpSources. This simplifies logic in 'mdoc'.
+
2010-01-13 Jonathan Pryor <jpryor@novell.com>
* Monodoc/provider.cs, Monodoc/ecma-provider.cs: Improve cache support
diff --git a/mcs/tools/monodoc/Makefile b/mcs/tools/monodoc/Makefile
index 56a09ea44b9..f605e3310b5 100644
--- a/mcs/tools/monodoc/Makefile
+++ b/mcs/tools/monodoc/Makefile
@@ -6,6 +6,7 @@ LIBRARY = monodoc.dll
LIBRARY_PACKAGE = monodoc
RESOURCE_FILES = \
+ ../../docs/monodoc.xml \
Resources/base.css \
Resources/ecmaspec-html-css.xsl \
Resources/ecmaspec-html.xsl \
@@ -43,6 +44,7 @@ LIB_MCS_FLAGS = \
/codepage:utf8 \
/nowarn:169,164,162,168,219 \
/r:Commons.Xml.Relaxng \
+ /resource:../../docs/monodoc.xml,monodoc.xml \
/resource:Resources/base.css,base.css \
/resource:Resources/ecmaspec-html-css.xsl,ecmaspec-html-css.xsl \
/resource:Resources/ecmaspec-html.xsl,ecmaspec-html.xsl \
@@ -62,6 +64,7 @@ LIB_MCS_FLAGS = \
/r:ICSharpCode.SharpZipLib \
/r:$(corlib) \
/r:System.dll \
+ /r:System.Core.dll \
/r:System.Web \
/r:System.Web.Services \
/r:System.Xml.dll
diff --git a/mcs/tools/monodoc/Monodoc/ecma-provider.cs b/mcs/tools/monodoc/Monodoc/ecma-provider.cs
index 3b9d6da5bc1..3ff733958bd 100644
--- a/mcs/tools/monodoc/Monodoc/ecma-provider.cs
+++ b/mcs/tools/monodoc/Monodoc/ecma-provider.cs
@@ -1223,18 +1223,14 @@ public class EcmaHelpSource : HelpSource {
basetype = basetypedoc.SelectSingleNode("Type/Base/BaseTypeName");
}
ArrayList extensions = new ArrayList ();
+ AddExtensionMethodsFromHelpSource (extensions, this);
foreach (HelpSource hs in RootTree.HelpSources) {
EcmaHelpSource es = hs as EcmaHelpSource;
if (es == null)
continue;
- Stream s = es.GetHelpStream ("ExtensionMethods.xml");
- if (s != null) {
- XmlDocument d = new XmlDocument ();
- d.Load (s);
- foreach (XmlNode n in d.SelectNodes ("/ExtensionMethods/*")) {
- extensions.Add (n);
- }
- }
+ if (es == this)
+ continue;
+ AddExtensionMethodsFromHelpSource (extensions, es);
}
XmlDocUtils.AddExtensionMethods (doc, extensions, delegate (string s) {
s = s.StartsWith ("T:") ? s : "T:" + s;
@@ -1311,6 +1307,18 @@ public class EcmaHelpSource : HelpSource {
return BuildHtml (css_ecma_code, js_code, html);
}
+ void AddExtensionMethodsFromHelpSource (ArrayList extensions, EcmaHelpSource es)
+ {
+ Stream s = es.GetHelpStream ("ExtensionMethods.xml");
+ if (s != null) {
+ XmlDocument d = new XmlDocument ();
+ d.Load (s);
+ foreach (XmlNode n in d.SelectNodes ("/ExtensionMethods/*")) {
+ extensions.Add (n);
+ }
+ }
+ }
+
public override void RenderPreviewDocs (XmlNode newNode, XmlWriter writer)
{
diff --git a/mcs/tools/monodoc/Monodoc/provider.cs b/mcs/tools/monodoc/Monodoc/provider.cs
index 73199e97651..9092241decb 100644
--- a/mcs/tools/monodoc/Monodoc/provider.cs
+++ b/mcs/tools/monodoc/Monodoc/provider.cs
@@ -13,12 +13,15 @@
//
namespace Monodoc {
using System;
+using System.Collections.Generic;
using System.IO;
+using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Diagnostics;
using System.Configuration;
+using System.Reflection;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.XPath;
@@ -868,17 +871,37 @@ public class RootTree : Tree {
basedir = d.SelectSingleNode ("config/path").Attributes ["docsPath"].Value;
}
}
- XmlDocument doc = new XmlDocument ();
- RootTree root = new RootTree ();
- root.basedir = basedir;
-
//
// Load the layout
//
+ XmlDocument doc = new XmlDocument ();
string layout = Path.Combine (basedir, "monodoc.xml");
doc.Load (layout);
- XmlNodeList nodes = doc.SelectNodes ("/node/node");
+
+ return LoadTree (basedir, doc,
+ Directory.GetFiles (Path.Combine (basedir, "sources"))
+ .Where (file => file.EndsWith (".source")));
+ }
+
+ public static RootTree LoadTree (string indexDir, XmlDocument docTree, IEnumerable<string> sourceFiles)
+ {
+ if (docTree == null) {
+ docTree = new XmlDocument ();
+ using (var defTree = typeof(RootTree).Assembly.GetManifestResourceStream ("monodoc.xml"))
+ docTree.Load (defTree);
+ }
+
+ sourceFiles = sourceFiles ?? new string [0];
+
+ //
+ // Load the layout
+ //
+
+ RootTree root = new RootTree ();
+ root.basedir = indexDir;
+
+ XmlNodeList nodes = docTree.SelectNodes ("/node/node");
root.name_to_node ["root"] = root;
root.name_to_node ["libraries"] = root;
@@ -893,7 +916,8 @@ public class RootTree : Tree {
//
// Load the sources
//
- root.AddSource (Path.Combine (basedir, "sources"));
+ foreach (var sourceFile in sourceFiles)
+ root.AddSourceFile (sourceFile);
foreach (string path in UncompiledHelpSources) {
EcmaUncompiledHelpSource hs = new EcmaUncompiledHelpSource(path);
@@ -918,70 +942,75 @@ public class RootTree : Tree {
public void AddSource (string sources_dir)
{
- Node third_party = LookupEntryPoint ("various") ?? this;
-
string [] files = Directory.GetFiles (sources_dir);
foreach (string file in files){
if (!file.EndsWith (".source"))
continue;
+ AddSourceFile (file);
+ }
+ }
- XmlDocument doc = new XmlDocument ();
- try {
- doc.Load (file);
- } catch {
- Console.Error.WriteLine ("Error: Could not load source file {0}", file);
+ public void AddSourceFile (string sourceFile)
+ {
+ Node third_party = LookupEntryPoint ("various") ?? this;
+
+ XmlDocument doc = new XmlDocument ();
+ try {
+ doc.Load (sourceFile);
+ }
+ catch {
+ Console.Error.WriteLine ("Error: Could not load source file {0}", sourceFile);
+ return;
+ }
+
+ XmlNodeList extra_nodes = doc.SelectNodes ("/monodoc/node");
+ if (extra_nodes.Count > 0)
+ Populate (third_party, extra_nodes);
+
+ XmlNodeList sources = doc.SelectNodes ("/monodoc/source");
+ if (sources == null){
+ Console.Error.WriteLine ("Error: No <source> section found in the {0} file", sourceFile);
+ return;
+ }
+ foreach (XmlNode source in sources){
+ XmlAttribute a = source.Attributes ["provider"];
+ if (a == null){
+ Console.Error.WriteLine ("Error: no provider in <source>");
continue;
}
+ string provider = a.InnerText;
+ a = source.Attributes ["basefile"];
+ if (a == null){
+ Console.Error.WriteLine ("Error: no basefile in <source>");
+ continue;
+ }
+ string basefile = a.InnerText;
+ a = source.Attributes ["path"];
+ if (a == null){
+ Console.Error.WriteLine ("Error: no path in <source>");
+ continue;
+ }
+ string path = a.InnerText;
- XmlNodeList extra_nodes = doc.SelectNodes ("/monodoc/node");
- if (extra_nodes.Count > 0)
- Populate (third_party, extra_nodes);
-
- XmlNodeList sources = doc.SelectNodes ("/monodoc/source");
- if (sources == null){
- Console.Error.WriteLine ("Error: No <source> section found in the {0} file", file);
+ string basefilepath = Path.Combine (Path.GetDirectoryName (sourceFile), basefile);
+ HelpSource hs = GetHelpSource (provider, basefilepath);
+ if (hs == null)
continue;
+ hs.RootTree = this;
+ help_sources.Add (hs);
+ name_to_hs [path] = hs;
+
+ Node parent = LookupEntryPoint (path);
+ if (parent == null){
+ Console.Error.WriteLine ("node `{0}' is not defined on the documentation map", path);
+ parent = third_party;
}
- foreach (XmlNode source in sources){
- XmlAttribute a = source.Attributes ["provider"];
- if (a == null){
- Console.Error.WriteLine ("Error: no provider in <source>");
- continue;
- }
- string provider = a.InnerText;
- a = source.Attributes ["basefile"];
- if (a == null){
- Console.Error.WriteLine ("Error: no basefile in <source>");
- continue;
- }
- string basefile = a.InnerText;
- a = source.Attributes ["path"];
- if (a == null){
- Console.Error.WriteLine ("Error: no path in <source>");
- continue;
- }
- string path = a.InnerText;
-
- string basefilepath = Path.Combine (sources_dir, basefile);
- HelpSource hs = GetHelpSource (provider, basefilepath);
- if (hs == null)
- continue;
- hs.RootTree = this;
- help_sources.Add (hs);
- name_to_hs [path] = hs;
-
- Node parent = LookupEntryPoint (path);
- if (parent == null){
- Console.Error.WriteLine ("node `{0}' is not defined on the documentation map", path);
- parent = third_party;
- }
- foreach (Node n in hs.Tree.Nodes){
- parent.AddNode (n);
- }
- parent.Sort ();
+ foreach (Node n in hs.Tree.Nodes){
+ parent.AddNode (n);
}
+ parent.Sort ();
}
}