[vala/switch-to-gir: 25/30] vapigen: Fix marking gir metadata as source.
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/switch-to-gir: 25/30] vapigen: Fix marking gir metadata as source.
- Date: Sat, 25 Dec 2010 12:08:40 +0000 (UTC)
commit 9a2e2406ca7e8222b7d71188d99e03c26516cd91
Author: Luca Bruno <lucabru src gnome org>
Date: Thu Dec 23 14:31:19 2010 +0100
vapigen: Fix marking gir metadata as source.
vapigen/valavapigen.vala | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/vapigen/valavapigen.vala b/vapigen/valavapigen.vala
index cb44363..3c263f5 100644
--- a/vapigen/valavapigen.vala
+++ b/vapigen/valavapigen.vala
@@ -122,13 +122,9 @@ 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));
- } else {
- Report.error (null, "%s not found".printf (source));
- }
+ context.add_source_file (new SourceFile (context, SourceFileType.PACKAGE, source));
}
if (context.report.get_errors () > 0) {
@@ -167,12 +163,19 @@ class Vala.VAPIGen : Object {
if (file.filename.has_suffix (".vapi")) {
continue;
}
+
if (file.filename in sources) {
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;
+ if (file.filename.has_suffix (".gir")) {
+ // mark relative metadata as source
+ string? metadata_filename = context.get_metadata_path (file.filename);
+ if (metadata_filename != null) {
+ foreach (SourceFile metadata_file in context.get_source_files ()) {
+ if (metadata_file.filename == metadata_filename) {
+ metadata_file.file_type = SourceFileType.SOURCE;
+ }
+ }
+ }
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]