[vala] GIR writer: Generate <package/> tag



commit 8e69c79011a2f2686553396f4df368c8da4a639a
Author: Didier 'Ptitjes <ptitjes free fr>
Date:   Mon Mar 30 19:12:34 2009 +0200

    GIR writer: Generate <package/> tag
    
    Signed-off-by: Didier 'Ptitjes <ptitjes free fr>
---
 codegen/valagirwriter.vala |    9 ++++++++-
 compiler/valacompiler.vala |    2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index 8424a63..aa34602 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -45,7 +45,7 @@ public class Vala.GIRWriter : CodeVisitor {
 	 * @param context  a code context
 	 * @param filename a relative or absolute filename
 	 */
-	public void write_file (CodeContext context, string directory, string gir_namespace, string gir_version) {
+	public void write_file (CodeContext context, string directory, string gir_namespace, string gir_version, string package) {
 		this.context = context;
 		this.directory = directory;
 		this.gir_namespace = gir_namespace;
@@ -67,6 +67,8 @@ public class Vala.GIRWriter : CodeVisitor {
 		stream.printf (">\n");
 		indent++;
 
+		write_package (package);
+
 		context.accept (this);
 
 		indent--;
@@ -75,6 +77,11 @@ public class Vala.GIRWriter : CodeVisitor {
 		stream = null;
 	}
 
+	private void write_package (string package) {
+		write_indent ();
+		stream.printf ("<package name=\"%s\"/>\n", package);
+	}
+
 	private void write_c_includes (Namespace ns) {
 		// Collect C header filenames
 		Gee.Set<string> header_filenames = new Gee.HashSet<string> (str_hash, str_equal);
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala
index 9a6bf93..2bb6c00 100644
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@ -378,7 +378,7 @@ class Vala.Compiler {
 							gir_directory = context.directory;
 						}
 
-						gir_writer.write_file (context, gir_directory, gir_namespace, gir_version);
+						gir_writer.write_file (context, gir_directory, gir_namespace, gir_version, library);
 					}
 				}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]