2023-06-14 11:23:56 +01:00
|
|
|
. $PSScriptRoot\packageconfig.ps1
|
|
|
|
|
|
|
|
|
|
|
|
function Get-Uplugin-Filename {
|
|
|
|
param (
|
|
|
|
[string]$srcfolder,
|
|
|
|
[PluginConfig]$config
|
|
|
|
)
|
|
|
|
|
|
|
|
$projfile = ""
|
|
|
|
if ($config -and $config.ProjectFile) {
|
2023-06-14 15:29:31 +01:00
|
|
|
if (-not [System.IO.Path]::IsPathRooted($config.PluginFile)) {
|
|
|
|
$projfile = Join-Path $srcfolder $config.PluginFile
|
2023-06-14 11:23:56 +01:00
|
|
|
} else {
|
2023-06-14 15:29:31 +01:00
|
|
|
$projfile = Resolve-Path $config.PluginFile
|
2023-06-14 11:23:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (-not (Test-Path $projfile)) {
|
2023-06-14 15:29:31 +01:00
|
|
|
throw "Invalid ProfileFile setting, $($config.PluginFile) does not exist."
|
2023-06-14 11:23:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
# can return multiple results, pick the first one
|
|
|
|
$matchedfile = @(Get-ChildItem -Path $srcfolder -Filter *.uplugin)[0]
|
|
|
|
$projfile = $matchedfile.FullName
|
|
|
|
}
|
|
|
|
|
|
|
|
# Resolve to absolute (do it here and not in join so missing file is friendlier error)
|
|
|
|
if ($projfile) {
|
|
|
|
return Resolve-Path $projfile
|
|
|
|
} else {
|
|
|
|
return $projfile
|
|
|
|
}
|
|
|
|
}
|
2023-06-29 14:40:36 +01:00
|
|
|
|
|
|
|
function Update-UpluginUeVersion {
|
|
|
|
[string]$srcfolder,
|
|
|
|
[PluginConfig]$config,
|
|
|
|
[string]$version
|
|
|
|
|
|
|
|
$pluginfile = Get-Uplugin-Filename $srcfolder $config
|
|
|
|
$plugincontents = (Get-Content $pluginfile) | ConvertFrom-Json
|
|
|
|
$proj.EngineVersion = $version
|
|
|
|
$newjson = ($plugincontents | ConvertTo-Json -depth 100)
|
|
|
|
$newjson | Out-File $pluginfile
|
|
|
|
}
|