diff options
Diffstat (limited to 'test cases/vala/8 generated sources/dependency-generated')
7 files changed, 135 insertions, 0 deletions
diff --git a/test cases/vala/8 generated sources/dependency-generated/enum-types.c.template b/test cases/vala/8 generated sources/dependency-generated/enum-types.c.template new file mode 100644 index 0000000..9d45a93 --- /dev/null +++ b/test cases/vala/8 generated sources/dependency-generated/enum-types.c.template @@ -0,0 +1,43 @@ +/*** BEGIN file-header ***/ + +#include "enum-types.h" + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +#include "@filename@" +/*** END file-production ***/ + + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) +{ + static gsize static_g_define_type_id = 0; + + if (g_once_init_enter (&static_g_define_type_id)) { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + GType g_define_type_id = + g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); + + g_once_init_leave (&static_g_define_type_id, g_define_type_id); + } + + return static_g_define_type_id; +} + +/*** END value-tail ***/ + +/*** BEGIN file-tail ***/ + +/*** END file-tail ***/ diff --git a/test cases/vala/8 generated sources/dependency-generated/enum-types.h.template b/test cases/vala/8 generated sources/dependency-generated/enum-types.h.template new file mode 100644 index 0000000..e5478ab --- /dev/null +++ b/test cases/vala/8 generated sources/dependency-generated/enum-types.h.template @@ -0,0 +1,26 @@ +/*** BEGIN file-header ***/ + +#ifndef __EXAMPLE_ENUMS_TYPES_H__ +#define __EXAMPLE_ENUMS_TYPES_H__ + +#include <glib-object.h> +#include "enums.h" + +G_BEGIN_DECLS +/*** END file-header ***/ + +/*** BEGIN file-production ***/ + +/* enumerations from "@filename@" */ +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType @enum_name@_get_type (void) G_GNUC_CONST; +#define EXAMPLE_TYPE_@ENUMSHORT@ (@enum_name@_get_type ()) +/*** END value-header ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* __EXAMPLE_ENUMS_TYPES_H__ */ +/*** END file-tail ***/ diff --git a/test cases/vala/8 generated sources/dependency-generated/enums.h b/test cases/vala/8 generated sources/dependency-generated/enums.h new file mode 100644 index 0000000..3fb621e --- /dev/null +++ b/test cases/vala/8 generated sources/dependency-generated/enums.h @@ -0,0 +1,15 @@ +#ifndef __EXAMPLE_ENUMS_H__ +#define __EXAMPLE_ENUMS_H__ + +G_BEGIN_DECLS + +typedef enum { + EXAMPLE_VERBOSITY_ERRORS, + EXAMPLE_VERBOSITY_MINIMAL, + EXAMPLE_VERBOSITY_DETAILED, + EXAMPLE_VERBOSITY_DEBUG, +} ExampleVerbosity; + +G_END_DECLS + +#endif /* __EXAMPLE_ENUMS_H__ */ diff --git a/test cases/vala/8 generated sources/dependency-generated/lib.vala b/test cases/vala/8 generated sources/dependency-generated/lib.vala new file mode 100644 index 0000000..3fcbb7f --- /dev/null +++ b/test cases/vala/8 generated sources/dependency-generated/lib.vala @@ -0,0 +1,3 @@ +int whatever() { + return 0; +} diff --git a/test cases/vala/8 generated sources/dependency-generated/main.vala b/test cases/vala/8 generated sources/dependency-generated/main.vala new file mode 100644 index 0000000..33c14ce --- /dev/null +++ b/test cases/vala/8 generated sources/dependency-generated/main.vala @@ -0,0 +1,3 @@ +int main() { + return 0; +} diff --git a/test cases/vala/8 generated sources/dependency-generated/meson.build b/test cases/vala/8 generated sources/dependency-generated/meson.build new file mode 100644 index 0000000..a1895b4 --- /dev/null +++ b/test cases/vala/8 generated sources/dependency-generated/meson.build @@ -0,0 +1,44 @@ +# Test that dependencies with their own generated sources don't +# confuse the Vala build instruction generator. + +# Test case for https://github.com/mesonbuild/meson/issues/1084 + +gnome = import('gnome') + +gobject = dependency('gobject-2.0') + +enums = gnome.mkenums('enum-types', + sources: 'enums.h', + c_template: 'enum-types.c.template', + h_template: 'enum-types.h.template', +) + +libcommon = library('common', + enums[0], enums[1], + dependencies: gobject) + +common_dep = declare_dependency( + # This is required so that whoever depends on this also depends + # on the generated header; that won't happen implicitly. + # See: https://github.com/mesonbuild/meson/issues/1084 + sources: enums[1], + link_with: libcommon, +) + +libplover_vala = library('plover', + 'lib.vala', + dependencies: [common_dep, gobject] +) + +plover_dep = declare_dependency( + link_with: libplover_vala, + dependencies: common_dep +) + +vala_prog = executable('hello', + 'main.vala', + link_with: libplover_vala, + # There's no need to specify common_dep here since plover_dep pulls it + # in, but it should be harmless to do so. + dependencies: [common_dep, plover_dep, gobject] +) diff --git a/test cases/vala/8 generated sources/dependency-generated/null.c b/test cases/vala/8 generated sources/dependency-generated/null.c new file mode 100644 index 0000000..8337712 --- /dev/null +++ b/test cases/vala/8 generated sources/dependency-generated/null.c @@ -0,0 +1 @@ +// |