Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 41 additions & 15 deletions webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ if(NOT EXISTS "${WEBRTC_SRC_DIR}/depot_tools")
message(STATUS "WebRTC: fetch depot tools")
file(MAKE_DIRECTORY ${WEBRTC_SRC_DIR})
execute_command(
COMMAND git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
COMMAND git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
WORKING_DIRECTORY "${WEBRTC_SRC_DIR}"
)
endif()
Expand All @@ -274,25 +274,51 @@ endif()

file(MAKE_DIRECTORY ${WEBRTC_DIR})

message(STATUS "WebRTC: fetch")
execute_command(
COMMAND fetch --nohooks webrtc
WORKING_DIRECTORY "${WEBRTC_DIR}"
)
# The branch is pinned in the .gclient solution url, so gclient syncs src
# and every dependency at depth 1 instead of cloning their full histories
# (what "fetch webrtc" does). Branch names resolve to a ref: branch-heads/N
# lives under refs/, a plain branch under refs/heads/.
if(WEBRTC_BRANCH MATCHES "^refs/")
set(WEBRTC_REF "${WEBRTC_BRANCH}")
elseif(WEBRTC_BRANCH MATCHES "^branch-heads/")
set(WEBRTC_REF "refs/${WEBRTC_BRANCH}")
else()
set(WEBRTC_REF "refs/heads/${WEBRTC_BRANCH}")
endif()

message(STATUS "WebRTC: checkout \"${WEBRTC_BRANCH}\"")
execute_command(
COMMAND git checkout .
WORKING_DIRECTORY "${WEBRTC_SRC}"
)
# The instrumented libraries only serve sanitizer builds (Linux).
file(WRITE "${WEBRTC_DIR}/.gclient"
"solutions = [
{
\"name\": \"src\",
\"url\": \"https://webrtc.googlesource.com/src.git@${WEBRTC_REF}\",
\"deps_file\": \"DEPS\",
\"managed\": False,
\"custom_deps\": {},
\"custom_vars\": {
\"checkout_instrumented_libraries\": False,
},
},
]
")

if(EXISTS "${WEBRTC_SRC}")
# Drop previously applied patches so the sync can move the tree.
execute_command(
COMMAND git checkout .
WORKING_DIRECTORY "${WEBRTC_SRC}"
)
endif()

message(STATUS "WebRTC: sync \"${WEBRTC_REF}\"")
execute_command(
COMMAND git checkout ${WEBRTC_BRANCH}
WORKING_DIRECTORY "${WEBRTC_SRC}"
COMMAND gclient sync --no-history --shallow --nohooks
WORKING_DIRECTORY "${WEBRTC_DIR}"
)

message(STATUS "WebRTC: sync")
message(STATUS "WebRTC: run hooks")
execute_command(
COMMAND gclient sync
COMMAND gclient runhooks
WORKING_DIRECTORY "${WEBRTC_DIR}"
)

Expand Down