gnome: Allow passing build_by_default: to some functions
Closes https://github.com/mesonbuild/meson/issues/2174
This commit is contained in:
parent
60b83a5f0a
commit
556966003e
|
@ -92,7 +92,7 @@ class GnomeModule(ExtensionModule):
|
||||||
gdbuswarning_printed = True
|
gdbuswarning_printed = True
|
||||||
|
|
||||||
@permittedKwargs({'source_dir', 'c_name', 'dependencies', 'export', 'gresource_bundle', 'install_header',
|
@permittedKwargs({'source_dir', 'c_name', 'dependencies', 'export', 'gresource_bundle', 'install_header',
|
||||||
'install', 'install_dir', 'extra_args'})
|
'install', 'install_dir', 'extra_args', 'build_by_default'})
|
||||||
def compile_resources(self, state, args, kwargs):
|
def compile_resources(self, state, args, kwargs):
|
||||||
self.__print_gresources_warning(state)
|
self.__print_gresources_warning(state)
|
||||||
glib_version = self._get_native_glib_version(state)
|
glib_version = self._get_native_glib_version(state)
|
||||||
|
@ -210,6 +210,8 @@ class GnomeModule(ExtensionModule):
|
||||||
# The header doesn't actually care about the files yet it errors if missing
|
# The header doesn't actually care about the files yet it errors if missing
|
||||||
'depends': depends
|
'depends': depends
|
||||||
}
|
}
|
||||||
|
if 'build_by_default' in kwargs:
|
||||||
|
h_kwargs['build_by_default'] = kwargs['build_by_default']
|
||||||
if install_header:
|
if install_header:
|
||||||
h_kwargs['install'] = install_header
|
h_kwargs['install'] = install_header
|
||||||
h_kwargs['install_dir'] = kwargs.get('install_dir',
|
h_kwargs['install_dir'] = kwargs.get('install_dir',
|
||||||
|
@ -393,7 +395,7 @@ class GnomeModule(ExtensionModule):
|
||||||
@permittedKwargs({'sources', 'nsversion', 'namespace', 'symbol_prefix', 'identifier_prefix',
|
@permittedKwargs({'sources', 'nsversion', 'namespace', 'symbol_prefix', 'identifier_prefix',
|
||||||
'export_packages', 'includes', 'dependencies', 'link_with', 'include_directories',
|
'export_packages', 'includes', 'dependencies', 'link_with', 'include_directories',
|
||||||
'install', 'install_dir_gir', 'install_dir_typelib', 'extra_args',
|
'install', 'install_dir_gir', 'install_dir_typelib', 'extra_args',
|
||||||
'packages'})
|
'packages', 'build_by_default'})
|
||||||
def generate_gir(self, state, args, kwargs):
|
def generate_gir(self, state, args, kwargs):
|
||||||
if len(args) != 1:
|
if len(args) != 1:
|
||||||
raise MesonException('Gir takes one argument')
|
raise MesonException('Gir takes one argument')
|
||||||
|
@ -592,6 +594,8 @@ class GnomeModule(ExtensionModule):
|
||||||
scankwargs['install'] = kwargs['install']
|
scankwargs['install'] = kwargs['install']
|
||||||
scankwargs['install_dir'] = kwargs.get('install_dir_gir',
|
scankwargs['install_dir'] = kwargs.get('install_dir_gir',
|
||||||
os.path.join(state.environment.get_datadir(), 'gir-1.0'))
|
os.path.join(state.environment.get_datadir(), 'gir-1.0'))
|
||||||
|
if 'build_by_default' in kwargs:
|
||||||
|
scankwargs['build_by_default'] = kwargs['build_by_default']
|
||||||
scan_target = GirTarget(girfile, state.subdir, scankwargs)
|
scan_target = GirTarget(girfile, state.subdir, scankwargs)
|
||||||
|
|
||||||
typelib_output = '%s-%s.typelib' % (ns, nsversion)
|
typelib_output = '%s-%s.typelib' % (ns, nsversion)
|
||||||
|
@ -608,11 +612,13 @@ class GnomeModule(ExtensionModule):
|
||||||
typelib_kwargs['install'] = kwargs['install']
|
typelib_kwargs['install'] = kwargs['install']
|
||||||
typelib_kwargs['install_dir'] = kwargs.get('install_dir_typelib',
|
typelib_kwargs['install_dir'] = kwargs.get('install_dir_typelib',
|
||||||
os.path.join(state.environment.get_libdir(), 'girepository-1.0'))
|
os.path.join(state.environment.get_libdir(), 'girepository-1.0'))
|
||||||
|
if 'build_by_default' in kwargs:
|
||||||
|
typelib_kwargs['build_by_default'] = kwargs['build_by_default']
|
||||||
typelib_target = TypelibTarget(typelib_output, state.subdir, typelib_kwargs)
|
typelib_target = TypelibTarget(typelib_output, state.subdir, typelib_kwargs)
|
||||||
rv = [scan_target, typelib_target]
|
rv = [scan_target, typelib_target]
|
||||||
return ModuleReturnValue(rv, rv)
|
return ModuleReturnValue(rv, rv)
|
||||||
|
|
||||||
@noKwargs
|
@permittedKwargs({'build_by_default'})
|
||||||
def compile_schemas(self, state, args, kwargs):
|
def compile_schemas(self, state, args, kwargs):
|
||||||
if args:
|
if args:
|
||||||
raise MesonException('Compile_schemas does not take positional arguments.')
|
raise MesonException('Compile_schemas does not take positional arguments.')
|
||||||
|
@ -816,7 +822,7 @@ class GnomeModule(ExtensionModule):
|
||||||
|
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@permittedKwargs({'interface_prefix', 'namespace', 'object_manager'})
|
@permittedKwargs({'interface_prefix', 'namespace', 'object_manager', 'build_by_default'})
|
||||||
def gdbus_codegen(self, state, args, kwargs):
|
def gdbus_codegen(self, state, args, kwargs):
|
||||||
if len(args) != 2:
|
if len(args) != 2:
|
||||||
raise MesonException('Gdbus_codegen takes two arguments, name and xml file.')
|
raise MesonException('Gdbus_codegen takes two arguments, name and xml file.')
|
||||||
|
@ -842,6 +848,8 @@ class GnomeModule(ExtensionModule):
|
||||||
'output': outputs,
|
'output': outputs,
|
||||||
'command': cmd
|
'command': cmd
|
||||||
}
|
}
|
||||||
|
if 'build_by_default' in kwargs:
|
||||||
|
custom_kwargs['build_by_default'] = kwargs['build_by_default']
|
||||||
ct = build.CustomTarget(target_name, state.subdir, custom_kwargs)
|
ct = build.CustomTarget(target_name, state.subdir, custom_kwargs)
|
||||||
return ModuleReturnValue(ct, [ct])
|
return ModuleReturnValue(ct, [ct])
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,8 @@ gnome.generate_gir(
|
||||||
includes : ['GObject-2.0', 'MesonDep1-1.0'],
|
includes : ['GObject-2.0', 'MesonDep1-1.0'],
|
||||||
# dep1_dep pulls in dep2_dep for us
|
# dep1_dep pulls in dep2_dep for us
|
||||||
dependencies : [fake_dep, dep1_dep],
|
dependencies : [fake_dep, dep1_dep],
|
||||||
install : true
|
install : true,
|
||||||
|
build_by_default : true,
|
||||||
)
|
)
|
||||||
|
|
||||||
test('gobject introspection/c', girexe)
|
test('gobject introspection/c', girexe)
|
||||||
|
|
|
@ -45,3 +45,11 @@ if glib.version() >= '2.52.0'
|
||||||
dependencies: gio)
|
dependencies: gio)
|
||||||
test('generated resource test', generated_res_exe)
|
test('generated resource test', generated_res_exe)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Test build_by_default
|
||||||
|
gnome.compile_resources('build-resources',
|
||||||
|
'simple.gresource.xml',
|
||||||
|
gresource_bundle : true,
|
||||||
|
build_by_default : true,
|
||||||
|
source_dir : '../resources-data',
|
||||||
|
)
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
|
|
||||||
compiled = gnome.compile_schemas()
|
compiled = gnome.compile_schemas(build_by_default: true)
|
||||||
install_data('com.github.meson.gschema.xml',
|
install_data('com.github.meson.gschema.xml',
|
||||||
install_dir : 'share/glib-2.0/schemas')
|
install_dir : 'share/glib-2.0/schemas')
|
||||||
|
|
||||||
schemaexe = executable('schemaprog', 'schemaprog.c', compiled,
|
schemaexe = executable('schemaprog', 'schemaprog.c', dependencies : gio)
|
||||||
dependencies : gio)
|
|
||||||
test('schema test', schemaexe)
|
test('schema test', schemaexe)
|
||||||
|
|
Loading…
Reference in New Issue