Skip to content

Commit

Permalink
Merge v1.26.4 into community
Browse files Browse the repository at this point in the history
  • Loading branch information
GovernikusAusweisApp2 committed Apr 28, 2023
2 parents e4a12fe + d83e25b commit 5bfb5c0
Show file tree
Hide file tree
Showing 155 changed files with 3,944 additions and 1,208 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
queries: +security-and-quality

- name: Install dependencies
run: sudo apt install -y cmake pkg-config libssl-dev libudev-dev libhttp-parser-dev libpcsclite-dev libqt6svg6-dev libqt6websockets6-dev qt6-base-dev qt6-base-private-dev qt6-declarative-dev qt6-scxml-dev qt6-tools-dev qt6-tools-dev-tools libqt6opengl6-dev libqt6shadertools6-dev libgl1-mesa-dev qt6-l10n-tools
run: sudo apt update -qq && sudo apt install -y cmake pkg-config libssl-dev libudev-dev libhttp-parser-dev libpcsclite-dev libqt6svg6-dev libqt6websockets6-dev qt6-base-dev qt6-base-private-dev qt6-declarative-dev qt6-connectivity-dev qt6-scxml-dev qt6-tools-dev qt6-tools-dev-tools libqt6opengl6-dev libqt6shadertools6-dev libgl1-mesa-dev qt6-l10n-tools

- name: Autobuild
uses: github/codeql-action/autobuild@v2
Expand Down
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ if(UNIX AND NOT IOS)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15 CACHE STRING "Required macOS version")
endif()

project(AusweisApp2 VERSION 1.26.3 LANGUAGES ${LANGUAGES})
project(AusweisApp2 VERSION 1.26.4 LANGUAGES ${LANGUAGES})

# Set TWEAK if not defined in PROJECT_VERSION above to
# have a valid tweak version without propagating it
Expand Down Expand Up @@ -182,6 +182,7 @@ endif()
option(USE_SMARTEID "Enable Smart-eID" OFF)

include(Libraries)
include(Tools.Libraries)
include(CompilerFlags)

if(LINUX OR BSD)
Expand All @@ -200,3 +201,6 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/utils")
endif()

include(Packaging)

include(FeatureSummary)
FEATURE_SUMMARY(WHAT ALL)
1 change: 0 additions & 1 deletion cmake/CompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ else()
endif()
endif()


if(CMAKE_COMPILE_WARNING_AS_ERROR AND CMAKE_VERSION VERSION_LESS "3.24")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
endif()
Expand Down
4 changes: 1 addition & 3 deletions cmake/DVCS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ endfunction()


macro(CHECK_DVCS)
set(VERSION_DVCS ${PROJECT_VERSION})

if(HG_FOUND)
DVCS_CALL("tag" "" id -t)
elseif(GIT_FOUND)
Expand Down Expand Up @@ -96,7 +94,7 @@ macro(GET_DVCS_INFO)
endif()
endmacro()


set(VERSION_DVCS ${PROJECT_VERSION})
FIND_DVCS(${PROJECT_SOURCE_DIR})
if(DVCS_FOUND)
option(ENABLE_DVCS "Check consistency of version/tag and get additional revision data" true)
Expand Down
6 changes: 1 addition & 5 deletions cmake/Install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,7 @@ elseif(ANDROID)
install(FILES ${PACKAGING_DIR}/android/IAusweisApp2Sdk.aidl DESTINATION ${ANDROID_PACKAGE_SRC_DIR}/src/com/governikus/ausweisapp2/ COMPONENT Runtime)
install(FILES ${PACKAGING_DIR}/android/IAusweisApp2SdkCallback.aidl DESTINATION ${ANDROID_PACKAGE_SRC_DIR}/src/com/governikus/ausweisapp2/ COMPONENT Runtime)

if(VERSION_DVCS)
set(ANDROID_VERSION_NAME ${VERSION_DVCS})
else()
set(ANDROID_VERSION_NAME ${PROJECT_VERSION})
endif()
set(ANDROID_VERSION_NAME ${VERSION_DVCS})
configure_file(${PACKAGING_DIR}/android/${ANDROID_MANIFEST} ${ANDROID_PACKAGE_SRC_DIR}/AndroidManifest.xml @ONLY)
if(INTEGRATED_SDK)
set(QML_ROOT_PATH [])
Expand Down
38 changes: 15 additions & 23 deletions cmake/Notarization.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,41 +25,33 @@ if(NOT DMG_FILE_LEN EQUAL 1)
endif()
message(STATUS "Using DMG: ${DMG_FILE}")

