don't autmatically run translations compiler

instead add a manual "translations" target
pull/135/head
Michael Zanetti 2018-01-25 11:17:53 +01:00
parent 844de5d2e6
commit 1167001b0b
9 changed files with 25 additions and 47 deletions

View File

@ -1,2 +1,3 @@
translations/*.qm usr/share/guh/translations
plugins/mock/translations/*.qm usr/share/guh/translations

2
debian/rules vendored
View File

@ -11,7 +11,7 @@ else
endif
$(info Building with DEB_BUILD_OPTIONS: [${DEB_BUILD_OPTIONS}])
MAKE_TARGETS=all
MAKE_TARGETS=all lrelease
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
MAKE_TARGETS += doc
endif

20
guh.pro
View File

@ -20,7 +20,25 @@ licensecheck.commands = $$top_srcdir/tests/auto/checklicenseheaders.sh $$top_src
test.depends = licensecheck
test.commands = LD_LIBRARY_PATH=$$top_builddir/libguh-core:$$top_builddir/libguh make check
QMAKE_EXTRA_TARGETS += licensecheck doc test
# Translations:
# make lupdate to update .ts files
TRANSLATIONS += $$files(translations/*.ts, true)
TRANSLATIONS += $$files(plugins/mock/translations/*.ts, true)
lupdate.depends = FORCE
lupdate.commands = $$[QT_INSTALL_BINS]/lupdate -recursive -no-obsolete $$_FILE_;
# make lrelease to compile .ts to .qm
lrelease.depends = FORCE
lrelease.commands = $$[QT_INSTALL_BINS]/lrelease $$_FILE_; \
rsync -a $$top_srcdir/translations/*.qm $$top_builddir/translations/;
# Install translation files
translations.path = /usr/share/guh/translations
translations.files = $$[QT_SOURCE_TREE]/translations/*.qm
translations.depends = lrelease
INSTALLS += translations
QMAKE_EXTRA_TARGETS += licensecheck doc test lupdate lrelease
# Inform about guh build
message(============================================)

View File

@ -267,9 +267,6 @@ def addTranslationString(string, comment):
#-----------------------------------------------------------------------------------------------------------------
def writeTranslationStrings():
if len(args.translations) is 0:
return
if len(translationStrings) is not 0:
writeToFile('// Translation strings')
writeToFile('const QString translations[] {')
@ -337,10 +334,6 @@ def writePluginInfoFile():
outputFile.close()
print(' --> Generated successfully \"%s\"' % (args.output))
# Translate
if len(translationStrings) is not 0:
createTranslationFiles()
#-----------------------------------------------------------------------------------------------------------------
def writeExternPluginInfoFile():

View File

@ -1,7 +1,3 @@
TRANSLATIONS = translations/en_US.ts \
translations/de_DE.ts
# Note: include after the TRANSLATIONS definition
include(../plugins.pri)
QT+= network

View File

@ -7,6 +7,7 @@ QT += network bluetooth
INCLUDEPATH += $$top_srcdir/libguh
LIBS += -L../../libguh -lguh
HEADERS += plugininfo.h
# Create plugininfo file
JSONFILES = deviceplugin"$$TARGET".json
@ -18,11 +19,7 @@ plugininfo.commands = touch ${QMAKE_FILE_OUT}; $$top_srcdir/plugins/guh-generate
--filetype i \
--jsonfile ${QMAKE_FILE_NAME} \
--output ${QMAKE_FILE_OUT} \
--builddir $$OUT_PWD \
--translations $$TRANSLATIONS; \
rsync -a "$$OUT_PWD"/translations/*.qm $$top_builddir/translations/;
PRE_TARGETDEPS +=
QMAKE_EXTRA_COMPILERS +=
--builddir $$OUT_PWD;
externplugininfo.target = extern-plugininfo.h
externplugininfo.output = extern-plugininfo.h
@ -32,17 +29,10 @@ externplugininfo.commands = touch ${QMAKE_FILE_OUT}; $$top_srcdir/plugins/guh-ge
--filetype e \
--jsonfile ${QMAKE_FILE_NAME} \
--output ${QMAKE_FILE_OUT} \
--builddir $$OUT_PWD \
--translations $$TRANSLATIONS;
--builddir $$OUT_PWD;
PRE_TARGETDEPS += compiler_plugininfo_make_all compiler_externplugininfo_make_all
QMAKE_EXTRA_COMPILERS += plugininfo externplugininfo
# Install translation files
translations.path = /usr/share/guh/translations
translations.files = $$[QT_SOURCE_TREE]/translations/*.qm
# Install plugin
target.path = $$GUH_PLUGINS_PATH
INSTALLS += target translations
INSTALLS += target

View File

@ -12,26 +12,6 @@ QT *= sql xml websockets bluetooth dbus network
LIBS += -L$$top_builddir/libguh/ -lguh -L$$top_builddir/libguh-core -lguh-core -lssl -lcrypto -laws-iot-sdk-cpp -lmbedtls -lmbedx509 -lmbedcrypto
# Translations
TRANSLATIONS *= $$top_srcdir/translations/guhd-en_US.ts \
$$top_srcdir/translations/guhd-de_DE.ts
# Update ts files and create translation qm files
lrelease.input = TRANSLATIONS
lrelease.CONFIG += no_link
lrelease.output = $$top_srcdir/${QMAKE_FILE_BASE}.qm
lrelease.commands = $$[QT_INSTALL_BINS]/lupdate -recursive -no-obsolete $$_FILE_; \
$$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.qm; \
rsync -a $$top_srcdir/translations/*.qm $$top_builddir/translations/;
QMAKE_EXTRA_COMPILERS += lrelease
PRE_TARGETDEPS += compiler_lrelease_make_all
# Install translation files
translations.path = /usr/share/guh/translations
translations.files = $$[QT_SOURCE_TREE]/translations/*.qm
INSTALLS += translations
# Server files
include(qtservice/qtservice.pri)