Skip to content

Commit

Permalink
cmake: Use dependency hashes to track revisions
Browse files Browse the repository at this point in the history
Store and read dependency hashes to determine if a dependency needs to
have its extracted copy replaced (e.g., a dependency that had its
revision changed but not its version changed).
  • Loading branch information
PatTheMav authored and RytoEX committed Oct 9, 2023
1 parent be0a9c4 commit cc387d7
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions cmake/common/buildspec_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,24 @@ function(_check_dependencies)
string(REPLACE "-REVISION" "" file "${file}")
endif()

if(EXISTS "${dependencies_dir}/.dependency_${dependency}_${arch}.sha256")
file(READ "${dependencies_dir}/.dependency_${dependency}_${arch}.sha256"
OBS_DEPENDENCY_${dependency}_${arch}_HASH)
endif()

set(skip FALSE)
if(dependency STREQUAL prebuilt OR dependency STREQUAL qt6)
_check_deps_version(${version})
if(OBS_DEPENDENCY_${dependency}_${arch}_HASH STREQUAL ${hash})
_check_deps_version(${version})

if(found)
set(skip TRUE)
if(found)
set(skip TRUE)
endif()
endif()
elseif(dependency STREQUAL cef)
if(NOT ENABLE_BROWSER OR (CEF_ROOT_DIR AND EXISTS "${CEF_ROOT_DIR}"))
if(NOT ENABLE_BROWSER)
set(skip TRUE)
elseif(OBS_DEPENDENCY_${dependency}_${arch}_HASH STREQUAL ${hash} AND (CEF_ROOT_DIR AND EXISTS "${CEF_ROOT_DIR}"))
set(skip TRUE)
endif()
endif()
Expand Down Expand Up @@ -139,6 +148,10 @@ function(_check_dependencies)
endif()
endif()

if(NOT OBS_DEPENDENCY_${dependency}_${arch}_HASH STREQUAL ${hash})
file(REMOVE_RECURSE "${dependencies_dir}/${destination}")
endif()

if(NOT EXISTS "${dependencies_dir}/${destination}")
file(MAKE_DIRECTORY "${dependencies_dir}/${destination}")
if(dependency STREQUAL obs-studio)
Expand All @@ -148,6 +161,8 @@ function(_check_dependencies)
endif()
endif()

file(WRITE "${dependencies_dir}/.dependency_${dependency}_${arch}.sha256" "${hash}")

if(dependency STREQUAL prebuilt)
set(VLC_PATH
"${dependencies_dir}/${destination}"
Expand Down

0 comments on commit cc387d7

Please sign in to comment.