From d8ed19b363d4671dbdd599e8d0942ad06eda58b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emek=20Vysok=C3=BD?= Date: Wed, 14 Sep 2022 11:19:47 +0200 Subject: [PATCH] Let VMR CLI handle recursive initialization (#14476) Previously, the recursive clone of all the product repos based on `Version.Details.xml` files was done inside MSBuild but the VMR tooling can now do that (https://github.com/dotnet/arcade-services/pull/2004). This replaces the need for the Source-Build tasks (Read/Write, recursive clone). Secondly, `git-info` props files are now created by the CLI too (https://github.com/dotnet/arcade-services/pull/2014). --- eng/Version.Details.xml | 4 +- eng/Versions.props | 2 +- src/VirtualMonoRepo/InitializeVMR.proj | 61 +++++-------------- src/VirtualMonoRepo/Tasks/RemoteFactory.cs | 12 ++-- .../Tasks/VirtualMonoRepo_Initialize.cs | 11 +++- 5 files changed, 37 insertions(+), 53 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9b685bcbc..b7b91aec8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -207,9 +207,9 @@ https://github.com/dotnet/arcade 91db46836065516e87e05bbdb51c5aee0f90428c - + https://github.com/dotnet/arcade-services - f169af20efd542ef8aba38154efb9ccd22eba2c4 + 1031000fad67fa8e3f8dc67ef73611b556eb33a5 https://github.com/dotnet/runtime diff --git a/eng/Versions.props b/eng/Versions.props index 648a8ef2b..52e8c1af8 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -30,7 +30,7 @@ - 1.1.0-beta.22429.1 + 1.1.0-beta.22462.2 diff --git a/src/VirtualMonoRepo/InitializeVMR.proj b/src/VirtualMonoRepo/InitializeVMR.proj index 176498bff..5270fc9da 100644 --- a/src/VirtualMonoRepo/InitializeVMR.proj +++ b/src/VirtualMonoRepo/InitializeVMR.proj @@ -35,9 +35,7 @@ InitializeCleanVmr; CopyTarballContent; CommitInitialContent; - SetupSelfGithubInfo; InitializeRepoAndDependentsRecursive; - CommitGitInfoFiles; CopyTextOnlyPackages; CommitTextOnlyPackages"> @@ -60,57 +58,30 @@ - - $(SourceBuildRepoName)/ - $(VmrSourceDir)$(SourceDir) - $(IndividualRepoSourceDir)eng/ - $(IndividualRepoSourceEngDir)Version.Details.xml + $([System.IO.Path]::GetFileName("$(RepoRoot.TrimEnd('/').TrimEnd('\\'))")) + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/VirtualMonoRepo/Tasks/RemoteFactory.cs b/src/VirtualMonoRepo/Tasks/RemoteFactory.cs index cde8faadd..24d8914f3 100644 --- a/src/VirtualMonoRepo/Tasks/RemoteFactory.cs +++ b/src/VirtualMonoRepo/Tasks/RemoteFactory.cs @@ -5,26 +5,29 @@ using System; using System.Threading.Tasks; using Microsoft.DotNet.DarcLib; using Microsoft.DotNet.DarcLib.Helpers; +using Microsoft.Extensions.Logging; namespace Microsoft.DotNet.VirtualMonoRepo.Tasks; internal class RemoteFactory : IRemoteFactory { private readonly IProcessManager _processManager; + private readonly IVersionDetailsParser _versionDetailsParser; private readonly string _tmpPath; - public RemoteFactory(IProcessManager processManager, string tmpPath) + public RemoteFactory(IProcessManager processManager, IVersionDetailsParser versionDetailsParser, string tmpPath) { _processManager = processManager; + _versionDetailsParser = versionDetailsParser; _tmpPath = tmpPath; } - public Task GetBarOnlyRemoteAsync(Extensions.Logging.ILogger logger) + public Task GetBarOnlyRemoteAsync(ILogger logger) { throw new NotImplementedException(); } - public Task GetRemoteAsync(string repoUrl, Extensions.Logging.ILogger logger) + public Task GetRemoteAsync(string repoUrl, ILogger logger) { var githubClient = new DarcLib.GitHubClient( _processManager.GitExecutable, @@ -33,6 +36,7 @@ internal class RemoteFactory : IRemoteFactory _tmpPath, cache: null); - return System.Threading.Tasks.Task.FromResult(new Remote(githubClient, barClient: null, logger)); + IRemote remote = new Remote(githubClient, barClient: null, _versionDetailsParser, logger); + return Task.FromResult(remote); } } diff --git a/src/VirtualMonoRepo/Tasks/VirtualMonoRepo_Initialize.cs b/src/VirtualMonoRepo/Tasks/VirtualMonoRepo_Initialize.cs index 3a0e1b77a..54b947ac4 100644 --- a/src/VirtualMonoRepo/Tasks/VirtualMonoRepo_Initialize.cs +++ b/src/VirtualMonoRepo/Tasks/VirtualMonoRepo_Initialize.cs @@ -14,6 +14,11 @@ using Microsoft.Extensions.Logging; namespace Microsoft.DotNet.VirtualMonoRepo.Tasks; +/// +/// This tasks equals calling the "darc vmr initialize" command. +/// This command pulls an individual repository into the VMR for the first time. +/// It can also recursively pull all of its dependencies based on Version.Details.xml. +/// public class VirtualMonoRepo_Initialize : Build.Utilities.Task, ICancelableTask { private readonly Lazy _serviceProvider; @@ -30,6 +35,10 @@ public class VirtualMonoRepo_Initialize : Build.Utilities.Task, ICancelableTask public string Revision { get; set; } + public string PackageVersion { get; set; } + + public bool Recursive { get; set; } + public VirtualMonoRepo_Initialize() { _serviceProvider = new(CreateServiceProvider); @@ -40,7 +49,7 @@ public class VirtualMonoRepo_Initialize : Build.Utilities.Task, ICancelableTask private async Task ExecuteAsync() { var vmrInitializer = _serviceProvider.Value.GetRequiredService(); - await vmrInitializer.InitializeVmr(Repository, Revision, _cancellationToken.Token); + await vmrInitializer.InitializeRepository(Repository, Revision, PackageVersion, Recursive, _cancellationToken.Token); return true; }