if(NOT USER)
set(USER [email protected])
endif()

execute_process(COMMAND ${XCRUN} altool -t osx --notarize-app --verbose -u ${USER} -p @env:PASSWORD --primary-bundle-id com.governikus.ausweisapp2 -f ${DMG_FILE}
OUTPUT_VARIABLE UUID_OUTPUT)
set(keychain --keychain-profile "AC_PASSWORD")
execute_process(COMMAND ${XCRUN} notarytool submit ${keychain} ${DMG_FILE} OUTPUT_VARIABLE UUID_OUTPUT)

set(regex_uuid "RequestUUID = ([-|0-9|a-z]+)")
set(regex_uuid "id: ([-|0-9|a-z]+)")
FETCH_REGEX(UUID "${regex_uuid}" "${UUID_OUTPUT}")
if(UUID)
message(STATUS "Fetched UUID: ${UUID}")
else()
message(FATAL_ERROR "Cannot fetch UUID: ${UUID_OUTPUT}")
endif()

set(regex_status "Status: ([a-z| ]+)")
while(TRUE)
message(STATUS "Wait 30 seconds...")
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 30)
message(STATUS "Wait...")
execute_process(COMMAND ${XCRUN} notarytool wait ${UUID} ${keychain})

execute_process(COMMAND ${XCRUN} altool -u ${USER} -p @env:PASSWORD --notarization-info ${UUID}
OUTPUT_VARIABLE STATUS_OUTPUT)
execute_process(COMMAND ${XCRUN} notarytool info ${UUID} ${keychain} OUTPUT_VARIABLE STATUS_OUTPUT)

FETCH_REGEX(STATUS "${regex_status}" "${STATUS_OUTPUT}")
set(regex_status "status: ([a-zA-Z| ]+)")
FETCH_REGEX(STATUS "${regex_status}" "${STATUS_OUTPUT}")

if(STATUS STREQUAL "success")
message(STATUS "Notarization succeeded...")
break()
elseif(STATUS STREQUAL "in progress")
message(STATUS "Waiting...\n${STATUS_OUTPUT}")
else()
message(STATUS "Fetched Status: ${STATUS}")
message(FATAL_ERROR "Notarization failed:\n${STATUS_OUTPUT}")
endif()
endwhile()
if(STATUS STREQUAL "Accepted")
message(STATUS "Notarization succeeded...")
else()
message(STATUS "Fetched Status: ${STATUS}")
execute_process(COMMAND ${XCRUN} notarytool log ${UUID} ${keychain})
message(FATAL_ERROR "Notarization failed:\n${STATUS_OUTPUT}")
endif()

execute_process(COMMAND ${XCRUN} stapler staple -v ${DMG_FILE})
execute_process(COMMAND ${XCRUN} stapler validate -v ${DMG_FILE})
17 changes: 9 additions & 8 deletions cmake/Sphinx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ if(SPHINX_BIN)
list(APPEND _LOCALES ${_defaultLang})

set(_TMP_DIR "${CMAKE_BINARY_DIR}/_tmp/${_target}/${_builder}")
set(_CONFIG_DIR "${_TMP_DIR}/config")

set(SPHINX_CONF_PY_IN "${SPHINX_DOCS_DIR}/${_builder}.conf.py.in")
if(NOT EXISTS "${SPHINX_CONF_PY_IN}")
set(SPHINX_CONF_PY_IN "${SPHINX_DOCS_DIR}/conf.py.in")
endif()
configure_file("${SPHINX_CONF_PY_IN}" "${_CONFIG_DIR}/conf.py" @ONLY) # Use @SPHINX_DOCS_DIR@ here

file(GLOB_RECURSE _FILES
"${SPHINX_DOCS_DIR}/*.rst"
Expand All @@ -28,14 +26,17 @@ if(SPHINX_BIN)
"${SPHINX_DOCS_DIR}/*.jpg"
"${SPHINX_DOCS_DIR}/*.svg")

foreach(lang ${_LOCALES})
get_filename_component(lang "${lang}" NAME)
message(STATUS "Generate (${_builder}) ${_target}: ${lang}")
foreach(SPHINX_LANG ${_LOCALES})
get_filename_component(SPHINX_LANG "${SPHINX_LANG}" NAME)
message(STATUS "Generate (${_builder}) ${_target}: ${SPHINX_LANG}")

