On Tue, 2010-10-26 at 22:29 +0200, pancake wrote:
> Is there any work to make valadoc compile for vala 0.12?

I've attached a patch for getting valadoc to compile against 0.12, but I
haven't been able to get it to actually work... I get the following
error, then valadoc segfaults:

(valadoc:6813): GLib-GObject-WARNING **: invalid cast from
`ValadocContentText' to `ValadocContentParagraph'

I haven't had time to investigate what the problem is, but if someone
else has the time (and inclination), this patch should help.

-Evan
>From 37af9150e7431a587ecbf4021fe92be2b21d0ee6 Mon Sep 17 00:00:00 2001
From: Evan Nemerson <[email protected]>
Date: Tue, 19 Oct 2010 17:26:59 -0700
Subject: [PATCH] Fix building with Vala 0.12 branch

---
 configure.in                                       |    4 ++--
 src/doclets/gtkdoc/doclet.vala                     |    3 ++-
 src/libvaladoc/api/field.vala                      |    2 +-
 src/libvaladoc/api/method.vala                     |    2 +-
 src/libvaladoc/api/tree.vala                       |   16 ++++++++--------
 src/libvaladoc/html/htmlmarkupwriter.vala          |    4 ++--
 .../importer/girdocumentationimporter.vala         |    2 +-
 7 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/configure.in b/configure.in
index 9776d43..2d606cc 100644
--- a/configure.in
+++ b/configure.in
@@ -25,8 +25,8 @@ AM_CONDITIONAL(ENABLE_VALADOCORG, test x$enable_valadocorg = xyes)
 
 
 
-VALA_PACKAGE=vala-0.10
-LIBVALA_REQUIRED=0.10.0
+VALA_PACKAGE=libvala-0.12
+LIBVALA_REQUIRED=0.11.0
 LIBGEE_REQUIRED=0.5
 LIBGVC_REQUIRED=2.16
 GLIB_REQUIRED=2.12.0
diff --git a/src/doclets/gtkdoc/doclet.vala b/src/doclets/gtkdoc/doclet.vala
index 9d2c1f6..c0b273a 100644
--- a/src/doclets/gtkdoc/doclet.vala
+++ b/src/doclets/gtkdoc/doclet.vala
@@ -51,7 +51,8 @@ namespace Gtkdoc.Config {
 			var opt_context = new OptionContext ("- Vala GTK-Doc");
 			opt_context.set_help_enabled (true);
 			opt_context.add_main_entries (options, null);
-			opt_context.parse (ref args);
+			unowned string[] gtkdoc_args = args;
+			opt_context.parse (ref gtkdoc_args);
 		} catch (OptionError e) {
 			warning ("GtkDoc: Error: %s", e.message);
 			warning ("GtkDoc: Run '-X --help' to see a full list of available command line options.\n");
diff --git a/src/libvaladoc/api/field.vala b/src/libvaladoc/api/field.vala
index 3203603..d94d26e 100644
--- a/src/libvaladoc/api/field.vala
+++ b/src/libvaladoc/api/field.vala
@@ -41,7 +41,7 @@ public class Valadoc.Api.Field : Member {
 				return false;
 			}
 
-			return ((Vala.Field) symbol).binding == MemberBinding.STATIC;
+			return ((Vala.Field) symbol).binding == Vala.MemberBinding.STATIC;
 		}
 	}
 
diff --git a/src/libvaladoc/api/method.vala b/src/libvaladoc/api/method.vala
index cca6686..a62bd41 100644
--- a/src/libvaladoc/api/method.vala
+++ b/src/libvaladoc/api/method.vala
@@ -78,7 +78,7 @@ public class Valadoc.Api.Method : Member {
 			if (is_constructor) {
 				return false;
 			}
-			return ((Vala.Method) symbol).binding == MemberBinding.STATIC;
+			return ((Vala.Method) symbol).binding == Vala.MemberBinding.STATIC;
 		}
 	}
 
