Execute checkout commands inside the main CMake file

This commit is contained in:
Axel Isouard 2017-03-19 19:52:34 +01:00
parent c21220c58c
commit 418e54b401
No known key found for this signature in database
GPG key ID: 4E64BB3EAAF31C29
2 changed files with 41 additions and 28 deletions

View file

@ -14,39 +14,12 @@ if (WEBRTC_REVISION)
ERROR "Unable to find webrtc commit date at ${WEBRTC_REVISION}" ERROR "Unable to find webrtc commit date at ${WEBRTC_REVISION}"
) )
elseif (WEBRTC_BRANCH_HEAD) elseif (WEBRTC_BRANCH_HEAD)
libwebrtc_execute(
COMMAND ${GIT_EXECUTABLE} config remote.origin.fetch +refs/branch-heads/*:refs/remotes/branch-heads/* ^\\+refs/branch-heads/\\*:.*$
OUTPUT_VARIABLE _WEBRTC_CONFIG_FETCH
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
STAMPFILE webrtc-config-fetch
STATUS "Setting up branch-heads refspecs"
ERROR "Unable to add branch-heads refspec to the git config"
)
libwebrtc_execute(
COMMAND ${GIT_EXECUTABLE} fetch origin ${WEBRTC_BRANCH_HEAD}
OUTPUT_VARIABLE _WEBRTC_FETCH
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
STAMPFILE webrtc-fetch-branch-heads
STATUS "Fetching ${WEBRTC_BRANCH_HEAD}"
ERROR "Unable to fetch ${WEBRTC_BRANCH_HEAD}"
)
libwebrtc_execute(
COMMAND ${GIT_EXECUTABLE} checkout FETCH_HEAD
OUTPUT_VARIABLE _WEBRTC_CHECKOUT
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
STAMPFILE webrtc-checkout-branch-head
STATUS "Checking out ${WEBRTC_BRANCH_HEAD}"
ERROR "Unable to checkout ${WEBRTC_BRANCH_HEAD}"
)
libwebrtc_execute( libwebrtc_execute(
COMMAND ${GIT_EXECUTABLE} log -1 --format=%ci COMMAND ${GIT_EXECUTABLE} log -1 --format=%ci
OUTPUT_VARIABLE _WEBRTC_COMMIT_DATE OUTPUT_VARIABLE _WEBRTC_COMMIT_DATE
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
STAMPFILE webrtc-branch-head-commit-date STAMPFILE webrtc-branch-head-commit-date
STATUS "Retrieving date for commit ${WEBRTC_BRANCH_HEAD}" STATUS "Retrieving date for ${WEBRTC_BRANCH_HEAD}"
ERROR "Unable to retrieve the commit date for ${WEBRTC_BRANCH_HEAD}" ERROR "Unable to retrieve the commit date for ${WEBRTC_BRANCH_HEAD}"
) )
else (WEBRTC_REVISION) else (WEBRTC_REVISION)

View file

@ -8,6 +8,46 @@ else (WIN32)
find_package(PythonInterp 2.7 REQUIRED) find_package(PythonInterp 2.7 REQUIRED)
endif (WIN32) endif (WIN32)
include(LibWebRTCExecute)
if (WEBRTC_REVISION)
libwebrtc_execute(
COMMAND ${GIT_EXECUTABLE} checkout ${WEBRTC_REVISION}
OUTPUT_VARIABLE _WEBRTC_CHECKOUT
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
STAMPFILE webrtc-checkout-commit
STATUS "Checking out webrtc to commit ${WEBRTC_REVISION}"
ERROR "Unable to checkout webrtc to commit ${WEBRTC_REVISION}"
)
elseif (WEBRTC_BRANCH_HEAD)
libwebrtc_execute(
COMMAND ${GIT_EXECUTABLE} config remote.origin.fetch +refs/branch-heads/*:refs/remotes/branch-heads/* ^\\+refs/branch-heads/\\*:.*$
OUTPUT_VARIABLE _WEBRTC_CONFIG_FETCH
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
STAMPFILE webrtc-config-fetch
STATUS "Setting up branch-heads refspecs"
ERROR "Unable to add branch-heads refspec to the git config"
)
libwebrtc_execute(
COMMAND ${GIT_EXECUTABLE} fetch origin ${WEBRTC_BRANCH_HEAD}
OUTPUT_VARIABLE _WEBRTC_FETCH
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
STAMPFILE webrtc-fetch-branch-heads
STATUS "Fetching ${WEBRTC_BRANCH_HEAD}"
ERROR "Unable to fetch ${WEBRTC_BRANCH_HEAD}"
)
libwebrtc_execute(
COMMAND ${GIT_EXECUTABLE} checkout FETCH_HEAD
OUTPUT_VARIABLE _WEBRTC_CHECKOUT
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
STAMPFILE webrtc-checkout-branch-head
STATUS "Checking out ${WEBRTC_BRANCH_HEAD}"
ERROR "Unable to checkout ${WEBRTC_BRANCH_HEAD}"
)
endif (WEBRTC_REVISION)
include(DepotTools) include(DepotTools)
include(GClient) include(GClient)
include(Environment) include(Environment)