]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vapigen: Mark given source-files as such and force girparser to handle them
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 19 Aug 2017 15:01:51 +0000 (17:01 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 27 Aug 2017 08:27:32 +0000 (10:27 +0200)
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
vala/valasourcefile.vala
vapigen/valavapigen.vala

index 9e33a4fbaad07a88692bcdd2255b7e8bc780dc6e..b48dbb3890f742b789c5423a9cffb06a059b1364 100644 (file)
@@ -1887,7 +1887,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);
                                }
index 04dfeff4cbb52109ba8bf149ba7c7f521f3f7a51..621281dc560ee2c8d0f75643ea7a9acfdd1cfb2b 100644 (file)
@@ -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> (); }
index 81b627e92414cc9f2b60c8da5bb73919b3a06698..26f9cea6e73cadb79f472735012f02789259eb1a 100644 (file)
@@ -125,7 +125,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));
                        }