From 95d0fef5f57eec5b43514e88d4b83c3aee309f2c Mon Sep 17 00:00:00 2001
From: William Godbe <wigodbe@microsoft.com>
Date: Tue, 15 Mar 2022 15:28:17 -0700
Subject: [PATCH] Remove install-tar & mentions from repo (#40720)

---
 .azure/pipelines/jobs/default-build.yml |  2 -
 docs/BuildFromSource.md                 |  4 --
 eng/scripts/InstallTar.ps1              | 74 -------------------------
 3 files changed, 80 deletions(-)
 delete mode 100644 eng/scripts/InstallTar.ps1

diff --git a/.azure/pipelines/jobs/default-build.yml b/.azure/pipelines/jobs/default-build.yml
index 2e11e722e1e..f5789139792 100644
--- a/.azure/pipelines/jobs/default-build.yml
+++ b/.azure/pipelines/jobs/default-build.yml
@@ -188,8 +188,6 @@ jobs:
             ./eng/scripts/InstallGoogleChrome.ps1
           displayName: Install Chrome
     - ${{ if eq(parameters.agentOs, 'Windows') }}:
-      - powershell: ./eng/scripts/InstallTar.ps1
-        displayName: Find or install Tar
       - powershell: Write-Host "##vso[task.prependpath]$(DOTNET_CLI_HOME)\.dotnet\tools"
         displayName: Add dotnet tools to path
     - ${{ if ne(parameters.agentOs, 'Windows') }}:
diff --git a/docs/BuildFromSource.md b/docs/BuildFromSource.md
index ab5b5330be7..6d98a73a275 100644
--- a/docs/BuildFromSource.md
+++ b/docs/BuildFromSource.md
@@ -109,10 +109,6 @@ NodeJS installs the Node package manager (npm) by default. This repo depends on
 npm install -g yarn
 ```
 
-#### [tar](http://gnuwin32.sourceforge.net/packages/gtar.htm) on Windows
-
-Building the repo requires tar to be installed. First, check whether `tar.exe` is already in your path i.e. execute `tar -help` (Win10 comes with tar already installed). Then, assuming you have `git` installed, you might add `C:\Program Files\Git\usr\bin\` to your path to pick up the `tar.exe` that ships with `git`. Finally, you can find installation executables of tar at <http://gnuwin32.sourceforge.net/packages/gtar.htm>; download that and add the installation directory to your PATH variable.
-
 #### Java Development Kit on Windows
 
 This repo contains some Java source code that depends on an install of the JDK v11 or newer. The JDK can be installed from either:
diff --git a/eng/scripts/InstallTar.ps1 b/eng/scripts/InstallTar.ps1
deleted file mode 100644
index 12159a8d0be..00000000000
--- a/eng/scripts/InstallTar.ps1
+++ /dev/null
@@ -1,74 +0,0 @@
-<#
-.SYNOPSIS
-    Finds or installs the Tar command on this system.
-.DESCRIPTION
-    This script searches for Tar on this system. If not found, downloads and extracts Git to use its tar.exe. Prefers
-    global installation locations even if Git has been downloaded into this repo.
-.PARAMETER GitVersion
-    The version of the Git to install. If not set, the default value is read from global.json.
-.PARAMETER Force
-    Overwrite the existing installation if one exists in this repo and Tar isn't installed globally.
-#>
-param(
-    [string]$GitVersion,
-    [switch]$Force
-)
-
-$ErrorActionPreference = 'Stop'
-$ProgressPreference = 'SilentlyContinue' # Workaround PowerShell/PowerShell#2138
-
-Set-StrictMode -Version 1
-
-# Find tar. If not found, install Git to get it.
-$repoRoot = (Join-Path $PSScriptRoot "..\.." -Resolve)
-$installDir = "$repoRoot\.tools\Git\win-x64"
-$tarCommand = "$installDir\usr\bin\tar.exe"
-$finalCommand = "$repoRoot\.tools\tar.exe"
-
-Write-Host "Windows version and other information..."
-cmd.exe /c ver
-systeminfo.exe
-Write-Host "Processor Architecture: $env:PROCESSOR_ARCHITECTURE"
-
-Write-Host "Checking $env:SystemRoot\System32\tar.exe"
-Get-ChildItem "$env:SystemRoot\System32\ta*.exe"
-if (Test-Path "$env:SystemRoot\System32\tar.exe") {
-    Write-Host "Found $env:SystemRoot\System32\tar.exe"
-    $tarCommand = "$env:SystemRoot\System32\tar.exe"
-}
-elseif (Test-Path "$env:ProgramFiles\Git\usr\bin\tar.exe") {
-    $tarCommand = "$env:ProgramFiles\Git\usr\bin\tar.exe"
-}
-elseif (Test-Path "${env:ProgramFiles(x86)}\Git\usr\bin\tar.exe") {
-    $tarCommand = "${env:ProgramFiles(x86)}\Git\usr\bin\tar.exe"
-}
-elseif (Test-Path "$env:AGENT_HOMEDIRECTORY\externals\git\usr\bin\tar.exe") {
-    $tarCommand = "$env:AGENT_HOMEDIRECTORY\externals\git\usr\bin\tar.exe"
-}
-elseif ((Test-Path $tarCommand) -And (-Not $Force)) {
-    Write-Verbose "Repo-local Git installation and $tarCommand already exist, skipping Git install."
-}
-else {
-    if (-not $GitVersion) {
-        $globalJson = Get-Content "$repoRoot\global.json" | ConvertFrom-Json
-        $GitVersion = $globalJson.tools.Git
-    }
-
-    $Uri = "https://netcorenativeassets.blob.core.windows.net/resource-packages/external/windows/git/Git-${GitVersion}-64-bit.zip"
-
-    Import-Module -Name (Join-Path $PSScriptRoot "..\common\native\CommonLibrary.psm1" -Resolve)
-    $InstallStatus = CommonLibrary\DownloadAndExtract -Uri $Uri -InstallDirectory "$installDir\" -Force:$Force -Verbose
-
-    if ($InstallStatus -Eq $False) {
-        Write-Error "Installation failed"
-        exit 1
-    }
-}
-
-New-Item "$repoRoot\.tools\" -ErrorAction SilentlyContinue -ItemType Directory
-Copy-Item "$tarCommand" "$finalCommand" -Verbose
-Write-Host "Tar now available at '$finalCommand'"
-
-if ($tarCommand -like '*\Git\*') {
-    $null >.\.tools\tar.fromGit
-}
-- 
GitLab