[vala/switch-to-gir: 8/22] vapigen: Assume girparser handles SOURCE file types.



commit f119f63bf24d8a4d396eb640c3e199425ee18144
Author: Luca Bruno <lucabru src gnome org>
Date:   Tue Nov 16 09:39:11 2010 +0100

    vapigen: Assume girparser handles SOURCE file types.

 vala/valagirparser.vala  |    2 ++
 vapigen/valavapigen.vala |   18 +++++++-----------
 2 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 3d257b6..8e4e44c 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -929,6 +929,8 @@ public class Vala.GirParser : CodeVisitor {
 	}
 
 	void postprocess_symbol (Symbol symbol, Metadata metadata) {
+		symbol.external = true;
+
 		// deprecation
 		symbol.replacement = metadata.get_string (ArgumentType.REPLACEMENT);
 		symbol.deprecated_since = element_get_string ("deprecated-version", ArgumentType.DEPRECATED_SINCE);
diff --git a/vapigen/valavapigen.vala b/vapigen/valavapigen.vala
index cb44363..98d006c 100644
--- a/vapigen/valavapigen.vala
+++ b/vapigen/valavapigen.vala
@@ -122,10 +122,14 @@ class Vala.VAPIGen : Object {
 		if (context.report.get_errors () > 0) {
 			return quit ();
 		}
-		
+
 		foreach (string source in sources) {
 			if (FileUtils.test (source, FileTest.EXISTS)) {
-				context.add_source_file (new SourceFile (context, SourceFileType.PACKAGE, source));
+				if (source.has_suffix (".gir")) {
+					context.add_source_file (new SourceFile (context, SourceFileType.SOURCE, source));
+				} else {
+					context.add_source_file (new SourceFile (context, SourceFileType.PACKAGE, source));
+				}
 			} else {
 				Report.error (null, "%s not found".printf (source));
 			}
@@ -164,16 +168,8 @@ class Vala.VAPIGen : Object {
 
 		// interface writer ignores external packages
 		foreach (SourceFile file in context.get_source_files ()) {
-			if (file.filename.has_suffix (".vapi")) {
-				continue;
-			}
-			if (file.filename in sources) {
+			if (!file.filename.has_suffix (".vapi")) {
 				file.file_type = SourceFileType.SOURCE;
-			} else if (file.filename.has_suffix (".metadata")) {
-				string gir_filename = "%s.gir".printf (file.filename.ndup (file.filename.length - ".metadata".length));
-				if (gir_filename in sources) {
-					file.file_type = SourceFileType.SOURCE;
-				}
 			}
 		}
 



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