2024-01-22 18:38:09 -08:00
|
|
|
write-host 'Updating Dependencies..'
|
|
|
|
|
|
|
|
$path_root = git rev-parse --show-toplevel
|
|
|
|
$path_code = join-path $path_root 'code'
|
|
|
|
$path_build = join-path $path_root 'build'
|
|
|
|
$path_thirdparty = join-path $path_root 'thirdparty'
|
2024-03-19 15:52:33 -07:00
|
|
|
$path_toolchain = join-path $path_root 'toolchain'
|
2024-01-22 18:38:09 -08:00
|
|
|
|
2024-03-19 15:52:33 -07:00
|
|
|
$url_backtrace_repo = 'https://github.com/Ed94/back.git'
|
|
|
|
$url_ini_parser = 'https://github.com/laytan/odin-ini-parser.git'
|
|
|
|
$url_odin_repo = 'https://github.com/Ed94/Odin.git'
|
|
|
|
$path_backtrace = join-path $path_thirdparty 'backtrace'
|
|
|
|
$path_ini_parser = join-path $path_thirdparty 'ini'
|
|
|
|
$path_odin = join-path $path_toolchain 'Odin'
|
2024-01-22 18:38:09 -08:00
|
|
|
|
|
|
|
$incremental_checks = Join-Path $PSScriptRoot 'helpers/incremental_checks.ps1'
|
|
|
|
. $incremental_checks
|
|
|
|
|
|
|
|
if ( -not(Test-Path $path_thirdparty) ) {
|
|
|
|
new-item -ItemType Directory -Path $path_thirdparty
|
|
|
|
}
|
2024-03-19 15:52:33 -07:00
|
|
|
if ( -not(Test-Path $path_toolchain) ) {
|
|
|
|
new-item -ItemType Directory -Path $path_toolchain
|
|
|
|
}
|
2024-01-22 18:38:09 -08:00
|
|
|
|
2024-03-19 08:47:40 -07:00
|
|
|
$binaries_dirty = $false
|
2024-01-22 18:38:09 -08:00
|
|
|
|
2024-03-19 08:47:40 -07:00
|
|
|
function Update-GitRepo
|
2024-03-11 23:32:46 -07:00
|
|
|
{
|
2024-03-19 08:47:40 -07:00
|
|
|
param( [string] $path, [string] $url, [string] $build_command )
|
2024-03-11 23:32:46 -07:00
|
|
|
|
2024-03-19 08:47:40 -07:00
|
|
|
if ( $build_command -eq $null ) {
|
|
|
|
write-host "Attempted to call Update-GitRepo without build_command specified"
|
|
|
|
return
|
|
|
|
}
|
2024-03-11 23:32:46 -07:00
|
|
|
|
2024-03-19 13:57:28 -07:00
|
|
|
$repo_name = $url.Split('/')[-1].Replace('.git', '')
|
|
|
|
|
|
|
|
$last_built_commit = join-path $path_build "last_built_commit_$repo_name.txt"
|
2024-03-19 08:47:40 -07:00
|
|
|
if ( -not(test-path -Path $path))
|
2024-01-22 18:38:09 -08:00
|
|
|
{
|
2024-03-19 08:47:40 -07:00
|
|
|
write-host "Cloining repo from $url to $path"
|
|
|
|
git clone $url $path
|
|
|
|
|
2024-03-19 13:57:28 -07:00
|
|
|
write-host "Building $url"
|
2024-03-19 08:47:40 -07:00
|
|
|
push-location $path
|
|
|
|
& "$build_command"
|
2024-02-11 20:00:06 -08:00
|
|
|
pop-location
|
2024-01-25 08:31:21 -08:00
|
|
|
|
2024-03-19 08:47:40 -07:00
|
|
|
git -C $path rev-parse HEAD | out-file $last_built_commit
|
2024-03-19 09:18:39 -07:00
|
|
|
$script:binaries_dirty = $true
|
2024-03-19 13:57:28 -07:00
|
|
|
write-host
|
2024-03-19 08:47:40 -07:00
|
|
|
return
|
2024-01-22 18:38:09 -08:00
|
|
|
}
|
2024-03-19 08:47:40 -07:00
|
|
|
|
|
|
|
git -C $path fetch
|
|
|
|
$latest_commit_hash = git -C $path rev-parse '@{u}'
|
|
|
|
$last_built_hash = if (Test-Path $last_built_commit) { Get-Content $last_built_commit } else { "" }
|
|
|
|
|
|
|
|
if ( $latest_commit_hash -eq $last_built_hash ) {
|
|
|
|
write-host
|
|
|
|
return
|
2024-01-22 18:38:09 -08:00
|
|
|
}
|
2024-03-19 08:47:40 -07:00
|
|
|
|
|
|
|
write-host "Build out of date for: $path, updating"
|
|
|
|
write-host 'Pulling...'
|
|
|
|
git -C $path pull
|
|
|
|
|
2024-03-19 13:57:28 -07:00
|
|
|
write-host "Building $url"
|
2024-03-19 08:47:40 -07:00
|
|
|
push-location $path
|
|
|
|
& $build_command
|
2024-01-22 18:38:09 -08:00
|
|
|
pop-location
|
2024-01-25 08:31:21 -08:00
|
|
|
|
2024-03-19 08:47:40 -07:00
|
|
|
$latest_commit_hash | out-file $last_built_commit
|
2024-03-19 09:18:39 -07:00
|
|
|
$script:binaries_dirty = $true
|
2024-03-19 08:47:40 -07:00
|
|
|
write-host
|
2024-01-22 18:38:09 -08:00
|
|
|
}
|
|
|
|
|
2024-03-19 08:47:40 -07:00
|
|
|
push-location $path_thirdparty
|
|
|
|
|
|
|
|
|
2024-03-19 13:57:28 -07:00
|
|
|
Update-GitRepo -path $path_odin -url $url_odin_repo -build_command '.\build.bat'
|
|
|
|
|
2024-02-11 20:00:06 -08:00
|
|
|
if (Test-Path -Path $path_ini_parser)
|
|
|
|
{
|
2024-03-19 08:47:40 -07:00
|
|
|
# Write-Host "Checking for updates on the ini-parser"
|
|
|
|
git -C $path_ini_parser pull
|
2024-02-11 20:00:06 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-03-19 15:52:33 -07:00
|
|
|
Write-Host "Cloning ini repository..."
|
2024-02-11 20:00:06 -08:00
|
|
|
git clone $url_ini_parser $path_ini_parser
|
|
|
|
}
|
|
|
|
|
2024-03-19 15:52:33 -07:00
|
|
|
if (test-path $path_backtrace)
|
|
|
|
{
|
|
|
|
git -C $path_backtrace pull
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Write-Host "Cloning backtrace repository..."
|
|
|
|
git clone $url_backtrace_repo $path_backtrace
|
|
|
|
}
|
|
|
|
|
2024-01-22 18:38:09 -08:00
|
|
|
$path_vendor = join-path $path_odin 'vendor'
|
|
|
|
$path_vendor_raylib = join-path $path_vendor 'raylib'
|
|
|
|
$path_raylib_dlls = join-path $path_vendor_raylib 'windows'
|
|
|
|
|
2024-03-19 09:18:39 -07:00
|
|
|
if ( $binaries_dirty -or $true )
|
2024-01-25 08:31:21 -08:00
|
|
|
{
|
|
|
|
$third_party_dlls = Get-ChildItem -Path $path_raylib_dlls -Filter '*.dll'
|
|
|
|
foreach ($dll in $third_party_dlls) {
|
|
|
|
$destination = join-path $path_build $dll.Name
|
|
|
|
Copy-Item $dll.FullName -Destination $destination -Force
|
|
|
|
}
|
2024-01-22 18:38:09 -08:00
|
|
|
}
|
|
|
|
pop-location
|