diff --git a/src/libvaladoc/api/tree.vala b/src/libvaladoc/api/tree.vala
index 2bcb5a9..5b07ad2 100644
--- a/src/libvaladoc/api/tree.vala
+++ b/src/libvaladoc/api/tree.vala
@@ -158,7 +158,7 @@ public class Valadoc.Api.Tree {
 		this.context.experimental = settings.experimental;
 		this.context.experimental_non_null = settings.experimental || settings.experimental_non_null;
 		this.context.dbus_transformation = !settings.disable_dbus_transformation;
-
+		this.context.vapi_directories = settings.vapi_directories;
 
 		if (settings.basedir == null) {
 			context.basedir = realpath (".");
@@ -237,15 +237,15 @@ public class Valadoc.Api.Tree {
 			return true;
 		}
 
-		var package_path = context.get_package_path (pkg, settings.vapi_directories);
+		var package_path = context.get_vapi_path (pkg) ?? context.get_gir_path (pkg);
 		if (package_path == null) {
+			Vala.Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (pkg));
 			return false;
 		}
 
 		context.add_package (pkg);
 
-
-		var vfile = new Vala.SourceFile (context, package_path, true);
+		var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, package_path);
 		context.add_source_file (vfile);
 
 		Package vdpkg = new Package (vfile, pkg, true);
@@ -281,7 +281,7 @@ public class Valadoc.Api.Tree {
 	public void add_depencies (string[] packages) {
 		foreach (string package in packages) {
 			if (!add_package (package)) {
-				Vala.Report.error (null, "%s not found in specified Vala API directories".printf (package));
+				Vala.Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (package));
 			}
 		}
 	}
@@ -295,7 +295,7 @@ public class Valadoc.Api.Tree {
 			if (FileUtils.test (source, FileTest.EXISTS)) {
 				var rpath = realpath (source);
 				if (source.has_suffix (".vala") || source.has_suffix (".gs")) {
-					var source_file = new Vala.SourceFile (context, rpath);
+					var source_file = new Vala.SourceFile (context, Vala.SourceFileType.SOURCE, rpath);
 
 
 					if (this.sourcefiles == null) {
@@ -320,9 +320,9 @@ public class Valadoc.Api.Tree {
 					context.add_source_file (source_file);
 				} else if (source.has_suffix (".vapi")) {
 					string file_name = Path.get_basename (source);
-					file_name = file_name.ndup (file_name.size() - ".vapi".size());
+					file_name = file_name.ndup (file_name.length - ".vapi".length);
 
-					var vfile = new Vala.SourceFile (context, rpath, true);
+					var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, rpath);
 					Package vdpkg = new Package (vfile, file_name);
 					context.add_source_file (vfile);
 					this.packages.add (vdpkg);
diff --git a/src/libvaladoc/html/htmlmarkupwriter.vala b/src/libvaladoc/html/htmlmarkupwriter.vala
index 7fbf6e1..7599d18 100755
--- a/src/libvaladoc/html/htmlmarkupwriter.vala
+++ b/src/libvaladoc/html/htmlmarkupwriter.vala
@@ -67,7 +67,7 @@ public class Valadoc.Html.MarkupWriter : Valadoc.MarkupWriter {
 		return this;
 	}
 
-	private override bool inline_element (string name) {
+	protected override bool inline_element (string name) {
 		return name != "html"
 			&& name != "head"
 			&& name != "title"
@@ -90,7 +90,7 @@ public class Valadoc.Html.MarkupWriter : Valadoc.MarkupWriter {
 			&& name != "img";
 	}
 
-	private override bool content_inline_element (string name) {
+	protected override bool content_inline_element (string name) {
 		return name == "title"
 			|| name == "p"
 			|| name == "a"
diff --git a/src/libvaladoc/importer/girdocumentationimporter.vala b/src/libvaladoc/importer/girdocumentationimporter.vala
index a76215b..19c5999 100644
--- a/src/libvaladoc/importer/girdocumentationimporter.vala
+++ b/src/libvaladoc/importer/girdocumentationimporter.vala
@@ -53,7 +53,7 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter {
 
 	void parse_file (string gir_file) {
 		reader = new Vala.MarkupReader (gir_file);
-		this.current_source_file = new Vala.SourceFile (tree.context, GLib.Path. get_basename (gir_file));
+		this.current_source_file = new Vala.SourceFile (tree.context, Vala.SourceFileType.PACKAGE, GLib.Path.get_basename (gir_file));
 
 		// xml prolog
 		next ();
-- 
1.7.2.3

_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to