[vala/0.36: 42/212] vapigen: Mark given source-files as such and force girparser to handle them
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.36: 42/212] vapigen: Mark given source-files as such and force girparser to handle them
- Date: Sat, 14 Apr 2018 07:46:53 +0000 (UTC)
commit 5e1dd9d9457f4dcf663c2e20d6dc71e840df5572
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Aug 19 17:01:51 2017 +0200
vapigen: Mark given source-files as such and force girparser to handle them
E.g. gtk+-4.0 is *one* library with multiple namespaces and gir files. So
we need to handle this case and allow all explicitly given GIR files to be
parsed.
vala/valagirparser.vala | 5 ++++-
vala/valasourcefile.vala | 5 +++++
vapigen/valavapigen.vala | 4 +++-
3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 43685c9..68a2b89 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1883,7 +1883,10 @@ public class Vala.GirParser : CodeVisitor {
this.current_source_file.package_name = pkg;
if (context.has_package (pkg)) {
// package already provided elsewhere, stop parsing this GIR
- return;
+ // if it was not passed explicitly
+ if (!this.current_source_file.explicit) {
+ return;
+ }
} else {
context.add_package (pkg);
}
diff --git a/vala/valasourcefile.vala b/vala/valasourcefile.vala
index 04dfeff..621281d 100644
--- a/vala/valasourcefile.vala
+++ b/vala/valasourcefile.vala
@@ -142,6 +142,11 @@ public class Vala.SourceFile {
*/
public bool used { get; set; }
+ /**
+ * Whether this source-file was explicitly passed on the commandline.
+ */
+ public bool explicit { get; set; }
+
private ArrayList<Comment> comments = new ArrayList<Comment> ();
public List<UsingDirective> current_using_directives { get; set; default = new
ArrayList<UsingDirective> (); }
diff --git a/vapigen/valavapigen.vala b/vapigen/valavapigen.vala
index 287ec7a..b1ad04d 100644
--- a/vapigen/valavapigen.vala
+++ b/vapigen/valavapigen.vala
@@ -131,7 +131,9 @@ class Vala.VAPIGen : Object {
foreach (string source in sources) {
if (FileUtils.test (source, FileTest.EXISTS)) {
- context.add_source_file (new SourceFile (context, SourceFileType.PACKAGE,
source));
+ var source_file = new SourceFile (context, SourceFileType.PACKAGE, source);
+ source_file.explicit = true;
+ context.add_source_file (source_file);
} else {
Report.error (null, "%s not found".printf (source));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]