Skip to content

Commit

Permalink
Execute checkout commands inside the main CMake file
Browse files Browse the repository at this point in the history
  • Loading branch information
aisouard committed Mar 19, 2017
1 parent c21220c commit 418e54b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 28 deletions.
29 changes: 1 addition & 28 deletions CMakeModules/DepotTools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,12 @@ if (WEBRTC_REVISION)
ERROR "Unable to find webrtc commit date at ${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}"
)

libwebrtc_execute(
COMMAND ${GIT_EXECUTABLE} log -1 --format=%ci
OUTPUT_VARIABLE _WEBRTC_COMMIT_DATE
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
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}"
)
else (WEBRTC_REVISION)
Expand Down
40 changes: 40 additions & 0 deletions webrtc/CMakeLists.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,46 @@ else (WIN32)
find_package(PythonInterp 2.7 REQUIRED)
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(GClient)
include(Environment)
Expand Down

0 comments on commit 418e54b

Please sign in to comment.