mirror of
https://github.com/sinbad/UEScripts.git
synced 2025-02-23 13:15:23 +00:00
Add option to build plugins against different versions of UE
This commit is contained in:
parent
27a9659924
commit
d764bb32be
@ -15,6 +15,9 @@ Usage:
|
|||||||
-src : Source folder (current folder if omitted)
|
-src : Source folder (current folder if omitted)
|
||||||
: (should be root of project)
|
: (should be root of project)
|
||||||
-allplatforms : Build for all platforms, not just the current one
|
-allplatforms : Build for all platforms, not just the current one
|
||||||
|
-allversions : Build for all supported UE versions, not just the current one"
|
||||||
|
: (specified in pluginconfig.json, only works with lancher-installed UE)"
|
||||||
|
-uever:5.x.x : Build for a specific UE version, not the current one (launcher only)"
|
||||||
-dryrun : Don't perform any actual actions, just report on what you would do
|
-dryrun : Don't perform any actual actions, just report on what you would do
|
||||||
-help : Print this help
|
-help : Print this help
|
||||||
|
|
||||||
@ -33,7 +36,25 @@ in the root of your plugin, next to the .uplugin file. The options are:
|
|||||||
"PackageDir": "C:\\Users\\Steve\\Marketplace",
|
"PackageDir": "C:\\Users\\Steve\\Marketplace",
|
||||||
"BuildDir": "C:\\Users\\Steve\\Builds\\MyPlugin",
|
"BuildDir": "C:\\Users\\Steve\\Builds\\MyPlugin",
|
||||||
"PluginFile": "OptionalPluginFilenameWillDetectInDirOtherwise.uplugin",
|
"PluginFile": "OptionalPluginFilenameWillDetectInDirOtherwise.uplugin",
|
||||||
|
|
||||||
|
"EngineVersions":
|
||||||
|
[
|
||||||
|
"5.1.0",
|
||||||
|
"5.2.0"
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Only `BuildDir` is required.
|
Only `BuildDir` is required.
|
||||||
|
|
||||||
|
The `-allversions` option only works with Launcher installed engines,
|
||||||
|
since the path is derived from UEROOT. If using non-Launcher engines, or you
|
||||||
|
need to change some other environmental options per version (e.g. setting
|
||||||
|
`LINUX_MULTIARCH_ROOT` environment var), then you're recommended to instead
|
||||||
|
use the `-uever:` option to build one version at a time, and set the environment
|
||||||
|
(including `UEINSTALL`) specifically for each version.
|
||||||
|
|
||||||
|
This script will, however, handle changing the EngineVersion in the .uplugin
|
||||||
|
during the build, and resetting it afterwards.
|
@ -32,3 +32,15 @@ function Get-Uplugin-Filename {
|
|||||||
return $projfile
|
return $projfile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
@ -3,6 +3,8 @@ param (
|
|||||||
[string]$mode,
|
[string]$mode,
|
||||||
[string]$src,
|
[string]$src,
|
||||||
[switch]$allplatforms = $false,
|
[switch]$allplatforms = $false,
|
||||||
|
[switch]$allversions = $false,
|
||||||
|
[string]$uever = "",
|
||||||
[switch]$nocloseeditor = $false,
|
[switch]$nocloseeditor = $false,
|
||||||
[switch]$dryrun = $false,
|
[switch]$dryrun = $false,
|
||||||
[switch]$help = $false
|
[switch]$help = $false
|
||||||
@ -23,6 +25,9 @@ function Print-Usage {
|
|||||||
Write-Output " -src : Source folder (current folder if omitted)"
|
Write-Output " -src : Source folder (current folder if omitted)"
|
||||||
Write-Output " : (should be root of project)"
|
Write-Output " : (should be root of project)"
|
||||||
Write-Output " -allplatforms : Build for all platforms, not just the current one"
|
Write-Output " -allplatforms : Build for all platforms, not just the current one"
|
||||||
|
Write-Output " -allversions : Build for all supported UE versions, not just the current one"
|
||||||
|
Write-Output " : (specified in pluginconfig.json, only works with lancher-installed UE)"
|
||||||
|
Write-Output " -uever:5.x.x : Build for a specific UE version, not the current one (launcher only)"
|
||||||
Write-Output " -dryrun : Don't perform any actual actions, just report on what you would do"
|
Write-Output " -dryrun : Don't perform any actual actions, just report on what you would do"
|
||||||
Write-Output " -help : Print this help"
|
Write-Output " -help : Print this help"
|
||||||
Write-Output " "
|
Write-Output " "
|
||||||
@ -64,23 +69,39 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$proj = Read-Uproject $pluginfile
|
$proj = Read-Uproject $pluginfile
|
||||||
$ueVersion = Get-UE-Version $proj
|
$origUeVersion = Get-UE-Version $proj
|
||||||
$ueinstall = Get-UE-Install $ueVersion
|
if ($allversions) {
|
||||||
|
$ueVersions = $config.EngineVersions
|
||||||
|
} elseif ($uever.Length -gt 0) {
|
||||||
|
$ueVersions = @($uever)
|
||||||
|
} else {
|
||||||
|
$ueVersions = @($origUeVersion)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Write-Output ""
|
Write-Output ""
|
||||||
Write-Output "Project File : $projfile"
|
Write-Output "Project File : $pluginfile"
|
||||||
Write-Output "UE Version : $ueVersion"
|
Write-Output "UE Version(s) : $($ueVersions -join `", `")"
|
||||||
Write-Output "UE Install : $ueinstall"
|
|
||||||
Write-Output "Output Folder : $($config.BuildDir)"
|
Write-Output "Output Folder : $($config.BuildDir)"
|
||||||
Write-Output ""
|
Write-Output ""
|
||||||
|
|
||||||
$runUAT = Join-Path $ueinstall "Engine/Build/BatchFiles/RunUAT$batchSuffix"
|
foreach ($ver in $ueVersions) {
|
||||||
|
|
||||||
|
Write-Output "Building for UE Version $ver"
|
||||||
|
$ueinstall = Get-UE-Install $ver
|
||||||
|
$outputDir = Join-Path $config.BuildDir $ver
|
||||||
|
|
||||||
|
# Need to change the version in the plugin while we build
|
||||||
|
if (-not $dryrun -and ($allversions -or $ueVer.Length -gt 0)) {
|
||||||
|
Update-UpluginUeVersion $src $config $ver
|
||||||
|
}
|
||||||
|
|
||||||
|
$runUAT = Join-Path $ueinstall "Engine/Build/BatchFiles/RunUAT$batchSuffix"
|
||||||
|
|
||||||
$argList = [System.Collections.ArrayList]@()
|
$argList = [System.Collections.ArrayList]@()
|
||||||
$argList.Add("BuildPlugin") > $null
|
$argList.Add("BuildPlugin") > $null
|
||||||
$argList.Add("-Plugin=`"$pluginfile`"") > $null
|
$argList.Add("-Plugin=`"$pluginfile`"") > $null
|
||||||
$argList.Add("-Package=`"$($config.BuildDir)`"") > $null
|
$argList.Add("-Package=`"$outputDir`"") > $null
|
||||||
$argList.Add("-Rocket") > $null
|
$argList.Add("-Rocket") > $null
|
||||||
|
|
||||||
if (-not $allplatforms) {
|
if (-not $allplatforms) {
|
||||||
@ -97,10 +118,20 @@ try {
|
|||||||
} else {
|
} else {
|
||||||
$proc = Start-Process $runUAT $argList -Wait -PassThru -NoNewWindow
|
$proc = Start-Process $runUAT $argList -Wait -PassThru -NoNewWindow
|
||||||
if ($proc.ExitCode -ne 0) {
|
if ($proc.ExitCode -ne 0) {
|
||||||
|
# Reset the plugin back to the original UE version
|
||||||
|
if ($allversions -and -not $dryrun) {
|
||||||
|
Update-UpluginUeVersion $src $config $origUeVersion
|
||||||
|
}
|
||||||
|
|
||||||
throw "RunUAT failed!"
|
throw "RunUAT failed!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Reset the plugin back to the original UE version
|
||||||
|
if ($allversions -and -not $dryrun) {
|
||||||
|
Update-UpluginUeVersion $src $config $origUeVersion
|
||||||
|
}
|
||||||
|
|
||||||
Write-Output "-- Build plugin process finished OK --"
|
Write-Output "-- Build plugin process finished OK --"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user