diff --git a/build/Microsoft.DotNet.Cli.DependencyVersions.props b/build/Microsoft.DotNet.Cli.DependencyVersions.props index c073e263d..7550da827 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -1,7 +1,7 @@ - 2.0.0-beta-001507-00 + 2.0.0-beta-001509-00 15.2.0-preview-000002-01 2.0.0-rc4-61325-08 1.0.0-alpha-20170125-1 diff --git a/build_projects/update-dependencies/Config.cs b/build_projects/update-dependencies/Config.cs index c88680802..7f020bfeb 100644 --- a/build_projects/update-dependencies/Config.cs +++ b/build_projects/update-dependencies/Config.cs @@ -17,14 +17,12 @@ namespace Microsoft.DotNet.Scripts /// /// The following Environment Variables can optionally be specified: /// - /// COREFX_VERSION_URL - The Url to get the current CoreFx package versions. (ex. "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/corefx/release/1.0.0") - /// CORECLR_VERSION_URL - The Url to get the current CoreCLR version. (ex. "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/coreclr/release/1.0.0") /// ROSLYN_VERSION_URL - The Url to get the current Roslyn version. (ex. "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/roslyn/netcore1.0") - /// CORESETUP_VERSION_URL - The Url to get the current dotnet/core-setup package versions. (ex. "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/core-setup/release/1.0.0") + /// CORESETUP_VERSION_URL - The Url to get the current dotnet/core-setup package versions. (ex. "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/core-setup/master") /// GITHUB_ORIGIN_OWNER - The owner of the GitHub fork to push the commit and create the PR from. (ex. "dotnet-bot") /// GITHUB_UPSTREAM_OWNER - The owner of the GitHub base repo to create the PR to. (ex. "dotnet") /// GITHUB_PROJECT - The repo name under the ORIGIN and UPSTREAM owners. (ex. "cli") - /// GITHUB_UPSTREAM_BRANCH - The branch in the GitHub base repo to create the PR to. (ex. "rel/1.0.0") + /// GITHUB_UPSTREAM_BRANCH - The branch in the GitHub base repo to create the PR to. (ex. "master") /// GITHUB_PULL_REQUEST_NOTIFICATIONS - A semi-colon ';' separated list of GitHub users to notify on the PR. /// public class Config @@ -35,13 +33,11 @@ namespace Microsoft.DotNet.Scripts private Lazy _email = new Lazy(() => GetEnvironmentVariable("GITHUB_EMAIL")); private Lazy _password = new Lazy(() => GetEnvironmentVariable("GITHUB_PASSWORD")); - private Lazy _coreFxVersionUrl = new Lazy(() => GetEnvironmentVariable("COREFX_VERSION_URL", "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/corefx/release/1.0.0")); - private Lazy _coreClrVersionUrl = new Lazy(() => GetEnvironmentVariable("CORECLR_VERSION_URL", "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/coreclr/release/1.0.0")); private Lazy _roslynVersionUrl = new Lazy(() => GetEnvironmentVariable("ROSLYN_VERSION_URL", "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/roslyn/netcore1.0")); - private Lazy _coreSetupVersionUrl = new Lazy(() => GetEnvironmentVariable("CORESETUP_VERSION_URL", "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/core-setup/release/1.0.0")); + private Lazy _coreSetupVersionUrl = new Lazy(() => GetEnvironmentVariable("CORESETUP_VERSION_URL", "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/core-setup/master")); private Lazy _gitHubUpstreamOwner = new Lazy(() => GetEnvironmentVariable("GITHUB_UPSTREAM_OWNER", "dotnet")); private Lazy _gitHubProject = new Lazy(() => GetEnvironmentVariable("GITHUB_PROJECT", "cli")); - private Lazy _gitHubUpstreamBranch = new Lazy(() => GetEnvironmentVariable("GITHUB_UPSTREAM_BRANCH", "rel/1.0.0")); + private Lazy _gitHubUpstreamBranch = new Lazy(() => GetEnvironmentVariable("GITHUB_UPSTREAM_BRANCH", "master")); private Lazy _gitHubPullRequestNotifications = new Lazy(() => GetEnvironmentVariable("GITHUB_PULL_REQUEST_NOTIFICATIONS", "") .Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)); @@ -53,8 +49,6 @@ namespace Microsoft.DotNet.Scripts public string UserName => _userName.Value; public string Email => _email.Value; public string Password => _password.Value; - public string CoreFxVersionUrl => _coreFxVersionUrl.Value; - public string CoreClrVersionUrl => _coreClrVersionUrl.Value; public string RoslynVersionUrl => _roslynVersionUrl.Value; public string CoreSetupVersionUrl => _coreSetupVersionUrl.Value; public string GitHubUpstreamOwner => _gitHubUpstreamOwner.Value; diff --git a/build_projects/update-dependencies/Program.cs b/build_projects/update-dependencies/Program.cs index 62dcd0ed5..a10692bed 100644 --- a/build_projects/update-dependencies/Program.cs +++ b/build_projects/update-dependencies/Program.cs @@ -21,75 +21,57 @@ namespace Microsoft.DotNet.Scripts { DebugHelper.HandleDebugSwitch(ref args); + bool onlyUpdate = args.Length > 0 && string.Equals("--Update", args[0], StringComparison.OrdinalIgnoreCase); + List buildInfos = new List(); - buildInfos.Add(BuildInfo.Get("CoreFx", s_config.CoreFxVersionUrl, fetchLatestReleaseFile: false)); - buildInfos.Add(BuildInfo.Get("CoreClr", s_config.CoreClrVersionUrl, fetchLatestReleaseFile: false)); buildInfos.Add(BuildInfo.Get("Roslyn", s_config.RoslynVersionUrl, fetchLatestReleaseFile: false)); buildInfos.Add(BuildInfo.Get("CoreSetup", s_config.CoreSetupVersionUrl, fetchLatestReleaseFile: false)); IEnumerable updaters = GetUpdaters(); + var dependencyBuildInfos = buildInfos.Select(buildInfo => + new DependencyBuildInfo( + buildInfo, + upgradeStableVersions: true, + disabledPackages: Enumerable.Empty())); + DependencyUpdateResults updateResults = DependencyUpdateUtils.Update(updaters, dependencyBuildInfos); - GitHubAuth gitHubAuth = new GitHubAuth(s_config.Password, s_config.UserName, s_config.Email); - - DependencyUpdater dependencyUpdater = new DependencyUpdater( - gitHubAuth, - s_config.GitHubProject, - s_config.GitHubUpstreamOwner, - s_config.GitHubUpstreamBranch, - s_config.UserName, - s_config.GitHubPullRequestNotifications); - - if (args.Length > 0 && string.Equals("--Update", args[0], StringComparison.OrdinalIgnoreCase)) + if (updateResults.ChangesDetected() && !onlyUpdate) { - dependencyUpdater.Update(updaters, buildInfos); - } - else - { - dependencyUpdater.UpdateAndSubmitPullRequestAsync(updaters, buildInfos); + GitHubAuth gitHubAuth = new GitHubAuth(s_config.Password, s_config.UserName, s_config.Email); + GitHubProject origin = new GitHubProject(s_config.GitHubProject, s_config.UserName); + GitHubBranch upstreamBranch = new GitHubBranch( + s_config.GitHubUpstreamBranch, + new GitHubProject(s_config.GitHubProject, s_config.GitHubUpstreamOwner)); + + string suggestedMessage = updateResults.GetSuggestedCommitMessage(); + string body = string.Empty; + if (s_config.GitHubPullRequestNotifications.Any()) + { + body += PullRequestCreator.NotificationString(s_config.GitHubPullRequestNotifications); + } + + new PullRequestCreator(gitHubAuth, origin, upstreamBranch) + .CreateOrUpdateAsync( + suggestedMessage, + suggestedMessage + $" ({upstreamBranch.Name})", + body) + .Wait(); } } private static IEnumerable GetUpdaters() { - yield return CreateProjectJsonUpdater(); - - yield return CreateRegexUpdater(@"build_projects\shared-build-targets-utils\DependencyVersions.cs", "CoreCLRVersion", "Microsoft.NETCore.Runtime.CoreCLR"); - yield return CreateRegexUpdater(@"build_projects\shared-build-targets-utils\DependencyVersions.cs", "JitVersion", "Microsoft.NETCore.Jit"); - - yield return CreateRegexUpdater(@"build_projects\dotnet-cli-build\CliDependencyVersions.cs", "SharedFrameworkVersion", "Microsoft.NETCore.App"); - yield return CreateRegexUpdater(@"build_projects\dotnet-cli-build\CliDependencyVersions.cs", "HostFxrVersion", "Microsoft.NETCore.DotNetHostResolver"); - yield return CreateRegexUpdater(@"build_projects\dotnet-cli-build\CliDependencyVersions.cs", "SharedHostVersion", "Microsoft.NETCore.DotNetHost"); + yield return CreateRegexUpdater(@"build\Microsoft.DotNet.Cli.DependencyVersions.props", "CLI_SharedFrameworkVersion", "Microsoft.NETCore.App"); } - private static IDependencyUpdater CreateProjectJsonUpdater() - { - IEnumerable projectJsonFiles = GetProjectJsonsToUpdate(); - - return new ProjectJsonUpdater(projectJsonFiles) - { - SkipStableVersions = false - }; - } - - private static IEnumerable GetProjectJsonsToUpdate() - { - const string noUpdateFileName = ".noautoupdate"; - - return Enumerable.Union( - Directory.GetFiles(Dirs.RepoRoot, "project.json", SearchOption.AllDirectories), - Directory.GetFiles(Path.Combine(Dirs.RepoRoot, @"src\dotnet\commands\dotnet-new"), "project.json.template", SearchOption.AllDirectories)) - .Where(p => !File.Exists(Path.Combine(Path.GetDirectoryName(p), noUpdateFileName)) && - !Path.GetDirectoryName(p).EndsWith("CSharp_Web", StringComparison.Ordinal)); - } - - private static IDependencyUpdater CreateRegexUpdater(string repoRelativePath, string dependencyPropertyName, string packageId) + private static IDependencyUpdater CreateRegexUpdater(string repoRelativePath, string propertyName, string packageId) { return new FileRegexPackageUpdater() { Path = Path.Combine(Dirs.RepoRoot, repoRelativePath), PackageId = packageId, - Regex = new Regex($@"{dependencyPropertyName} = ""(?.*)"";"), + Regex = new Regex($@"<{propertyName}>(?.*)"), VersionGroupName = "version" }; } diff --git a/build_projects/update-dependencies/update-dependencies.csproj b/build_projects/update-dependencies/update-dependencies.csproj index 42c4d52f2..daa3308a1 100644 --- a/build_projects/update-dependencies/update-dependencies.csproj +++ b/build_projects/update-dependencies/update-dependencies.csproj @@ -3,10 +3,8 @@ Updates the repos dependencies - netcoreapp1.0 - update-dependencies Exe - win7-x64;win7-x86;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.23-x64;opensuse.13.2-x64 + netcoreapp1.0 @@ -14,15 +12,8 @@ - - 1.0.0 - - - 1.0.26-prerelease-00615-07 - + + - - $(DefineConstants);RELEASE - diff --git a/build_projects/update-dependencies/update-dependencies.ps1 b/build_projects/update-dependencies/update-dependencies.ps1 index 8ed440f64..fbddb081f 100644 --- a/build_projects/update-dependencies/update-dependencies.ps1 +++ b/build_projects/update-dependencies/update-dependencies.ps1 @@ -18,7 +18,7 @@ if($Help) $Architecture='x64' $RepoRoot = "$PSScriptRoot\..\.." -$AppPath = "$PSScriptRoot" +$ProjectPath = "$PSScriptRoot\update-dependencies.csproj" # Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot if (!$env:DOTNET_INSTALL_DIR) @@ -28,26 +28,18 @@ if (!$env:DOTNET_INSTALL_DIR) # Install a stage 0 Write-Host "Installing .NET Core CLI Stage 0" -& "$RepoRoot\scripts\obtain\dotnet-install.ps1" -Architecture $Architecture +& "$RepoRoot\scripts\obtain\dotnet-install.ps1" -Channel "master" -Architecture $Architecture if($LASTEXITCODE -ne 0) { throw "Failed to install stage0" } # Put the stage0 on the path $env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH" # Restore the app -Write-Host "Restoring update-dependencies..." -pushd "$AppPath" -dotnet restore +Write-Host "Restoring $ProjectPath..." +dotnet restore "$ProjectPath" if($LASTEXITCODE -ne 0) { throw "Failed to restore" } -popd - -# Publish the app -Write-Host "Compiling App..." -dotnet publish "$AppPath" -o "$AppPath\bin" --framework netcoreapp1.0 -if($LASTEXITCODE -ne 0) { throw "Failed to compile build scripts" } # Run the app -Write-Host "Invoking App $AppPath..." -Write-Host " Configuration: $env:CONFIGURATION" -& "$AppPath\bin\update-dependencies.exe" +Write-Host "Invoking App $ProjectPath..." +dotnet run -p "$ProjectPath" if($LASTEXITCODE -ne 0) { throw "Build failed" } diff --git a/src/Microsoft.DotNet.Configurer/LocalizableStrings.cs b/src/Microsoft.DotNet.Configurer/LocalizableStrings.cs index 0bb19cc55..5e5ec9d3b 100644 --- a/src/Microsoft.DotNet.Configurer/LocalizableStrings.cs +++ b/src/Microsoft.DotNet.Configurer/LocalizableStrings.cs @@ -19,6 +19,6 @@ Configuring... ------------------- A command is running to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once."; - public const string FailedToPrimeCacheError = "Failed to create prime the NuGet cache. {0} failed with: {1}"; + public const string FailedToPrimeCacheError = "Failed to prime the NuGet cache. {0} failed with: {1}"; } } \ No newline at end of file