diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1df6e1242..0e8396061 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,5 +1,6 @@ jobs: - job: ubuntu16 + timeoutInMinutes: 120 pool: vmImage: 'Ubuntu-16.04' steps: diff --git a/code/CMakeModules/GetRevision.cmake b/code/CMakeModules/GetRevision.cmake index dba90c765..94b877438 100644 --- a/code/CMakeModules/GetRevision.cmake +++ b/code/CMakeModules/GetRevision.cmake @@ -72,6 +72,37 @@ IF(EXISTS "${ROOT_DIR}/.hg/") ENDIF() ENDIF() +IF(EXISTS "${ROOT_DIR}/.git/") + FIND_PACKAGE(Git) + + IF(GIT_FOUND) + EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} rev-list HEAD --count + WORKING_DIRECTORY ${ROOT_DIR} + RESULT_VARIABLE git_exit_code + OUTPUT_VARIABLE REVISION) + IF(NOT ${git_exit_code} EQUAL 0) + message(WARNING "git rev-list failed, unable to include version.") + ENDIF() + EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} rev-parse --short=8 HEAD + WORKING_DIRECTORY ${ROOT_DIR} + RESULT_VARIABLE git_exit_code + OUTPUT_VARIABLE CHANGESET) + IF(NOT ${git_exit_code} EQUAL 0) + message(WARNING "git rev-parse failed, unable to include version.") + ENDIF() + EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD + WORKING_DIRECTORY ${ROOT_DIR} + RESULT_VARIABLE git_exit_code + OUTPUT_VARIABLE BRANCH) + IF(NOT ${git_exit_code} EQUAL 0) + message(WARNING "git rev-parse failed, unable to include git branch.") + ENDIF() + STRING(STRIP ${REVISION} REVISION) + STRING(STRIP ${CHANGESET} CHANGESET) + STRING(STRIP ${BRANCH} BRANCH) + ENDIF() +ENDIF() + # if processing exported sources, use "revision" file if exists IF(SOURCE_DIR AND NOT DEFINED REVISION) SET(REVISION_FILE ${SOURCE_DIR}/revision)