Commit 23a30105 authored by Daniel Espinosa Ortiz's avatar Daniel Espinosa Ortiz

server: add complementary packages for GLib

requiring to add GLib namespace, now load glib-2.0, gio-2.0
and gobject-2.0 packages, by default.
parent b4665335
Pipeline #42368 failed with stages
in 10 minutes and 56 seconds
......@@ -46,6 +46,10 @@ build:
- ninja
- GDK_BACKEND=broadway meson test
- ninja install
artifacts:
when: on_failure
paths:
- meson-logs/testlog.txt
pages:
stage: deploy
......
......@@ -69,7 +69,11 @@ public class GVls.GServer : GLib.Object, ContainerHashable, Server
throw new ServerError.NO_FILE_ERROR ("File doesn't exists: %s", file.get_path ());
var context = new Vala.CodeContext ();
CodeContext.push (context);
source = new Vala.SourceFile (context, Vala.SourceFileType.SOURCE, file.get_path ());
Vala.SourceFileType stype = Vala.SourceFileType.SOURCE;
if (file.get_uri ().has_suffix (".vapi")) {
stype = Vala.SourceFileType.PACKAGE;
}
source = new Vala.SourceFile (context, stype, file.get_path ());
_file = file;
parse_content (source);
if (root_server != null) {
......
......@@ -109,6 +109,8 @@ public interface GVls.Server : GLib.Object, ContainerHashable
*/
public virtual void add_default_namespaces () throws GLib.Error {
add_pkg ("glib-2.0");
add_pkg ("gio-2.0");
add_pkg ("gobject-2.0");
}
/**
* For current Vala API, add search directories for namespaces.
......@@ -197,9 +199,16 @@ public interface GVls.Server : GLib.Object, ContainerHashable
}
GLib.File nsf = null;
if (root_server != null) {
message ("Number of vapidirs: %u", root_server.vapi_dirs.get_n_items ());
nsf = root_server.find_namespace_file (ns);
if (ns == "GLib") {
root_server.add_default_namespaces ();
return true;
}
root_server.find_namespace_file (ns);
} else {
if (ns == "GLib") {
add_default_namespaces ();
return true;
}
nsf = find_namespace_file (ns);
}
if (nsf == null) {
......
......@@ -43,5 +43,5 @@ namespace MyTwo {
}
class Tycom {
public int rock { get; }
public int rock { get; set; }
}
......@@ -256,6 +256,8 @@ class Tests {
server.add_default_vapi_dirs ();
var glibf = server.find_namespace_file ("GLib");
assert (glibf != null);
server.add_default_namespaces ();
assert (server.servers.get_n_items () == 3);
server.parse (glibf);
assert (server.symbols.get_n_items () != 0);
var root = server.get_symbol("@RootNamespace@");
......@@ -311,11 +313,13 @@ class Tests {
server1.parse (file1);
server2.parse (file2);
message ("Servers: %u", server.servers.get_n_items ());
assert (server.servers.get_n_items () == 4);
assert (server.servers.get_n_items () == 6);
assert (server.get_symbol ("GLib") != null);
assert (server.get_symbol ("string") != null);
assert (server.get_symbol ("string.replace") != null);
assert (server.get_symbol ("Cairo") != null);
assert (server.get_symbol ("Object") != null);
assert (server.get_symbol ("InputStream") != null);
} catch (GLib.Error e) {
message ("Error: %s", e.message);
assert_not_reached ();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment