forked from dotnet/wcf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UpdateDependencies.ps1
52 lines (39 loc) · 1.47 KB
/
UpdateDependencies.ps1
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
# This script updates all the project.json files with the build version passed in
param(
[Parameter(Mandatory=$true)][string]$NewVersion
)
# Updates the dir.props and Packages.props files with the new build number
function UpdateValidDependencyVersionsFile
{
$DirPropsPath = "$PSScriptRoot\dir.props"
$DirPropsContent = Get-Content $DirPropsPath | % {
$_ -replace "<CoreFxExpectedPrerelease>.*</CoreFxExpectedPrerelease>","<CoreFxExpectedPrerelease>$NewVersion</CoreFxExpectedPrerelease>"
}
Set-Content $DirPropsPath $DirPropsContent
$PackagingPropsPath = "$PSScriptRoot\Packaging.props"
$PackagingPropsContent = Get-Content $PackagingPropsPath | % {
$_ -replace "/1.0.1-.*/runtime.json","/1.0.1-$NewVersion/runtime.json"
}
Set-Content $PackagingPropsPath $PackagingPropsContent
return $true
}
# Updates all the project.json files with out of date version numbers
function RunUpdatePackageDependencyVersions
{
cmd /c $PSScriptRoot\build.cmd /t:UpdateInvalidPackageVersions | Out-Host
return $LASTEXITCODE -eq 0
}
if (!(UpdateValidDependencyVersionsFile))
{
Exit -1
}
if (!(RunUpdatePackageDependencyVersions))
{
Exit -1
}
Write-Host -ForegroundColor Green "Successfully updated dependencies from the latest build numbers"
exit $LastExitCode