2016-09-18 20:50:08 -07:00
|
|
|
[CmdletBinding()]
|
|
|
|
param(
|
|
|
|
[ValidateNotNullOrEmpty()]
|
|
|
|
[string]$disableMetrics = "0"
|
|
|
|
)
|
|
|
|
|
2016-09-19 18:46:02 -07:00
|
|
|
$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
|
|
|
|
$vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root
|
2017-08-25 23:20:57 -07:00
|
|
|
Write-Verbose("vcpkg Path " + $vcpkgRootDir)
|
|
|
|
|
|
|
|
$env:path += ";$vcpkgRootDir\downloads\MinGit-2.14.1-32-bit\cmd"
|
2016-09-18 20:50:08 -07:00
|
|
|
|
2016-11-21 18:10:21 -08:00
|
|
|
$gitHash = "unknownhash"
|
2017-03-20 16:58:08 -07:00
|
|
|
if (Get-Command "git" -ErrorAction SilentlyContinue)
|
2016-11-21 18:10:21 -08:00
|
|
|
{
|
2017-08-25 23:20:57 -07:00
|
|
|
$gitHash = git log HEAD -n 1 --format="%cd-%H" --date=short
|
|
|
|
if ($LASTEXITCODE -ne 0)
|
|
|
|
{
|
|
|
|
$gitHash = "unknownhash"
|
|
|
|
}
|
2016-11-21 18:10:21 -08:00
|
|
|
}
|
2017-08-25 23:20:57 -07:00
|
|
|
Write-Verbose("Git repo version string is " + $gitHash)
|
2016-09-19 18:46:02 -07:00
|
|
|
$vcpkgSourcesPath = "$vcpkgRootDir\toolsrc"
|
2016-09-18 20:50:08 -07:00
|
|
|
|
|
|
|
if (!(Test-Path $vcpkgSourcesPath))
|
|
|
|
{
|
|
|
|
New-Item -ItemType directory -Path $vcpkgSourcesPath -force | Out-Null
|
|
|
|
}
|
|
|
|
|
|
|
|
try{
|
|
|
|
pushd $vcpkgSourcesPath
|
2017-01-23 12:54:33 -08:00
|
|
|
$msbuildExeWithPlatformToolset = & $scriptsDir\findAnyMSBuildWithCppPlatformToolset.ps1
|
|
|
|
$msbuildExe = $msbuildExeWithPlatformToolset[0]
|
|
|
|
$platformToolset = $msbuildExeWithPlatformToolset[1]
|
2017-02-21 17:42:39 -08:00
|
|
|
$windowsSDK = & $scriptsDir\getWindowsSDK.ps1
|
|
|
|
& $msbuildExe "/p:VCPKG_VERSION=-$gitHash" "/p:DISABLE_METRICS=$disableMetrics" /p:Configuration=Release /p:Platform=x86 /p:PlatformToolset=$platformToolset /p:TargetPlatformVersion=$windowsSDK /m dirs.proj
|
2016-09-18 20:50:08 -07:00
|
|
|
|
|
|
|
Write-Verbose("Placing vcpkg.exe in the correct location")
|
|
|
|
|
2016-09-19 18:46:02 -07:00
|
|
|
Copy-Item $vcpkgSourcesPath\Release\vcpkg.exe $vcpkgRootDir\vcpkg.exe | Out-Null
|
|
|
|
Copy-Item $vcpkgSourcesPath\Release\vcpkgmetricsuploader.exe $vcpkgRootDir\scripts\vcpkgmetricsuploader.exe | Out-Null
|
2016-09-18 20:50:08 -07:00
|
|
|
}
|
|
|
|
finally{
|
|
|
|
popd
|
|
|
|
}
|