mirror of
https://github.com/sinbad/UEScripts.git
synced 2025-02-23 13:15:23 +00:00
Support multiple EngineVersions
This commit is contained in:
parent
5202e2e63b
commit
f21dff2084
@ -32,9 +32,33 @@ in the root of your plugin, next to the .uplugin file. The options are:
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"OutputDir": "C:\\Users\\Steve\\MarketplaceBuilds",
|
"OutputDir": "C:\\Users\\Steve\\MarketplaceBuilds",
|
||||||
"PluginFile": "OptionalPluginFilenameWillDetectInDirOtherwise.uplugin"
|
"PluginFile": "OptionalPluginFilenameWillDetectInDirOtherwise.uplugin",
|
||||||
|
"EngineVersions":
|
||||||
|
[
|
||||||
|
"5.0.0",
|
||||||
|
"5.1.0",
|
||||||
|
"5.2.0"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
`OutputDir` and `EngineVersions` are required.
|
||||||
|
|
||||||
|
## Engine Versions
|
||||||
|
|
||||||
|
When submitting code plugins to the Marketplace, you're only allowed to include
|
||||||
|
a single supported `EngineVersion` in each version you upload. Even though you
|
||||||
|
don't submit built binaries to the Marketplace, the publisher portal requires
|
||||||
|
that the .uplugin has a single `EngineVersion` entry.
|
||||||
|
|
||||||
|
Therefore to support multiple engine versions, you have to upload several essentially
|
||||||
|
identical source archives, with each one having a different `EngineVersion` specified
|
||||||
|
in the .uplugin.
|
||||||
|
|
||||||
|
This script helps you do that; for each entry in `EngineVersions` in the `pluginconfig.json`,
|
||||||
|
a separate zip archive is generated, with the correct version set in the .uplugin.
|
||||||
|
|
||||||
|
> It seems you should always use ".0" as the 3rd version digit.
|
||||||
|
|
||||||
## Excluding Files
|
## Excluding Files
|
||||||
|
|
||||||
By default, the plugin packaging process automatically excludes common
|
By default, the plugin packaging process automatically excludes common
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
class PluginConfig {
|
class PluginConfig {
|
||||||
[string]$OutputDir
|
[string]$OutputDir
|
||||||
|
[string]$PluginFile
|
||||||
|
[array]$EngineVersions
|
||||||
|
|
||||||
PluginConfig([PSCustomObject]$obj) {
|
PluginConfig([PSCustomObject]$obj) {
|
||||||
# Construct from JSON object
|
# Construct from JSON object
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
{
|
{
|
||||||
"OutputDir": "/Path/To/Output/Parent/Dir",
|
"OutputDir": "/Path/To/Output/Parent/Dir",
|
||||||
|
|
||||||
"PluginFile": "OptionalPluginFilenameWillDetectInDirOtherwise.uplugin"
|
"PluginFile": "OptionalPluginFilenameWillDetectInDirOtherwise.uplugin",
|
||||||
|
|
||||||
|
"EngineVersions":
|
||||||
|
[
|
||||||
|
"5.0",
|
||||||
|
"5.1",
|
||||||
|
"5.2"
|
||||||
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,11 +124,18 @@ try {
|
|||||||
}
|
}
|
||||||
$proj = Read-Uproject $pluginfile
|
$proj = Read-Uproject $pluginfile
|
||||||
$pluginName = (Get-Item $pluginfile).Basename
|
$pluginName = (Get-Item $pluginfile).Basename
|
||||||
$saveuplugin = $false
|
|
||||||
|
# Default to latest engine if not specified
|
||||||
|
if (-not $config.EngineVersions -or $config.EngineVersions.Length -eq 0) {
|
||||||
|
Write-Output "Warning: EngineVersions missing from pluginconfig.json, assuming latest only"
|
||||||
|
$config.EngineVersions = [System.Collections.ArrayList]@()
|
||||||
|
$config.EngineVersions.add($proj.EngineVersion) > $null
|
||||||
|
}
|
||||||
|
|
||||||
Write-Output ""
|
Write-Output ""
|
||||||
Write-Output "Plugin File : $pluginfile"
|
Write-Output "Plugin File : $pluginfile"
|
||||||
Write-Output "Output Folder : $($config.OutputDir)"
|
Write-Output "Output Folder : $($config.OutputDir)"
|
||||||
|
Write-Output "Engine Versions : $($config.EngineVersions -join ", ")"
|
||||||
Write-Output ""
|
Write-Output ""
|
||||||
|
|
||||||
if (([bool]$major + [bool]$minor + [bool]$patch + [bool]$hotfix) -eq 0) {
|
if (([bool]$major + [bool]$minor + [bool]$patch + [bool]$hotfix) -eq 0) {
|
||||||
@ -141,7 +148,6 @@ try {
|
|||||||
$versionNumber = Get-NextPluginVersion -current:$versionNumber -major:$major -minor:$minor -patch:$patch -hotfix:$hotfix
|
$versionNumber = Get-NextPluginVersion -current:$versionNumber -major:$major -minor:$minor -patch:$patch -hotfix:$hotfix
|
||||||
# Save incremented version back to uplugin object (will be saved later)
|
# Save incremented version back to uplugin object (will be saved later)
|
||||||
$proj.VersionName = $versionNumber
|
$proj.VersionName = $versionNumber
|
||||||
$saveuplugin = $true
|
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Output $_.Exception.Message
|
Write-Output $_.Exception.Message
|
||||||
@ -169,29 +175,25 @@ try {
|
|||||||
if (-not $proj.Installed) {
|
if (-not $proj.Installed) {
|
||||||
# Need to set the installed=true for marketplace
|
# Need to set the installed=true for marketplace
|
||||||
$proj.Installed = $true
|
$proj.Installed = $true
|
||||||
$saveuplugin = $true
|
|
||||||
$resetinstalled = $true
|
$resetinstalled = $true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Marketplace requires you to submit one package per EngineVersion for code plugins
|
||||||
|
# Pretty dumb since the only diff is the EngineVersion in .uplugin but sure
|
||||||
|
$oldEngineVer = $proj.EngineVersion
|
||||||
|
foreach ($EngineVer in $config.EngineVersions) {
|
||||||
|
Write-Output "Packaging for Engine Version $EngineVer"
|
||||||
|
$proj.EngineVersion = $EngineVer
|
||||||
|
|
||||||
if ($saveuplugin) {
|
|
||||||
$newjson = ($proj | ConvertTo-Json -depth 100)
|
$newjson = ($proj | ConvertTo-Json -depth 100)
|
||||||
if ($dryrun) {
|
if (-not $dryrun) {
|
||||||
Write-Output ""
|
|
||||||
Write-Output "Would have updated .uproject to:"
|
|
||||||
Write-Output $newjson
|
|
||||||
Write-Output ""
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Write-Output "Writing updates to .uproject"
|
Write-Output "Writing updates to .uproject"
|
||||||
$newjson | Out-File $pluginfile
|
$newjson | Out-File $pluginfile
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
# Zip parent of the uplugin folder
|
# Zip parent of the uplugin folder
|
||||||
$zipsrc = (Get-Item $pluginfile).Directory.FullName
|
$zipsrc = (Get-Item $pluginfile).Directory.FullName
|
||||||
$zipdst = Join-Path $config.OutputDir "$($pluginName)_$($versionNumber).zip"
|
$zipdst = Join-Path $config.OutputDir "$($pluginName)_v$($versionNumber)_UE$($EngineVer).zip"
|
||||||
$excludefilename = "packageexclusions.txt"
|
$excludefilename = "packageexclusions.txt"
|
||||||
$excludefile = Join-Path $zipsrc $excludefilename
|
$excludefile = Join-Path $zipsrc $excludefilename
|
||||||
|
|
||||||
@ -230,25 +232,22 @@ try {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Reset the installed flag back to how it was, for convenience
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Reset the uplugin
|
||||||
# Otherwise UE keeps prompting to update project files when using it as source
|
# Otherwise UE keeps prompting to update project files when using it as source
|
||||||
if ($resetinstalled) {
|
if ($resetinstalled) {
|
||||||
$proj.Installed = $false
|
$proj.Installed = $false
|
||||||
$newjson = ($proj | ConvertTo-Json -depth 100)
|
}
|
||||||
if ($dryrun) {
|
$proj.EngineVersion = $oldEngineVer
|
||||||
Write-Output ""
|
|
||||||
Write-Output "Would have updated .uproject to:"
|
|
||||||
Write-Output $newjson
|
|
||||||
Write-Output ""
|
|
||||||
|
|
||||||
} else {
|
if (-not $dryrun) {
|
||||||
Write-Output "Writing updates to .uproject"
|
$newjson = ($proj | ConvertTo-Json -depth 100)
|
||||||
|
Write-Output "Resetting .uproject"
|
||||||
$newjson | Out-File $pluginfile
|
$newjson | Out-File $pluginfile
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($browse -and -not $dryrun) {
|
if ($browse -and -not $dryrun) {
|
||||||
Invoke-Item $config.OutputDir
|
Invoke-Item $config.OutputDir
|
||||||
|
Loading…
x
Reference in New Issue
Block a user