build: Validate desktop/appstream files

This commit is contained in:
Patrick Griffis 2017-06-15 00:10:55 -04:00
parent 2dfe5357a9
commit f8467473dd
1 changed files with 23 additions and 3 deletions

View File

@ -1,7 +1,8 @@
appdir = join_paths(get_option('datadir'), 'applications') appdir = join_paths(get_option('datadir'), 'applications')
desktop_utils = find_program('desktop-file-validate', required: false)
if get_option('with-gtk') if get_option('with-gtk')
i18n.merge_file( hexchat_appdata = i18n.merge_file(
input: 'hexchat.appdata.xml.in', input: 'hexchat.appdata.xml.in',
output: 'hexchat.appdata.xml', output: 'hexchat.appdata.xml',
po_dir: '../../po', po_dir: '../../po',
@ -9,6 +10,13 @@ if get_option('with-gtk')
install_dir: join_paths(get_option('datadir'), 'appdata') install_dir: join_paths(get_option('datadir'), 'appdata')
) )
appstream_util = find_program('appstream-util', required: false)
if appstream_util.found()
test('Validate hexchat.appdata.xml', appstream_util,
args: ['validate', hexchat_appdata]
)
endif
desktop_conf = configuration_data() desktop_conf = configuration_data()
if get_option('with-dbus') if get_option('with-dbus')
desktop_conf.set('exec_command', 'hexchat --existing %U') desktop_conf.set('exec_command', 'hexchat --existing %U')
@ -22,7 +30,7 @@ if get_option('with-gtk')
configuration: desktop_conf configuration: desktop_conf
) )
i18n.merge_file( hexchat_desktop = i18n.merge_file(
input: desktop_file, input: desktop_file,
output: 'hexchat.desktop', output: 'hexchat.desktop',
po_dir: '../../po', po_dir: '../../po',
@ -30,10 +38,16 @@ if get_option('with-gtk')
install: true, install: true,
install_dir: appdir install_dir: appdir
) )
if desktop_utils.found()
test('Validate hexchat.desktop', desktop_utils,
args: [hexchat_desktop]
)
endif
endif endif
if get_option('with-theme-manager') if get_option('with-theme-manager')
i18n.merge_file( htm_desktop = i18n.merge_file(
input: 'htm.desktop.in', input: 'htm.desktop.in',
output: 'htm.desktop', output: 'htm.desktop',
po_dir: '../../po', po_dir: '../../po',
@ -42,6 +56,12 @@ if get_option('with-theme-manager')
install_dir: appdir install_dir: appdir
) )
if desktop_utils.found()
test('Validate htm.desktop', desktop_utils,
args: [htm_desktop]
)
endif
install_data('htm-mime.xml', install_data('htm-mime.xml',
install_dir: join_paths(get_option('datadir'), 'mime/packages') install_dir: join_paths(get_option('datadir'), 'mime/packages')
) )