scripts
This commit is contained in:
parent
3e9a2dac38
commit
1f5223e9a4
20
scripts/helpers/ini.ps1
Normal file
20
scripts/helpers/ini.ps1
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# This is meant to be used with build.ps1, and is not a standalone script.
|
||||||
|
|
||||||
|
function Get-IniContent { param([ string]$filePath )
|
||||||
|
$ini = @{}
|
||||||
|
$currentSection = $null
|
||||||
|
switch -regex -file $filePath
|
||||||
|
{
|
||||||
|
"^\[(.+)\]$" {
|
||||||
|
$currentSection = $matches[1].Trim()
|
||||||
|
$ini[$currentSection] = @{}
|
||||||
|
}
|
||||||
|
"^(.+?)\s*=\s*(.*)" {
|
||||||
|
$key, $value = $matches[1].Trim(), $matches[2].Trim()
|
||||||
|
if ($null -ne $currentSection) {
|
||||||
|
$ini[$currentSection][$key] = $value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $ini
|
||||||
|
}
|
1
scripts/setup_shell.ps1
Normal file
1
scripts/setup_shell.ps1
Normal file
@ -0,0 +1 @@
|
|||||||
|
set-alias -Name 'update_deps' -Value '.\update_deps.ps1'
|
3
scripts/system_details.ini
Normal file
3
scripts/system_details.ini
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[CPU]
|
||||||
|
PhysicalCores=16
|
||||||
|
LogicalCores=32
|
34
scripts/ue_setup.ps1
Normal file
34
scripts/ue_setup.ps1
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# UE setup.bat Translated
|
||||||
|
|
||||||
|
# Figure out if we should append the -prompt argument
|
||||||
|
$argumentList = @()
|
||||||
|
if ($null -ne $PROMPT_ARGUMENT) {
|
||||||
|
$argumentList += $PROMPT_ARGUMENT
|
||||||
|
}
|
||||||
|
$argumentList += $args
|
||||||
|
|
||||||
|
$path_GitDependencies = ".\Engine\Binaries\DotNET\GitDependencies\win-x64\GitDependencies.exe"
|
||||||
|
$syncDeps = Start-Process -FilePath $path_GitDependencies -ArgumentList $argumentList -NoNewWindow -Wait -PassThru
|
||||||
|
if ($syncDeps.ExitCode -ne 0) {
|
||||||
|
Write-Host "UE - Error: Failed to sync dependencies" -ForegroundColor Red
|
||||||
|
# Error happened. Wait for a keypress before quitting.
|
||||||
|
Read-Host -Prompt "Press Enter to continue"
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$hooksDir = ".\.git\hooks"
|
||||||
|
if (Test-Path $hooksDir) {
|
||||||
|
Write-Host "UE: Registering git hooks..."
|
||||||
|
Set-Content -Path "$hooksDir\post-checkout" -Value "#!/bin/sh`nEngine/Binaries/DotNET/GitDependencies/win-x64/GitDependencies.exe $($args -join ' ')"
|
||||||
|
Set-Content -Path "$hooksDir\post-merge" -Value "#!/bin/sh`nEngine/Binaries/DotNET/GitDependencies/win-x64/GitDependencies.exe $($args -join ' ')"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "UE: Installing prerequisites..."
|
||||||
|
Start-Process -FilePath "Engine\Extras\Redist\en-us\UEPrereqSetup_x64.exe" -ArgumentList "/quiet", "/norestart" -Wait
|
||||||
|
|
||||||
|
$path_engine_ver_selector = ".\Engine\Binaries\Win64\UnrealVersionSelector-Win64-Shipping.exe"
|
||||||
|
if (Test-Path $path_engine_ver_selector) {
|
||||||
|
Start-Process -FilePath $path_engine_ver_selector -ArgumentList "/register" -NoNewWindow -Wait
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "UE: Setup complete!" -ForegroundColor Green
|
96
scripts/update_deps.ps1
Normal file
96
scripts/update_deps.ps1
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
clear-host
|
||||||
|
|
||||||
|
$path_scripts = $PSScriptRoot
|
||||||
|
$path_root = split-path -Parent -Path $path_scripts
|
||||||
|
|
||||||
|
$ini_parser = join-path $PSScriptRoot 'helpers/ini.ps1'
|
||||||
|
. $ini_parser
|
||||||
|
write-host 'ini.ps1 imported'
|
||||||
|
|
||||||
|
$path_system_details = join-path $path_scripts 'system_details.ini'
|
||||||
|
if ( test-path $path_system_details ) {
|
||||||
|
$iniContent = Get-IniContent $path_system_details
|
||||||
|
$CoreCount_Physical = $iniContent["CPU"]["PhysicalCores"]
|
||||||
|
$CoreCount_Logical = $iniContent["CPU"]["LogicalCores"]
|
||||||
|
}
|
||||||
|
elseif ( $IsWindows ) {
|
||||||
|
$CPU_Info = Get-CimInstance –ClassName Win32_Processor | Select-Object -Property NumberOfCores, NumberOfLogicalProcessors
|
||||||
|
$CoreCount_Physical, $CoreCount_Logical = $CPU_Info.NumberOfCores, $CPU_Info.NumberOfLogicalProcessors
|
||||||
|
|
||||||
|
new-item -path $path_system_details -ItemType File
|
||||||
|
"[CPU]" | Out-File $path_system_details
|
||||||
|
"PhysicalCores=$CoreCount_Physical" | Out-File $path_system_details -Append
|
||||||
|
"LogicalCores=$CoreCount_Logical" | Out-File $path_system_details -Append
|
||||||
|
}
|
||||||
|
write-host "Core Count - Physical: $CoreCount_Physical Logical: $CoreCount_Logical"
|
||||||
|
|
||||||
|
$path_ue = join-path $path_root 'UE'
|
||||||
|
$ue_repo_url = 'https://github.com/EpicGames/UnrealEngine.git'
|
||||||
|
$ue_branch_5_4 = '5.4'
|
||||||
|
$ue_branch_release = 'release'
|
||||||
|
$ue_branch_main = 'ue5-main'
|
||||||
|
$ue_origin_offical = 'EpicGames'
|
||||||
|
|
||||||
|
$git_commit_depth = 1
|
||||||
|
|
||||||
|
$flag_branch = '--branch'
|
||||||
|
$flag_commit_depth = '--depth'
|
||||||
|
$flag_init = '--init'
|
||||||
|
$flag_jobs = '--jobs'
|
||||||
|
$flag_origin = '--origin'
|
||||||
|
$flag_progress = '--progress'
|
||||||
|
$flag_recursive = '--recursive'
|
||||||
|
$flag_shallow_submodules = '--shallow-submodules'
|
||||||
|
$flag_single_branch = '--single-branch'
|
||||||
|
|
||||||
|
|
||||||
|
push-location $path_ue
|
||||||
|
|
||||||
|
function invoke-git {
|
||||||
|
param (
|
||||||
|
$command
|
||||||
|
)
|
||||||
|
write-host $command
|
||||||
|
& git @command
|
||||||
|
# 2>&1 | ForEach-Object {
|
||||||
|
# $color = 'Cyan'
|
||||||
|
# switch ($_){
|
||||||
|
# { $_ -match "error" } { $color = 'Red' ; break }
|
||||||
|
# { $_ -match "warning" } { $color = 'Yellow' ; break }
|
||||||
|
# }
|
||||||
|
# Write-Host "`t $_" -ForegroundColor $color
|
||||||
|
# }
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((test-path $path_ue) -eq $false)
|
||||||
|
{
|
||||||
|
new-item -Type Directory $path_ue
|
||||||
|
|
||||||
|
$clone_5_4 = @()
|
||||||
|
$clone_5_4 += 'clone'
|
||||||
|
$clone_5_4 += $flag_progress
|
||||||
|
$clone_5_4 += @($flag_origin, $ue_origin_offical)
|
||||||
|
$clone_5_4 += @($flag_branch, $ue_branch_5_4)
|
||||||
|
$clone_5_4 += $ue_repo_url
|
||||||
|
$clone_5_4 += @($flag_commit_depth, $git_commit_depth)
|
||||||
|
$clone_5_4 += $flag_single_branch
|
||||||
|
$clone_5_4 += @($flag_jobs, $CoreCount_Physical)
|
||||||
|
$clone_5_4 += $flag_shallow_submodules
|
||||||
|
$clone_5_4 += $path_ue
|
||||||
|
invoke-git $clone_5_4
|
||||||
|
|
||||||
|
$init_submodules = @()
|
||||||
|
$init_submodules += 'submodule'
|
||||||
|
$init_submodules += 'update'
|
||||||
|
$init_submodules += $flag_init
|
||||||
|
$init_submodules += @($flag_commit_depth, $git_commit_depth)
|
||||||
|
$init_submodules += $flag_recursive
|
||||||
|
$init_submodules += @($flag_jobs, $CoreCount_Physical)
|
||||||
|
$init_submodules += $flag_single_branch
|
||||||
|
invoke-git $init_submodules
|
||||||
|
}
|
||||||
|
|
||||||
|
& .\setup.bat
|
||||||
|
& .\GenerateProjectFiles.bat
|
||||||
|
|
||||||
|
pop-location # $path_ue
|
Loading…
Reference in New Issue
Block a user