mirror of
https://github.com/rive-app/rive-cpp.git
synced 2026-01-18 21:21:17 +01:00
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>
42 lines
1.2 KiB
Lua
42 lines
1.2 KiB
Lua
local m = {}
|
|
|
|
local last_str = ''
|
|
|
|
function iop(str)
|
|
io.write(('\b \b'):rep(#last_str)) -- erase old line
|
|
io.write(str) -- write new line
|
|
io.flush()
|
|
last_str = str
|
|
end
|
|
|
|
newoption({ trigger = 'no-download-progress', description = 'Hide progress?' })
|
|
|
|
function m.github(project, tag)
|
|
local dependencies = os.getenv('DEPENDENCIES')
|
|
if dependencies == nil then
|
|
dependencies = path.getabsolute(_WORKING_DIR) .. '/dependencies'
|
|
os.mkdir(dependencies)
|
|
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
|
|
end
|
|
assert(os.isdir(dependency_path))
|
|
return dependency_path
|
|
end
|
|
return m
|