summaryrefslogtreecommitdiff
path: root/build/windows/set-smapi-version.ps1
blob: ff6b209646ffc4451240159136e3739d4cc789eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#
#
# This is the PowerShell equivalent of ../unix/set-smapi-version.sh.
# When making changes, both scripts should be updated.
#
#


. "$PSScriptRoot\lib\in-place-regex.ps1"

# get version number
$version=$args[0]
if (!$version) {
    $version = Read-Host "SMAPI release version (like '4.0.0')"
}

# move to SMAPI root
cd "$PSScriptRoot/../.."

# apply changes
In-Place-Regex -Path "build/common.targets" -Search "<Version>.+</Version>" -Replace "<Version>$version</Version>"
In-Place-Regex -Path "src/SMAPI/Constants.cs" -Search "RawApiVersion = `".+?`";" -Replace "RawApiVersion = `"$version`";"
ForEach ($modName in "ConsoleCommands","ErrorHandler","SaveBackup") {
    In-Place-Regex -Path "src/SMAPI.Mods.$modName/manifest.json" -Search "`"(Version|MinimumApiVersion)`": `".+?`"" -Replace "`"`$1`": `"$version`""
}