Commit 69897ef3 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(CMakeLists.txt): `check_qml` is executed before `update_translations`

parent f269bda9
...@@ -75,6 +75,30 @@ PREPEND(SOURCES "${CMAKE_SOURCE_DIR}/") ...@@ -75,6 +75,30 @@ PREPEND(SOURCES "${CMAKE_SOURCE_DIR}/")
PREPEND(HEADERS "${CMAKE_SOURCE_DIR}/") PREPEND(HEADERS "${CMAKE_SOURCE_DIR}/")
PREPEND(QRC_RESOURCES "${CMAKE_SOURCE_DIR}/") PREPEND(QRC_RESOURCES "${CMAKE_SOURCE_DIR}/")
# --------------------------------------------------------------------
# Compute QML files list.
# --------------------------------------------------------------------
set(QML_SOURCES)
file(STRINGS ${QRC_RESOURCES} QRC_RESOURCES_CONTENT)
foreach (line ${QRC_RESOURCES_CONTENT})
set(result)
string(REGEX REPLACE
"^[ \t]*<[ \t]*file[ \t]*>[ \t]*(.+\\.qml)[ \t]*<[ \t]*/[ \t]*file[ \t]*>[ \t]*$"
"\\1"
result
${line})
string(REGEX MATCH "qml$" isQml ${result})
if (NOT ${isQml} STREQUAL "")
list(APPEND QML_SOURCES "${CMAKE_SOURCE_DIR}/${result}")
endif ()
endforeach ()
add_custom_target(
check_qml DEPENDS ${QML_SOURCES}
COMMAND "${CMAKE_SOURCE_DIR}/tools/check_qml"
)
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# Init git hooks. # Init git hooks.
# -------------------------------------------------------------------- # --------------------------------------------------------------------
...@@ -98,6 +122,8 @@ list(APPEND QRC_RESOURCES "${CMAKE_BINARY_DIR}/${LANGUAGES_DIRECTORY}/${I18N_FIL ...@@ -98,6 +122,8 @@ list(APPEND QRC_RESOURCES "${CMAKE_BINARY_DIR}/${LANGUAGES_DIRECTORY}/${I18N_FIL
qt5_add_resources(RESOURCES ${QRC_RESOURCES}) qt5_add_resources(RESOURCES ${QRC_RESOURCES})
# Build. # Build.
# Note: `update_translations` is provided by `languages/CMakeLists.txt`.
add_executable(${LINPHONE_EXEC} ${SOURCES} ${HEADERS} ${RESOURCES}) add_executable(${LINPHONE_EXEC} ${SOURCES} ${HEADERS} ${RESOURCES})
add_dependencies(${LINPHONE_EXEC} update_translations) add_dependencies(${LINPHONE_EXEC} update_translations)
add_dependencies(update_translations check_qml)
target_link_libraries(${LINPHONE_EXEC} ${LIBS}) target_link_libraries(${LINPHONE_EXEC} ${LIBS})
...@@ -24,22 +24,6 @@ set(I18N_CONTENT "${I18N_CONTENT} </qresource>\n</RCC>\n") ...@@ -24,22 +24,6 @@ set(I18N_CONTENT "${I18N_CONTENT} </qresource>\n</RCC>\n")
file(WRITE "${CMAKE_BINARY_DIR}/${LANGUAGES_DIRECTORY}/${I18N_FILENAME}" "${I18N_CONTENT}") file(WRITE "${CMAKE_BINARY_DIR}/${LANGUAGES_DIRECTORY}/${I18N_FILENAME}" "${I18N_CONTENT}")
# Compute QML files list.
set(QML_SOURCES)
file(STRINGS ${QRC_RESOURCES} QRC_RESOURCES_CONTENT)
foreach (line ${QRC_RESOURCES_CONTENT})
set(result)
string(REGEX REPLACE
"^[ \t]+<file>[ \t]*(.+\\.qml)[ \t]*</file>[ \t]*$"
"\\1"
result
${line})
string(REGEX MATCH "qml$" isQml ${result})
if (NOT ${isQml} STREQUAL "")
list(APPEND QML_SOURCES "${CMAKE_SOURCE_DIR}/${result}")
endif ()
endforeach ()
# Create `qm` files from `ts` files. # Create `qm` files from `ts` files.
qt5_create_translation(QM_FILES ${TS_FILES} ${SOURCES} ${HEADERS} ${QML_SOURCES}) qt5_create_translation(QM_FILES ${TS_FILES} ${SOURCES} ${HEADERS} ${QML_SOURCES})
......
...@@ -22,7 +22,7 @@ while read line ...@@ -22,7 +22,7 @@ while read line
do do
result=$( result=$(
printf "$line" | printf "$line" |
sed -n 's/^\s*<\s*file\s*>\s*\(.*\.\(qml\|js\)\)\s*<\s*\/file\s*>\s*$/\1/p' sed -n 's/^\s*<\s*file\s*>\s*\(.*\.\(qml\|js\)\)\s*<\s*\/\s*file\s*>\s*$/\1/p'
) )
if [[ ! -z $result ]] && ! $LINTER "$result"; then if [[ ! -z $result ]] && ! $LINTER "$result"; then
so_far_so_good=1 so_far_so_good=1
......
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