Implement UpdateDependencies script to automatically take new versions of dependencies#7056
Conversation
b8c6825 to
e6c444f
Compare
|
@weshaggard @dagood - I have updated the dir.props to follow the pattern we established in dotnet/buildtools#557. Also, I added the new update dependencies script. PTAL. /cc: @piotrpMSFT @stephentoub |
UpdateDependencies.ps1
Outdated
| $nsMgr = new-object Xml.XmlNamespaceManager $xml.NameTable | ||
| $nsMgr.AddNamespace('b', 'http://schemas.microsoft.com/developer/msbuild/2003') | ||
|
|
||
| $node = $xml.SelectSingleNode('//b:ValidationPattern[@Include = "CoreFxVersions"]/b:ExpectedPrerelease', $nsMgr) |
There was a problem hiding this comment.
Is this going to cause reformatting of dir.props?
I thought we wanted to go ahead and put this into an independent property so it is a little easier to do a simple find replace. I suspect if we do that we don't even need use an XML API.
There was a problem hiding this comment.
The dir.props does get slightly reformatted by this, but there are only 2 changes. You can see what it would look like here: eerhardt@0693e38#diff-0b192804a6349e8c26d2b027afbd89a2L53
There are only two minor changes:
- <Import Project="$(MSBuildThisFileDirectory)Packaging.props"/>
+ <Import Project="$(MSBuildThisFileDirectory)Packaging.props" />- <DnuRestoreSource>@(DnuSourceList -> '--source %(Identity)', ' ')</DnuRestoreSource>
+ <DnuRestoreSource>@(DnuSourceList -> '--source %(Identity)', ' ')</DnuRestoreSource>My feeling was to not add a level of indirection (i.e. pull the value out into its own property) just for this script. Instead, write the dir.props as it makes sense, and then make the automation conform to it.
I can totally change this to to pull it out into its own variable, if you are strongly against this approach.
There was a problem hiding this comment.
I don't think I understood the comment on the other PR when I read it earlier, sorry--now I see that another reason to have it in its own property is that other parts of the build could use it later (without special code in the target). So it's not just for the update script's sake, it's for the build whenever we need this version number.
There was a problem hiding this comment.
Yes I would prefer we pull it out into its own property.
e6c444f to
03a7c48
Compare
|
@weshaggard and @dagood - I've responded to feedback and pushed the new changes. The dir.props replacement is a simple Regex now, so no formatting of the dir.props will occur. The new version number is written to the commit and PR messages. PTAL. |
| return $false | ||
| } | ||
|
|
||
| $DirPropsPath = "$PSScriptRoot\dir.props" |
There was a problem hiding this comment.
I don't have a particular issue with what you have here but I thought I would at least share how to do the same thing in powershell cmdlets as well (I wrote this a while ago as when I was looking at trying to automate this).
$dirprops = Get-Content dir.props | % { $_ -replace "<CoreFxExpectedPrerelease>(.*)</CoreFxExpectedPrerelease>","<CoreFxExpectedPrerelease>$buildNumber</CoreFxExpectedPrerelease>" }
Set-Content dir.props $dirprops
There was a problem hiding this comment.
I changed this to use your code.
|
Just some minor nits/comments on the powershell script but otherwise LGTM. I will likely want to revisit the environment variable piece as some point. |
|
LGTM, and I see that we're already on a buildtools version with the validate changes this needs. |
UpdateDependencies.ps1
Outdated
|
|
||
| $env:GIT_COMMITTER_NAME = $UserName | ||
| $env:GIT_COMMITTER_EMAIL = $Email | ||
| git commit -m "$CommitMessage" --author "$UserName <$Email>" | Out-Host |
There was a problem hiding this comment.
We should check to see if anything was commited, and opt out if there were no changes.
There was a problem hiding this comment.
If you add --porcelain I think this is as simple as checking to see if there were any lines of output. (But maybe this comment is just to mark it as future work which is fine too.)
There was a problem hiding this comment.
Nice! I used git status --porcelain. Works like a charm.
|
I've responded to feedback. PTAL |
15033d6 to
20fc2fd
Compare
|
Still LGTM. 👍 |
UpdateDependencies.ps1
Outdated
| [Parameter(Mandatory=$true)][string]$GitHubUser, | ||
| [Parameter(Mandatory=$true)][string]$GitHubEmail, | ||
| [Parameter(Mandatory=$true)][string]$GitHubPassword, | ||
| [string]$CoreFxVersionUrl='https://raw.githubusercontent.com/dotnet/versions/master/dotnet/corefx/master/Latest.txt', |
There was a problem hiding this comment.
I assume this still needs to be actually defined.
There was a problem hiding this comment.
Yes. This probably won't be the final location, given our conversation last week. But the idea is that this will be an optional parameter going forward. It felt wrong hard-coding 'https://github.com/eerhardt/versions' in the corefx repo, so I optimistically picked a URL.
Do you think it would be better to just make this mandatory now, since it doesn't work if you don't supply the actual value? Or should I hard-code the path to 'eerhardt/versions' for now? Or leave it as-is?
There was a problem hiding this comment.
Yes. I think this should be mandatory at least until we have a real value to default it to.
|
Fix the merges issues and update build values and then it looks good. |
…atic names. This allows automated tools to update the version numbers easier by referencing the names. Another advantage is we can write regular expressions easier. Putting regular expressions in the Include attribute can cause a lot of issues.
20fc2fd to
ab63a56
Compare
|
I've rebased, squashed and pushed the latest. I don't know why there aren't any CI jobs kicking off for this PR. If it was just the .ps1 script, I would be OK with merging it without CI. But since I'm updating the dir.props file, this should get a build to make sure it doesn't break the version validation script... |
|
Yes lets please verify CI works before merging. It looks like some jobs have triggered. |
|
@dotnet-bot test this please |
|
@dotnet-bot test Innerloop OSX Debug Build and Test |
|
@dotnet-bot test Innerloop Windows_NT Release Build and Test |
1 similar comment
|
@dotnet-bot test Innerloop Windows_NT Release Build and Test |
Implement UpdateDependencies script to automatically take new versions of dependencies Commit migrated from dotnet/corefx@36e9d05
There are 2 changes here:
Another advantage is we can write regular expressions easier. Putting regular expressions in the Include attribute can cause a lot of issues.
@dagood @weshaggard