From 72749a1a6c88e2fde6024eadbf1c7223ad169b41 Mon Sep 17 00:00:00 2001 From: Tomas Matousek Date: Sun, 19 Oct 2025 13:09:41 -0700 Subject: [PATCH 1/2] Delete TFVC implementation --- SourceLink.sln | 16 +--- .../GetRepositoryUrl.cs | 37 --------- .../GetSourceRevisionId.cs | 26 ------ .../GetSourceRoots.cs | 72 ----------------- .../GetUntrackedSourceFiles.cs | 46 ----------- .../LocateRepository.cs | 81 ------------------- .../Microsoft.Build.Tasks.Tfvc.csproj | 19 ----- .../RepositoryTask.cs | 31 ------- .../build/Microsoft.Build.Tasks.Tfvc.props | 6 -- .../build/Microsoft.Build.Tasks.Tfvc.targets | 49 ----------- .../Microsoft.Build.Tasks.Tfvc.props | 4 - .../Microsoft.Build.Tasks.Tfvc.targets | 4 - .../Microsoft.Build.Tasks.Tfvc.props | 4 - .../Microsoft.Build.Tasks.Tfvc.targets | 4 - .../GetSourceLinkUrl.cs | 68 ---------------- ...icrosoft.SourceLink.AzureRepos.Tfvc.csproj | 22 ----- ...crosoft.SourceLink.AzureRepos.Tfvc.targets | 24 ------ ...crosoft.SourceLink.AzureRepos.Tfvc.targets | 4 - 18 files changed, 2 insertions(+), 515 deletions(-) delete mode 100644 src/Microsoft.Build.Tasks.Tfvc/GetRepositoryUrl.cs delete mode 100644 src/Microsoft.Build.Tasks.Tfvc/GetSourceRevisionId.cs delete mode 100644 src/Microsoft.Build.Tasks.Tfvc/GetSourceRoots.cs delete mode 100644 src/Microsoft.Build.Tasks.Tfvc/GetUntrackedSourceFiles.cs delete mode 100644 src/Microsoft.Build.Tasks.Tfvc/LocateRepository.cs delete mode 100644 src/Microsoft.Build.Tasks.Tfvc/Microsoft.Build.Tasks.Tfvc.csproj delete mode 100644 src/Microsoft.Build.Tasks.Tfvc/RepositoryTask.cs delete mode 100644 src/Microsoft.Build.Tasks.Tfvc/build/Microsoft.Build.Tasks.Tfvc.props delete mode 100644 src/Microsoft.Build.Tasks.Tfvc/build/Microsoft.Build.Tasks.Tfvc.targets delete mode 100644 src/Microsoft.Build.Tasks.Tfvc/buildMultiTargeting/Microsoft.Build.Tasks.Tfvc.props delete mode 100644 src/Microsoft.Build.Tasks.Tfvc/buildMultiTargeting/Microsoft.Build.Tasks.Tfvc.targets delete mode 100644 src/Microsoft.Build.Tasks.Tfvc/buildTransitive/Microsoft.Build.Tasks.Tfvc.props delete mode 100644 src/Microsoft.Build.Tasks.Tfvc/buildTransitive/Microsoft.Build.Tasks.Tfvc.targets delete mode 100644 src/SourceLink.AzureRepos.Tfvc/GetSourceLinkUrl.cs delete mode 100644 src/SourceLink.AzureRepos.Tfvc/Microsoft.SourceLink.AzureRepos.Tfvc.csproj delete mode 100644 src/SourceLink.AzureRepos.Tfvc/build/Microsoft.SourceLink.AzureRepos.Tfvc.targets delete mode 100644 src/SourceLink.AzureRepos.Tfvc/buildMultiTargeting/Microsoft.SourceLink.AzureRepos.Tfvc.targets diff --git a/SourceLink.sln b/SourceLink.sln index ddd10ae9..f75f8bdb 100644 --- a/SourceLink.sln +++ b/SourceLink.sln @@ -1,12 +1,10 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.9.34322.126 +# Visual Studio Version 18 +VisualStudioVersion = 18.0.11114.144 d18.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Build.Tasks.Git", "src\Microsoft.Build.Tasks.Git\Microsoft.Build.Tasks.Git.csproj", "{A86F9DC3-9595-44AC-ACC6-025FB74813E6}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Build.Tasks.Tfvc", "src\Microsoft.Build.Tasks.Tfvc\Microsoft.Build.Tasks.Tfvc.csproj", "{13E94F49-DE63-4F6A-8771-D6AE9B7E043D}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.SourceLink.Common", "src\SourceLink.Common\Microsoft.SourceLink.Common.csproj", "{1FAB9031-3148-476B-B9BB-AB89B8CD2C17}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.SourceLink.Common.UnitTests", "src\SourceLink.Common.UnitTests\Microsoft.SourceLink.Common.UnitTests.csproj", "{9C090D12-1C88-4CB0-849E-3B1668CE0159}" @@ -19,8 +17,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.SourceLink.GitHub EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.SourceLink.AzureRepos.Git", "src\SourceLink.AzureRepos.Git\Microsoft.SourceLink.AzureRepos.Git.csproj", "{076D322B-A705-4C57-A5A0-39C81BCFC285}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.SourceLink.AzureRepos.Tfvc", "src\SourceLink.AzureRepos.Tfvc\Microsoft.SourceLink.AzureRepos.Tfvc.csproj", "{DA058284-2FBD-459C-B9F3-82B5F7713C6F}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestUtilities", "src\TestUtilities\TestUtilities.csproj", "{D6ED6730-02A8-4B21-8D62-C7B2009F53A5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.SourceLink.Git.IntegrationTests", "src\SourceLink.Git.IntegrationTests\Microsoft.SourceLink.Git.IntegrationTests.csproj", "{A273E201-8CF8-4E18-BE21-423B7CFE9B31}" @@ -103,10 +99,6 @@ Global {A86F9DC3-9595-44AC-ACC6-025FB74813E6}.Debug|Any CPU.Build.0 = Debug|Any CPU {A86F9DC3-9595-44AC-ACC6-025FB74813E6}.Release|Any CPU.ActiveCfg = Release|Any CPU {A86F9DC3-9595-44AC-ACC6-025FB74813E6}.Release|Any CPU.Build.0 = Release|Any CPU - {13E94F49-DE63-4F6A-8771-D6AE9B7E043D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {13E94F49-DE63-4F6A-8771-D6AE9B7E043D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {13E94F49-DE63-4F6A-8771-D6AE9B7E043D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {13E94F49-DE63-4F6A-8771-D6AE9B7E043D}.Release|Any CPU.Build.0 = Release|Any CPU {1FAB9031-3148-476B-B9BB-AB89B8CD2C17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1FAB9031-3148-476B-B9BB-AB89B8CD2C17}.Debug|Any CPU.Build.0 = Debug|Any CPU {1FAB9031-3148-476B-B9BB-AB89B8CD2C17}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -131,10 +123,6 @@ Global {076D322B-A705-4C57-A5A0-39C81BCFC285}.Debug|Any CPU.Build.0 = Debug|Any CPU {076D322B-A705-4C57-A5A0-39C81BCFC285}.Release|Any CPU.ActiveCfg = Release|Any CPU {076D322B-A705-4C57-A5A0-39C81BCFC285}.Release|Any CPU.Build.0 = Release|Any CPU - {DA058284-2FBD-459C-B9F3-82B5F7713C6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DA058284-2FBD-459C-B9F3-82B5F7713C6F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DA058284-2FBD-459C-B9F3-82B5F7713C6F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DA058284-2FBD-459C-B9F3-82B5F7713C6F}.Release|Any CPU.Build.0 = Release|Any CPU {D6ED6730-02A8-4B21-8D62-C7B2009F53A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D6ED6730-02A8-4B21-8D62-C7B2009F53A5}.Debug|Any CPU.Build.0 = Debug|Any CPU {D6ED6730-02A8-4B21-8D62-C7B2009F53A5}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/src/Microsoft.Build.Tasks.Tfvc/GetRepositoryUrl.cs b/src/Microsoft.Build.Tasks.Tfvc/GetRepositoryUrl.cs deleted file mode 100644 index 5da4b3e6..00000000 --- a/src/Microsoft.Build.Tasks.Tfvc/GetRepositoryUrl.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the License.txt file in the project root for more information. - -using System; -using System.IO; -using System.Linq; -using Microsoft.Build.Framework; -using Microsoft.Build.Tasks.SourceControl; -using Microsoft.TeamFoundation.Client; -using Microsoft.TeamFoundation.VersionControl.Client; - -namespace Microsoft.Build.Tasks.Tfvc -{ - public sealed class GetRepositoryUrl : RepositoryTask - { - [Output] - public string? Url { get; private set; } - - protected override bool Execute(WorkspaceInfo workspaceInfo) - { - using var collection = new TfsTeamProjectCollection(workspaceInfo.ServerUri); - - var workspace = workspaceInfo.GetWorkspace(collection); - - // Use the first project: - var project = workspace.GetTeamProjectForLocalPath(workspaceInfo.MappedPaths.First()); - - // Extract GUID from ArtifactUri "vstfs:///Classification/TeamProject/{Guid}": - var projectId = Path.GetFileName(project.ArtifactUri.GetPath()); - - Url = collection.Uri.ToString() + "/" + projectId; - - return true; - } - } -} diff --git a/src/Microsoft.Build.Tasks.Tfvc/GetSourceRevisionId.cs b/src/Microsoft.Build.Tasks.Tfvc/GetSourceRevisionId.cs deleted file mode 100644 index a31421a3..00000000 --- a/src/Microsoft.Build.Tasks.Tfvc/GetSourceRevisionId.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the License.txt file in the project root for more information. - -using Microsoft.Build.Framework; -using Microsoft.TeamFoundation.Client; -using Microsoft.TeamFoundation.VersionControl.Client; - -namespace Microsoft.Build.Tasks.Tfvc -{ - public sealed class GetSourceRevisionId : RepositoryTask - { - [Output] - public string? RevisionId { get; private set; } - - protected override bool Execute(WorkspaceInfo workspaceInfo) - { - using var collection = new TfsTeamProjectCollection(workspaceInfo.ServerUri); - - var vcServer = collection.GetService(); - RevisionId = vcServer.GetLatestChangesetId().ToString(); - - return true; - } - } -} diff --git a/src/Microsoft.Build.Tasks.Tfvc/GetSourceRoots.cs b/src/Microsoft.Build.Tasks.Tfvc/GetSourceRoots.cs deleted file mode 100644 index 6df2edff..00000000 --- a/src/Microsoft.Build.Tasks.Tfvc/GetSourceRoots.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the License.txt file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Build.Framework; -using Microsoft.Build.Tasks.SourceControl; -using Microsoft.Build.Utilities; -using Microsoft.TeamFoundation.Client; -using Microsoft.TeamFoundation.VersionControl.Client; - -namespace Microsoft.Build.Tasks.Tfvc -{ - public sealed class GetSourceRoots : RepositoryTask - { - /// - /// Returns items describing source roots: - /// - /// Metadata - /// SourceControl: "tfvc" - /// Identity: Directory. - /// CollectionUrl: Collection URL. - /// ProjectId: Project GUID. - /// RelativeUrl: Relative URL within the project. - /// RevisionId: Revision (changeset number). - /// - [Output] - public ITaskItem[]? Mapping { get; private set; } - - protected override bool Execute(WorkspaceInfo workspaceInfo) - { - var result = new List(); - - using var collection = new TfsTeamProjectCollection(workspaceInfo.ServerUri); - - var vcServer = collection.GetService(); - var changesetId = vcServer.GetLatestChangesetId().ToString(); - - var workspace = workspaceInfo.GetWorkspace(collection); - var collectionUrl = collection.Uri.ToString(); - - // TODO: eliminate redundant mappings - we can use RepositoryRoot calculation here - // E.g. A\B -> $/X/A/B, A\C -> $/X/A/C can be reduced to A -> $/X/A - - foreach (var folder in workspace.Folders) - { - if (!folder.IsCloaked) - { - var project = workspace.GetTeamProjectForLocalPath(folder.LocalItem); - - // Extract GUID from ArtifactUri "vstfs:///Classification/TeamProject/{Guid}": - var projectId = Path.GetFileName(project.ArtifactUri.GetPath()); - - // SourceLink.AzureRepos will map each source root to: - // {RepositoryUrl}/_versionControl?path={ServerPath}&version={RevisionId} - var item = new TaskItem(folder.LocalItem); - item.SetMetadata("SourceControl", "tfvc"); - item.SetMetadata("CollectionUrl", collectionUrl); - item.SetMetadata("ProjectId", projectId); - item.SetMetadata("ServerPath", folder.ServerItem); - item.SetMetadata("RevisionId", changesetId); - result.Add(item); - } - } - - Mapping = result.ToArray(); - return true; - } - } -} diff --git a/src/Microsoft.Build.Tasks.Tfvc/GetUntrackedSourceFiles.cs b/src/Microsoft.Build.Tasks.Tfvc/GetUntrackedSourceFiles.cs deleted file mode 100644 index d049007f..00000000 --- a/src/Microsoft.Build.Tasks.Tfvc/GetUntrackedSourceFiles.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the License.txt file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using Microsoft.Build.Framework; -using Microsoft.TeamFoundation.Client; -using Microsoft.TeamFoundation.Common; -using Microsoft.TeamFoundation.VersionControl.Client; - -namespace Microsoft.Build.Tasks.Tfvc -{ - public sealed class GetUntrackedSourceFiles : RepositoryTask - { - [Required, NotNull] - public ITaskItem[]? SourceFiles { get; set; } - - [Output] - public ITaskItem[]? UntrackedFiles { get; set; } - - protected override bool Execute(WorkspaceInfo workspaceInfo) - { - using var collection = new TfsTeamProjectCollection(workspaceInfo.ServerUri); - - var vcServer = collection.GetService(); - var workspace = vcServer.GetWorkspace(workspaceInfo); - var evaluator = new LocalItemExclusionEvaluator(workspace, startLocalItem: ""); // TODO? - - var result = new List(); - foreach (var item in SourceFiles) - { - if (FileSpec.IsSubItem(item.ItemSpec, evaluator.StartLocalItem) && - evaluator.IsExcluded(item.ItemSpec, isFolder: false)) - { - result.Add(item); - } - } - - UntrackedFiles = result.ToArray(); - - return true; - } - } -} diff --git a/src/Microsoft.Build.Tasks.Tfvc/LocateRepository.cs b/src/Microsoft.Build.Tasks.Tfvc/LocateRepository.cs deleted file mode 100644 index a7cc99ab..00000000 --- a/src/Microsoft.Build.Tasks.Tfvc/LocateRepository.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the License.txt file in the project root for more information. - -using System.Diagnostics.CodeAnalysis; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using Microsoft.TeamFoundation.VersionControl.Client; - -namespace Microsoft.Build.Tasks.Tfvc -{ - public class LocateRepository : Task - { - [Required, NotNull] - public string? Directory { get; set; } - - [Output] - public string? Id { get; set; } - -#if UNUSED - [Output] - public string Root { get; set; } - - private static int GetLongestCommonPrefix(string[] path1, int length1, string[] path2) - { - int length = Math.Min(length1, path2.Length); - for (int i = 0; i < length; i++) - { - if (!string.Equals(path1[i], path2[i], StringComparison.OrdinalIgnoreCase)) - { - return i; - } - } - - return length; - } -#endif - public override bool Execute() - { - var workspaceInfo = Workstation.Current.GetLocalWorkspaceInfo(Directory); - if (workspaceInfo == null || workspaceInfo.MappedPaths.Length == 0) - { - Log.LogError($"Unable to locate repository containing directory '{Directory}'."); - return false; - } - - var paths = workspaceInfo.MappedPaths; - - // any mapping works as an id: - Id = paths[0]; - -#if UNUSED - string NormalizeResult(string path) - => Path.GetFullPath(path).EndWithSeparator(); - - if (paths.Length == 1) - { - Root = NormalizeResult(paths[0]); - return true; - } - - var parts = PathUtilities.Split(Path.GetFullPath(paths[0])); - int prefixLength = parts.Length; - for (int i = 1; i < paths.Length; i++) - { - prefixLength = Math.Min(prefixLength, GetLongestCommonPrefix(parts, prefixLength, PathUtilities.Split(Path.GetFullPath(paths[i])))); - } - - if (prefixLength == 0) - { - Root = null; - } - else - { - Root = NormalizeResult(string.Join(Path.DirectorySeparatorChar.ToString(), parts, 0, prefixLength)); - } -#endif - return true; - } - } -} diff --git a/src/Microsoft.Build.Tasks.Tfvc/Microsoft.Build.Tasks.Tfvc.csproj b/src/Microsoft.Build.Tasks.Tfvc/Microsoft.Build.Tasks.Tfvc.csproj deleted file mode 100644 index 1c9cced0..00000000 --- a/src/Microsoft.Build.Tasks.Tfvc/Microsoft.Build.Tasks.Tfvc.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - $(NetFrameworkToolCurrent) - true - MSBuild tasks providing TFVC repository information. - MSBuild Tasks TFVC source link - true - - - - - - - - - - - diff --git a/src/Microsoft.Build.Tasks.Tfvc/RepositoryTask.cs b/src/Microsoft.Build.Tasks.Tfvc/RepositoryTask.cs deleted file mode 100644 index 3ad7e48a..00000000 --- a/src/Microsoft.Build.Tasks.Tfvc/RepositoryTask.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the License.txt file in the project root for more information. - -using System.Diagnostics.CodeAnalysis; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using Microsoft.TeamFoundation.VersionControl.Client; - -namespace Microsoft.Build.Tasks.Tfvc -{ - public abstract class RepositoryTask : Task - { - [Required, NotNull] - public string? WorkspaceDirectory { get; set; } - - protected abstract bool Execute(WorkspaceInfo workspaceInfo); - - public sealed override bool Execute() - { - var workspaceInfo = Workstation.Current.GetLocalWorkspaceInfo(WorkspaceDirectory); - if (workspaceInfo == null) - { - Log.LogError($"Invalid repository id: {WorkspaceDirectory}"); - return false; - } - - return Execute(workspaceInfo); - } - } -} diff --git a/src/Microsoft.Build.Tasks.Tfvc/build/Microsoft.Build.Tasks.Tfvc.props b/src/Microsoft.Build.Tasks.Tfvc/build/Microsoft.Build.Tasks.Tfvc.props deleted file mode 100644 index 31744df8..00000000 --- a/src/Microsoft.Build.Tasks.Tfvc/build/Microsoft.Build.Tasks.Tfvc.props +++ /dev/null @@ -1,6 +0,0 @@ - - - - $(MSBuildThisFileDirectory)..\tools\netframework\Microsoft.Build.Tasks.Tfvc.dll - - diff --git a/src/Microsoft.Build.Tasks.Tfvc/build/Microsoft.Build.Tasks.Tfvc.targets b/src/Microsoft.Build.Tasks.Tfvc/build/Microsoft.Build.Tasks.Tfvc.targets deleted file mode 100644 index cf21e8c7..00000000 --- a/src/Microsoft.Build.Tasks.Tfvc/build/Microsoft.Build.Tasks.Tfvc.targets +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - tfvc - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Microsoft.Build.Tasks.Tfvc/buildMultiTargeting/Microsoft.Build.Tasks.Tfvc.props b/src/Microsoft.Build.Tasks.Tfvc/buildMultiTargeting/Microsoft.Build.Tasks.Tfvc.props deleted file mode 100644 index 5458b763..00000000 --- a/src/Microsoft.Build.Tasks.Tfvc/buildMultiTargeting/Microsoft.Build.Tasks.Tfvc.props +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/Microsoft.Build.Tasks.Tfvc/buildMultiTargeting/Microsoft.Build.Tasks.Tfvc.targets b/src/Microsoft.Build.Tasks.Tfvc/buildMultiTargeting/Microsoft.Build.Tasks.Tfvc.targets deleted file mode 100644 index 9156c8b4..00000000 --- a/src/Microsoft.Build.Tasks.Tfvc/buildMultiTargeting/Microsoft.Build.Tasks.Tfvc.targets +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/Microsoft.Build.Tasks.Tfvc/buildTransitive/Microsoft.Build.Tasks.Tfvc.props b/src/Microsoft.Build.Tasks.Tfvc/buildTransitive/Microsoft.Build.Tasks.Tfvc.props deleted file mode 100644 index bdcdcbe9..00000000 --- a/src/Microsoft.Build.Tasks.Tfvc/buildTransitive/Microsoft.Build.Tasks.Tfvc.props +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/Microsoft.Build.Tasks.Tfvc/buildTransitive/Microsoft.Build.Tasks.Tfvc.targets b/src/Microsoft.Build.Tasks.Tfvc/buildTransitive/Microsoft.Build.Tasks.Tfvc.targets deleted file mode 100644 index 77e46e1b..00000000 --- a/src/Microsoft.Build.Tasks.Tfvc/buildTransitive/Microsoft.Build.Tasks.Tfvc.targets +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/SourceLink.AzureRepos.Tfvc/GetSourceLinkUrl.cs b/src/SourceLink.AzureRepos.Tfvc/GetSourceLinkUrl.cs deleted file mode 100644 index 92528bca..00000000 --- a/src/SourceLink.AzureRepos.Tfvc/GetSourceLinkUrl.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the License.txt file in the project root for more information. - -using System; -using System.Diagnostics.CodeAnalysis; -using System.IO; -using System.Linq; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace Microsoft.SourceLink.AzureRepos.Tfvc -{ - public sealed class GetSourceLinkUrl : Task - { - [Required, NotNull] - public ITaskItem? SourceRoot { get; set; } - - [Output] - public string? SourceLinkUrl { get; set; } - - public override bool Execute() - { - if (!string.IsNullOrEmpty(SourceRoot.GetMetadata("SourceLinkUrl")) || - !string.Equals(SourceRoot.GetMetadata("SourceControl"), "tfvc", StringComparison.OrdinalIgnoreCase)) - { - SourceLinkUrl = "N/A"; - return true; - } - - var collectionUrl = SourceRoot.GetMetadata("CollectionUrl"); - if (!Uri.TryCreate(collectionUrl, UriKind.Absolute, out var collectionUri)) - { - Log.LogError($"SourceRoot.CollectionUrl of '{SourceRoot.ItemSpec}' is invalid: '{collectionUrl}'"); - return false; - } - - // 'D' format: "effb7e66-f922-4dc9-a4dc-9bd5d3b01582" - var projectIdStr = SourceRoot.GetMetadata("ProjectId"); - if (!Guid.TryParseExact(projectIdStr, "D", out var projectId)) - { - Log.LogError($"SourceRoot.ProjectId of '{SourceRoot.ItemSpec}' is invalid: '{projectIdStr}'"); - return false; - } - - string revisionIdStr = SourceRoot.GetMetadata("RevisionId"); - if (revisionIdStr == null || !uint.TryParse(revisionIdStr, out var revisionId)) - { - Log.LogError($"SourceRoot.RevisionId of '{SourceRoot.ItemSpec}' is not a valid changeset number: '{revisionIdStr}'"); - return false; - } - - string serverPath = SourceRoot.GetMetadata("ServerPath"); - if (serverPath == null || !serverPath.StartsWith("$", StringComparison.Ordinal)) - { - Log.LogError($"SourceRoot.ServerPath of '{SourceRoot.ItemSpec}' is not a valid server path: '{revisionIdStr}'"); - return false; - } - - var escapedServerPath = string.Join("/", serverPath.Split('/').Select(Uri.EscapeDataString)); - - SourceLinkUrl = new Uri(collectionUri, projectId.ToString("D")).ToString() + - "/_versionControl?version=" + revisionId + "&path="+ escapedServerPath + "/*"; - - return true; - } - } -} diff --git a/src/SourceLink.AzureRepos.Tfvc/Microsoft.SourceLink.AzureRepos.Tfvc.csproj b/src/SourceLink.AzureRepos.Tfvc/Microsoft.SourceLink.AzureRepos.Tfvc.csproj deleted file mode 100644 index 7099c61a..00000000 --- a/src/SourceLink.AzureRepos.Tfvc/Microsoft.SourceLink.AzureRepos.Tfvc.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - $(NetFrameworkToolCurrent) - true - Generates source link for Azure Repos (formerly known as VSTS) TFVC repositories. - MSBuild Tasks Azure DevOps Repos VSTS TFVC source link - true - - - - - - - - - - - - - - diff --git a/src/SourceLink.AzureRepos.Tfvc/build/Microsoft.SourceLink.AzureRepos.Tfvc.targets b/src/SourceLink.AzureRepos.Tfvc/build/Microsoft.SourceLink.AzureRepos.Tfvc.targets deleted file mode 100644 index ee740fba..00000000 --- a/src/SourceLink.AzureRepos.Tfvc/build/Microsoft.SourceLink.AzureRepos.Tfvc.targets +++ /dev/null @@ -1,24 +0,0 @@ - - - - <_SourceLinkAzureReposTfvcAssemblyFile>$(MSBuildThisFileDirectory)..\tools\netframework\Microsoft.SourceLink.AzureRepos.Tfvc.dll - - - - - - $(SourceLinkUrlInitializerTargets);_InitializeAzureReposTfvcSourceLinkUrl - - - - - - - - - - - - - - diff --git a/src/SourceLink.AzureRepos.Tfvc/buildMultiTargeting/Microsoft.SourceLink.AzureRepos.Tfvc.targets b/src/SourceLink.AzureRepos.Tfvc/buildMultiTargeting/Microsoft.SourceLink.AzureRepos.Tfvc.targets deleted file mode 100644 index 9156c8b4..00000000 --- a/src/SourceLink.AzureRepos.Tfvc/buildMultiTargeting/Microsoft.SourceLink.AzureRepos.Tfvc.targets +++ /dev/null @@ -1,4 +0,0 @@ - - - - From a1b5d059d3cec9ac88110c5c09e02e2eac93499b Mon Sep 17 00:00:00 2001 From: Tomas Matousek Date: Sun, 19 Oct 2025 13:12:01 -0700 Subject: [PATCH 2/2] Cleanup --- src/Directory.Packages.props | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index c5a6c879..a1ab4835 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -28,7 +28,6 @@ -