]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Report an error if gio-2.0 is missing for DBus support
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 3 Dec 2020 18:44:06 +0000 (19:44 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 3 Jan 2021 12:16:12 +0000 (13:16 +0100)
vala/valaclass.vala
vala/valainterface.vala
vala/valaobjecttypesymbol.vala

index 532acc19dad811ad3b3f8a6dd6c205e3a135fe63..83e8e8d8596f4ca2e676f65f738c88b79aa5032f 100644 (file)
@@ -502,6 +502,10 @@ public class Vala.Class : ObjectTypeSymbol {
                        return !error;
                }
 
+               if (!base.check (context)) {
+                       return false;
+               }
+
                checked = true;
 
                var old_source_file = context.analyzer.current_source_file;
index 5ee9951355e6c158086b88f3d6444983a8b09720..cdce3ca3803aa623366f590e6a9e4d9ef1748c95 100644 (file)
@@ -202,6 +202,10 @@ public class Vala.Interface : ObjectTypeSymbol {
                        return !error;
                }
 
+               if (!base.check (context)) {
+                       return false;
+               }
+
                checked = true;
 
                var old_source_file = context.analyzer.current_source_file;
index f91c6ba5d8c2a55ade05091ab3369078cfb6532c..c355a447465ca1a653542f2eaa0f482671b23dc4 100644 (file)
@@ -304,4 +304,17 @@ public abstract class Vala.ObjectTypeSymbol : TypeSymbol {
 
                scope.add (null, m);
        }
+
+       public override bool check (CodeContext context) {
+               if (checked) {
+                       return !error;
+               }
+
+               if (!external_package && get_attribute ("DBus") != null && !context.has_package ("gio-2.0")) {
+                       error = true;
+                       Report.error (source_reference, "gio-2.0 package required for DBus support");
+               }
+
+               return !error;
+       }
 }