From dd7a2155de9bfb43badbe9101cf15f239c895286 Mon Sep 17 00:00:00 2001 From: csmartdalton Date: Tue, 29 Jul 2025 22:47:57 +0000 Subject: [PATCH] build: Clone dependencies with git instead of downloading a zip (#10271) a2e64c0505 It was a cool idea to download the repos as a zip, so that premake didn't have to rely on any external dependencies, but github was frequently giving us a successful download of an empty zip file. This was causing daily flakes on CI. Instead, just invoke 'git clone --depth=1 --branch ...' from premake. This should hopefully be more reliable, and it seems safe enough to depend on git being installed in the environment we're on. Also: * Update the dependencies that were using raw branch SHAs to point to official tags. 'git clone --branch' requires an official tag, and this will be more stable anyway. * Rename the dependency directories to "owner_project_tag" rather than a hash. Sometimes we need to poke around in those directories to debug issues, and it's easier to figure out what's what with descriptive names. Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com> --- .rive_head | 2 +- build/dependency.lua | 50 +++++++------------ renderer/premake5_pls_renderer.lua | 6 +-- .../rive_vk_bootstrap/bootstrap_project.lua | 2 +- 4 files changed, 23 insertions(+), 37 deletions(-) diff --git a/.rive_head b/.rive_head index 31130a20..5ec6aa8e 100644 --- a/.rive_head +++ b/.rive_head @@ -1 +1 @@ -45e1b18c68de6288d122ee4345ccb9b004b219f0 +a2e64c0505870c2a33e74cf4407989dd70f49387 diff --git a/build/dependency.lua b/build/dependency.lua index 95f68269..02b6f869 100644 --- a/build/dependency.lua +++ b/build/dependency.lua @@ -17,39 +17,25 @@ function m.github(project, tag) dependencies = path.getabsolute(_WORKING_DIR) .. '/dependencies' os.mkdir(dependencies) end - local hash = string.sub(string.sha1(project .. tag), 0, 9) - if not os.isdir(dependencies .. '/' .. hash) then - function progress(total, current) - local ratio = current / total - ratio = math.min(math.max(ratio, 0), 1) - local percent = math.floor(ratio * 100) - if total == current then - iop('') - else - iop('Downloading ' .. project .. ' ' .. percent .. '%') - end + local dirname = project .. '_' .. tag + dirname = string.gsub(dirname, '/', '_') + local dependency_path = dependencies .. '/' .. dirname + if not os.isdir(dependency_path) then + print('Fetching dependency ' .. project .. ' at tag ' .. tag .. '...') + local gitcmd = 'git -c advice.detachedHead=false -C ' + .. dependencies + .. ' clone --depth 1 --branch ' + .. tag + .. ' https://github.com/' + .. project + .. '.git' + .. ' ' + .. dirname + if not os.execute(gitcmd) then + error('\nError executing command:\n ' .. cmd) end - - local downloadFilename = dependencies .. '/' .. hash .. '.zip' - http.download( - 'https://github.com/' .. project .. '/archive/' .. tag .. '.zip', - downloadFilename, - -- Download progress explodes the github logs with megabytes of text. - -- github runners have a "CI" environment variable. - { - progress = not _OPTIONS['no-download-progress'] - and os.getenv('CI') ~= 'true' - and progress, - } - ) - print('Downloaded ' .. project .. ' to ' .. dependencies .. '/' .. hash) - zip.extract(downloadFilename, dependencies .. '/' .. hash) - os.remove(downloadFilename) end - local dirs = os.matchdirs(dependencies .. '/' .. hash .. '/*') - - local iter = pairs(dirs) - local currentKey, currentValue = iter(dirs) - return currentValue + assert(os.isdir(dependency_path)) + return dependency_path end return m diff --git a/renderer/premake5_pls_renderer.lua b/renderer/premake5_pls_renderer.lua index 968c943f..a2625ee7 100644 --- a/renderer/premake5_pls_renderer.lua +++ b/renderer/premake5_pls_renderer.lua @@ -14,7 +14,7 @@ if _OPTIONS['with_vulkan'] then vulkan_headers = dependency.github('KhronosGroup/Vulkan-Headers', 'vulkan-sdk-1.3.283') vulkan_memory_allocator = dependency.github( 'GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator', - '7942b798289f752dc23b0a79516fd8545febd718' + 'v3.3.0' ) defines({ 'RIVE_VULKAN', @@ -96,7 +96,7 @@ else handle:close() end nproc = nproc:gsub('%s+', '') -- remove whitespace -local python_ply = dependency.github('dabeaz/ply', '5c4dc94d4c6d059ec127ee1493c735963a5d2645') +local python_ply = dependency.github('dabeaz/ply', '3.11') local makecommand = 'make -C ' .. path.getabsolute('src/shaders') .. ' -j' @@ -104,7 +104,7 @@ local makecommand = 'make -C ' .. ' OUT=' .. pls_shaders_absolute_dir -local minify_flags = '-p ' .. python_ply .. '/src' +local minify_flags = '-p ' .. python_ply newoption({ trigger = 'raw_shaders', description = 'don\'t rename shader variables, or remove whitespace or comments', diff --git a/renderer/rive_vk_bootstrap/bootstrap_project.lua b/renderer/rive_vk_bootstrap/bootstrap_project.lua index c938c64d..18497b82 100644 --- a/renderer/rive_vk_bootstrap/bootstrap_project.lua +++ b/renderer/rive_vk_bootstrap/bootstrap_project.lua @@ -8,7 +8,7 @@ if not vulkan_headers or not vulkan_memory_allocator then end local dependency = require('dependency') -vk_bootstrap = dependency.github('charles-lunarg/vk-bootstrap', '30a13b2') +vk_bootstrap = dependency.github('charles-lunarg/vk-bootstrap', 'v1.4.307') includedirs({ 'include' })