set(target_dir "${_output}/${_target}/${_builder}/${lang}")
set(TARGET_CMD ${SPHINX_BIN} -c "${_CONFIG_DIR}" -Dlanguage=${lang} ${_options} -d "${_TMP_DIR}/${lang}" -b ${_builder} "${SPHINX_DOCS_DIR}" "${target_dir}")
set(_CONFIG_DIR "${_TMP_DIR}/config/${SPHINX_LANG}")
configure_file("${SPHINX_CONF_PY_IN}" "${_CONFIG_DIR}/conf.py" @ONLY) # Use @SPHINX_DOCS_DIR@ / @SPHINX_LANG@ here

set(target_dir "${_output}/${_target}/${_builder}/${SPHINX_LANG}")
set(TARGET_CMD ${SPHINX_BIN} -c "${_CONFIG_DIR}" ${_options} -d "${_TMP_DIR}/${SPHINX_LANG}" -b ${_builder} "${SPHINX_DOCS_DIR}" "${target_dir}")
add_custom_command(OUTPUT ${target_dir} COMMAND ${TARGET_CMD} DEPENDS ${_FILES})
set(subtarget ${_target}.${_builder}.${lang})
set(subtarget ${_target}.${_builder}.${SPHINX_LANG})
add_custom_target(${subtarget} DEPENDS ${target_dir} SOURCES ${_FILES})
list(APPEND target_list ${subtarget})

Expand Down
42 changes: 42 additions & 0 deletions cmake/Tools.Libraries.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This file will be included in Tools.cmake AND after Libraries.cmake
# So this file will be called two times and the check needs to respect that
# with a "VALIDATOR function" or "if(NOT VARIABLE)".

if(NOT QMLFORMAT)
set(QMLFORMAT_MIN_VERSION 6)
function(qmlformat_validator validator_result binary)
execute_process(COMMAND ${binary} --version OUTPUT_VARIABLE QMLFORMAT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "qmlformat " "" QMLFORMAT_VERSION "${QMLFORMAT_VERSION}")

if("${QMLFORMAT_VERSION}" VERSION_LESS "${QMLFORMAT_MIN_VERSION}")
set(${validator_result} FALSE PARENT_SCOPE)
endif()
endfunction()

if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.25")
set(VALIDATOR VALIDATOR qmlformat_validator)
endif()

find_program(QMLFORMAT qmlformat HINTS "${QT_INSTALL_ARCHDATA}/bin" ${VALIDATOR} CMAKE_FIND_ROOT_PATH_BOTH)
if(QMLFORMAT)
execute_process(COMMAND ${QMLFORMAT} --version OUTPUT_VARIABLE QMLFORMAT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "qmlformat " "" QMLFORMAT_VERSION "${QMLFORMAT_VERSION}")

