Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Implement UpdateDependencies script to automatically take new versions of dependencies#7056

Merged
eerhardt merged 2 commits intodotnet:masterfrom
eerhardt:DependencyVersions
Mar 29, 2016
Merged

Implement UpdateDependencies script to automatically take new versions of dependencies#7056
eerhardt merged 2 commits intodotnet:masterfrom
eerhardt:DependencyVersions

Conversation

@eerhardt
Copy link
Member

There are 2 changes here:

  1. Move dependency validation patterns to Item metadata and add programmatic 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.
  2. Initial implementation of the UpdateDependencies.ps1 script. This script will be used to automate taking new versions of dependencies when new builds are available.
    • The first (and probably only) dependency to be automated is the CoreFX build numbers in the project.json files.

@dagood @weshaggard

@eerhardt eerhardt force-pushed the DependencyVersions branch from b8c6825 to e6c444f Compare March 22, 2016 17:50
@eerhardt eerhardt changed the title Move dependency validation patterns to a separate file. Implement UpdateDependencies script to automatically take new versions of dependencies Mar 22, 2016
@eerhardt
Copy link
Member Author

@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

$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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 -&gt; '--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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I would prefer we pull it out into its own property.

@eerhardt eerhardt force-pushed the DependencyVersions branch from e6c444f to 03a7c48 Compare March 23, 2016 05:01
@eerhardt
Copy link
Member Author

@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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this to use your code.

@weshaggard
Copy link
Member

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.

@dagood
Copy link
Member

dagood commented Mar 23, 2016

LGTM, and I see that we're already on a buildtools version with the validate changes this needs.


$env:GIT_COMMITTER_NAME = $UserName
$env:GIT_COMMITTER_EMAIL = $Email
git commit -m "$CommitMessage" --author "$UserName <$Email>" | Out-Host
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check to see if anything was commited, and opt out if there were no changes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I used git status --porcelain. Works like a charm.

@eerhardt
Copy link
Member Author

I've responded to feedback. PTAL

@eerhardt eerhardt force-pushed the DependencyVersions branch from 15033d6 to 20fc2fd Compare March 28, 2016 01:59
@dagood
Copy link
Member

dagood commented Mar 28, 2016

Still LGTM. 👍

[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',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this still needs to be actually defined.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I think this should be mandatory at least until we have a real value to default it to.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@weshaggard
Copy link
Member

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.
@eerhardt eerhardt force-pushed the DependencyVersions branch from 20fc2fd to ab63a56 Compare March 28, 2016 20:12
@eerhardt
Copy link
Member Author

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...

@weshaggard
Copy link
Member

Yes lets please verify CI works before merging. It looks like some jobs have triggered.
\

@eerhardt
Copy link
Member Author

@dotnet-bot test this please

@eerhardt
Copy link
Member Author

@dotnet-bot test Innerloop OSX Debug Build and Test
@dotnet-bot test Innerloop Windows_NT Release Build and Test

@eerhardt
Copy link
Member Author

@dotnet-bot test Innerloop Windows_NT Release Build and Test

1 similar comment
@eerhardt
Copy link
Member Author

@dotnet-bot test Innerloop Windows_NT Release Build and Test

@eerhardt eerhardt merged commit 36e9d05 into dotnet:master Mar 29, 2016
@karelz karelz modified the milestone: 1.0.0-rtm Dec 3, 2016
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Implement UpdateDependencies script to automatically take new versions of dependencies

Commit migrated from dotnet/corefx@36e9d05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants