aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-08-15 14:41:23 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-08-15 14:41:23 -0700
commitf4d11d7c9ea98007af88684db12de351b83bd976 (patch)
tree6bee2241388aaf0e0d191fe30317de16a321c09f /scripts
parent3e0a1ddf7eb8273d8a0df8001569e7c1b2857d71 (diff)
downloadvcpkg-f4d11d7c9ea98007af88684db12de351b83bd976.tar.gz
vcpkg-f4d11d7c9ea98007af88684db12de351b83bd976.zip
Remove download prompts for cmake/git
The prompts were causing a lot of issues for users and especially CI builds
Diffstat (limited to 'scripts')
-rw-r--r--scripts/fetchDependency.ps153
-rw-r--r--scripts/findVisualStudioInstallationInstances.ps12
-rw-r--r--scripts/internalCI.ps11
3 files changed, 4 insertions, 52 deletions
diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1
index d142f57fe..5eb0cc0db 100644
--- a/scripts/fetchDependency.ps1
+++ b/scripts/fetchDependency.ps1
@@ -1,14 +1,8 @@
[CmdletBinding()]
param(
- [string]$Dependency,
- [ValidateNotNullOrEmpty()]
- [string]$downloadPromptOverride = "0"
+ [string]$Dependency
)
-$downloadPromptOverride_NO_OVERRIDE= 0
-$downloadPromptOverride_DO_NOT_PROMPT = 1
-$downloadPromptOverride_ALWAYS_PROMPT = 2
-
if ($PSVersionTable.PSEdition -ne "Core") {
Import-Module BitsTransfer -Verbose:$false
}
@@ -22,38 +16,6 @@ $downloadsDir = "$vcpkgRootDir\downloads"
function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency)
{
- function promptForDownload([string]$title, [string]$message, [string]$yesDescription, [string]$noDescription, [string]$downloadPromptOverride)
- {
- $do_not_prompt = ($downloadPromptOverride -eq $downloadPromptOverride_DO_NOT_PROMPT) -Or
- (Test-Path "$downloadsDir\AlwaysAllowEverything") -Or
- (Test-Path "$downloadsDir\AlwaysAllowDownloads")
-
- if (($downloadPromptOverride -ne $downloadPromptOverride_ALWAYS_PROMPT) -And $do_not_prompt)
- {
- return $true
- }
-
- $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", $yesDescription
- $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", $noDescription
- $AlwaysAllowDownloads = New-Object System.Management.Automation.Host.ChoiceDescription "&Always Allow Downloads", ($yesDescription + "(Future download prompts will not be displayed)")
-
- $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no, $AlwaysAllowDownloads)
- $result = $host.ui.PromptForChoice($title, $message, $options, 0)
-
- switch ($result)
- {
- 0 {return $true}
- 1 {return $false}
- 2 {
- New-Item "$downloadsDir\AlwaysAllowDownloads" -type file -force | Out-Null
- return $true
- }
- }
-
- throw "Unexpected result"
- }
-
-
function performDownload( [Parameter(Mandatory=$true)][string]$Dependency,
[Parameter(Mandatory=$true)][string]$url,
[Parameter(Mandatory=$true)][string]$downloadDir,
@@ -66,16 +28,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency)
return
}
- $title = "Download " + $Dependency
- $message = ("No suitable version of " + $Dependency + " was found (requires $requiredVersion or higher). Download portable version?")
- $yesDescription = "Downloads " + $Dependency + " v" + $downloadVersion +" app-locally."
- $noDescription = "Does not download " + $Dependency + "."
-
- $userAllowedDownload = promptForDownload $title $message $yesDescription $noDescription $downloadPromptOverride
- if (!$userAllowedDownload)
- {
- throw [System.IO.FileNotFoundException] ("Could not detect suitable version of " + $Dependency + " and download not allowed")
- }
+ Write-Host "A suitable version of $Dependency was not found (required v$requiredVersion). Downloading portable $Dependency v$downloadVersion..."
if (!(Test-Path $downloadDir))
{
@@ -202,7 +155,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency)
$hashAlgorithm = [Security.Cryptography.HashAlgorithm]::Create("SHA256")
$fileAsByteArray = [io.File]::ReadAllBytes($downloadPath)
$hashByteArray = $hashAlgorithm.ComputeHash($fileAsByteArray)
- $downloadedFileHash = -Join ($hashByteArray | ForEach {"{0:x2}" -f $_})
+ $downloadedFileHash = -Join ($hashByteArray | ForEach-Object {"{0:x2}" -f $_})
}
else
{
diff --git a/scripts/findVisualStudioInstallationInstances.ps1 b/scripts/findVisualStudioInstallationInstances.ps1
index 14bfc244b..ca807980c 100644
--- a/scripts/findVisualStudioInstallationInstances.ps1
+++ b/scripts/findVisualStudioInstallationInstances.ps1
@@ -8,7 +8,7 @@ $vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root
$downloadsDir = "$vcpkgRootDir\downloads"
-$nugetexe = & $scriptsDir\fetchDependency.ps1 "nuget" 1
+$nugetexe = & $scriptsDir\fetchDependency.ps1 "nuget"
$nugetPackageDir = "$downloadsDir\nuget-packages"
$SetupAPIVersion = "1.8.24"
diff --git a/scripts/internalCI.ps1 b/scripts/internalCI.ps1
index 68c917f7a..67871acc1 100644
--- a/scripts/internalCI.ps1
+++ b/scripts/internalCI.ps1
@@ -1,7 +1,6 @@
$ErrorActionPreference = "Stop"
New-Item -type directory downloads -errorAction SilentlyContinue | Out-Null
-New-Item -type file downloads\AlwaysAllowDownloads -errorAction SilentlyContinue | Out-Null
./scripts/bootstrap.ps1
if (-not $?) { throw $? }