if("${QMLFORMAT_VERSION}" VERSION_LESS "${QMLFORMAT_MIN_VERSION}")
unset(QMLFORMAT CACHE) # let's retry later
else()
file(GLOB_RECURSE FILES_QML ${PROJECT_SOURCE_DIR}/*.qml)
set(QMLFORMAT_CMD ${QMLFORMAT} -i -n -l unix -t -w 4)

set(FORMATTING_FILE ${PROJECT_BINARY_DIR}/formatting.files.qml)
file(WRITE ${FORMATTING_FILE} "")
foreach(file ${FILES_QML})
file(APPEND ${FORMATTING_FILE} ${file})
file(APPEND ${FORMATTING_FILE} "\n")
endforeach()

add_custom_target(format.qml COMMAND ${QMLFORMAT_CMD} -F ${FORMATTING_FILE} SOURCES ${FILES_QML})
add_dependencies(format format.qml)
endif()
endif()
endif()
24 changes: 1 addition & 23 deletions cmake/Tools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -115,29 +115,6 @@ if(UNCRUSTIFY)
endif()
endif()

find_program(QMLFORMAT qmlformat HINTS "${QT_INSTALL_ARCHDATA}/bin" CMAKE_FIND_ROOT_PATH_BOTH)
if(QMLFORMAT)
execute_process(COMMAND ${QMLFORMAT} --version OUTPUT_VARIABLE QMLFORMAT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "qmlformat " "" QMLFORMAT_VERSION "${QMLFORMAT_VERSION}")

if("${QMLFORMAT_VERSION}" VERSION_LESS "6")
message(WARNING "qmlformat is too old: ${QMLFORMAT_VERSION}")
else()
file(GLOB_RECURSE FILES_QML ${PROJECT_SOURCE_DIR}/*.qml)
set(QMLFORMAT_CMD ${QMLFORMAT} -i -n -l unix -t -w 4)

set(FORMATTING_FILE ${PROJECT_BINARY_DIR}/formatting.files.qml)
file(WRITE ${FORMATTING_FILE} "")
foreach(file ${FILES_QML})
file(APPEND ${FORMATTING_FILE} ${file})
file(APPEND ${FORMATTING_FILE} "\n")
endforeach()

add_custom_target(format.qml COMMAND ${QMLFORMAT_CMD} -F ${FORMATTING_FILE} SOURCES ${FILES_QML})
add_dependencies(format format.qml)
endif()
endif()

find_program(PYTHON python CMAKE_FIND_ROOT_PATH_BOTH)
if(PYTHON)
list(APPEND GLOB_JSON ${RESOURCES_DIR}/updatable-files/*.json)
Expand Down Expand Up @@ -621,3 +598,4 @@ if(DOT)
endif()

include(Sphinx)
include(Tools.Libraries)
26 changes: 24 additions & 2 deletions cmake/cmd.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.1.0)
cmake_minimum_required(VERSION 3.13.0)
cmake_policy(SET CMP0057 NEW)

###########################################
#### Usage: cmake -DCMD= -P cmake/cmd.cmake
Expand Down Expand Up @@ -184,8 +185,29 @@ function(CHECK_FAILURE_CODES)
string(REGEX REPLACE "/\\*[^(\\*/)]*\\*/" "" SINGLE_LINE ${SINGLE_LINE})
string(REGEX MATCHALL "([a-zA-Z0-9_]+)" FAILURE_CODES ${SINGLE_LINE})

file(STRINGS "docs/failurecodes/failurecodes.rst" LINES_RST)
foreach(line_rst ${LINES_RST})
#match this pattern: " - | **Card_Removed**" with spaces or tabs as whitespaces.
string(REGEX MATCH "[ \\t]+-[ \\t]+\\|[ \\t]+\\*\\*([A-Za-z0-9_]+)\\*\\*" MATCH ${line_rst})
if(MATCH)
list(APPEND FAILURE_CODES_RST ${CMAKE_MATCH_1})
endif()
endforeach()

list(LENGTH FAILURE_CODES ENUM_CODE_COUNT)
list(LENGTH FAILURE_CODES_RST RST_CODE_COUNT)
if(NOT ENUM_CODE_COUNT EQUAL RST_CODE_COUNT)
message(FATAL_ERROR
"The failure code count in FailureCode.h (${ENUM_CODE_COUNT}) does not match the count in failurecodes.rst (${RST_CODE_COUNT})!")
endif()

file(GLOB_RECURSE SOURCE_FILES src/*.cpp)
foreach(code ${FAILURE_CODES})
if(NOT code IN_LIST FAILURE_CODES_RST)
message(FATAL_ERROR
"The failure code [${code}] is not part of failurecodes.rst. This hints a missing, duplicated or incorrectly spelled code in failurecodes.rst.")
endif()

set(COUNTER 0)
foreach(file ${SOURCE_FILES})
file(READ ${file} CONTENT)
Expand All @@ -194,7 +216,7 @@ function(CHECK_FAILURE_CODES)
math(EXPR COUNTER ${COUNTER}+${OCCURRENCES})
endforeach()
if(NOT COUNTER EQUAL 1)
message(FATAL_ERROR "${code} is not used excatly one time. Found ${COUNTER}")
message(FATAL_ERROR "${code} is not used exactly one time. Found ${COUNTER}")
endif()
endforeach()
endfunction()
Expand Down
2 changes: 2 additions & 0 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ if(SPHINX_FOUND)
SPHINX_GEN("${CMAKE_CURRENT_SOURCE_DIR}/installation" "inst" BUILDER changes html latex)

SPHINX_GEN("${CMAKE_CURRENT_SOURCE_DIR}/integration" "inte" BUILDER changes html latex)

SPHINX_GEN("${CMAKE_CURRENT_SOURCE_DIR}/failurecodes" "failurecodes" BUILDER changes html latex DEFAULT_LANG en)
else()
message(STATUS "No documentation will be generated")
endif()
Loading

0 comments on commit 5bfb5c0

Please sign in to comment.