aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlexander Karatarakis <alex@karatarakis.com>2017-09-21 12:22:00 -0700
committerGitHub <noreply@github.com>2017-09-21 12:22:00 -0700
commitfac96eb344a500405ab65b7e7f3755af0ad00b7e (patch)
treef9e3376ca1a8f2de408e087e42ae393f224d6c42 /scripts
parent46db0f03fcb42d9f738474885fda372160362e44 (diff)
parent1bbce1ee844262647f994afd5f31da12d938e7ee (diff)
downloadvcpkg-fac96eb344a500405ab65b7e7f3755af0ad00b7e.tar.gz
vcpkg-fac96eb344a500405ab65b7e7f3755af0ad00b7e.zip
Merge branch 'master' into master
Diffstat (limited to 'scripts')
-rw-r--r--scripts/bootstrap.ps128
-rw-r--r--scripts/buildsystems/msbuild/vcpkg.targets12
-rw-r--r--scripts/cmake/vcpkg_acquire_msys.cmake4
-rw-r--r--scripts/cmake/vcpkg_common_functions.cmake1
-rw-r--r--scripts/cmake/vcpkg_configure_cmake.cmake16
-rw-r--r--scripts/cmake/vcpkg_configure_meson.cmake16
-rw-r--r--scripts/cmake/vcpkg_find_acquire_program.cmake6
-rw-r--r--scripts/cmake/vcpkg_from_bitbucket.cmake190
-rw-r--r--scripts/fetchDependency.ps180
-rw-r--r--scripts/findVisualStudioInstallationInstances.ps12
-rw-r--r--scripts/internalCI.ps11
11 files changed, 258 insertions, 98 deletions
diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1
index b7bc5afab..b874afd8c 100644
--- a/scripts/bootstrap.ps1
+++ b/scripts/bootstrap.ps1
@@ -6,22 +6,37 @@ param(
$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
$vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root
+Write-Verbose("vcpkg Path " + $vcpkgRootDir)
+
$gitHash = "unknownhash"
-if (Get-Command "git" -ErrorAction SilentlyContinue)
+$oldpath = $env:path
+try
+{
+ $env:path += ";$vcpkgRootDir\downloads\MinGit-2.14.1-32-bit\cmd"
+ if (Get-Command "git" -ErrorAction SilentlyContinue)
+ {
+ $gitHash = git log HEAD -n 1 --format="%cd-%H" --date=short
+ if ($LASTEXITCODE -ne 0)
+ {
+ $gitHash = "unknownhash"
+ }
+ }
+}
+finally
{
- $gitHash = git rev-parse HEAD
+ $env:path = $oldpath
}
-Write-Verbose("Git hash is " + $gitHash)
+Write-Verbose("Git repo version string is " + $gitHash)
$vcpkgSourcesPath = "$vcpkgRootDir\toolsrc"
-Write-Verbose("vcpkg Path " + $vcpkgSourcesPath)
if (!(Test-Path $vcpkgSourcesPath))
{
New-Item -ItemType directory -Path $vcpkgSourcesPath -force | Out-Null
}
-try{
+try
+{
pushd $vcpkgSourcesPath
$msbuildExeWithPlatformToolset = & $scriptsDir\findAnyMSBuildWithCppPlatformToolset.ps1
$msbuildExe = $msbuildExeWithPlatformToolset[0]
@@ -34,6 +49,7 @@ try{
Copy-Item $vcpkgSourcesPath\Release\vcpkg.exe $vcpkgRootDir\vcpkg.exe | Out-Null
Copy-Item $vcpkgSourcesPath\Release\vcpkgmetricsuploader.exe $vcpkgRootDir\scripts\vcpkgmetricsuploader.exe | Out-Null
}
-finally{
+finally
+{
popd
}
diff --git a/scripts/buildsystems/msbuild/vcpkg.targets b/scripts/buildsystems/msbuild/vcpkg.targets
index 5c24d755a..1cb338237 100644
--- a/scripts/buildsystems/msbuild/vcpkg.targets
+++ b/scripts/buildsystems/msbuild/vcpkg.targets
@@ -41,10 +41,10 @@
<ItemDefinitionGroup Condition="'$(VcpkgEnabled)' == 'true'">
<Link>
- <AdditionalDependencies Condition="'$(VcpkgConfiguration)' == 'Debug' and '$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(VcpkgRoot)debug\lib\*.lib</AdditionalDependencies>
- <AdditionalDependencies Condition="'$(VcpkgConfiguration)' == 'Release' and '$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(VcpkgRoot)lib\*.lib</AdditionalDependencies>
- <AdditionalLibraryDirectories Condition="'$(VcpkgConfiguration)' == 'Release'">%(AdditionalLibraryDirectories);$(VcpkgRoot)lib;$(VcpkgRoot)lib\manual-link</AdditionalLibraryDirectories>
- <AdditionalLibraryDirectories Condition="'$(VcpkgConfiguration)' == 'Debug'">%(AdditionalLibraryDirectories);$(VcpkgRoot)debug\lib;$(VcpkgRoot)debug\lib\manual-link</AdditionalLibraryDirectories>
+ <AdditionalDependencies Condition="$(VcpkgConfiguration.StartsWith('Debug')) and '$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(VcpkgRoot)debug\lib\*.lib</AdditionalDependencies>
+ <AdditionalDependencies Condition="$(VcpkgConfiguration.StartsWith('Release')) and '$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(VcpkgRoot)lib\*.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories Condition="$(VcpkgConfiguration.StartsWith('Release'))">%(AdditionalLibraryDirectories);$(VcpkgRoot)lib;$(VcpkgRoot)lib\manual-link</AdditionalLibraryDirectories>
+ <AdditionalLibraryDirectories Condition="$(VcpkgConfiguration.StartsWith('Debug'))">%(AdditionalLibraryDirectories);$(VcpkgRoot)debug\lib;$(VcpkgRoot)debug\lib\manual-link</AdditionalLibraryDirectories>
</Link>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(VcpkgRoot)include</AdditionalIncludeDirectories>
@@ -63,11 +63,11 @@
<WriteLinesToFile
File="$(TLogLocation)$(ProjectName).write.1u.tlog"
Lines="^$(TargetPath);$([System.IO.Path]::Combine($(ProjectDir),$(IntDir)))vcpkg.applocal.log" Encoding="Unicode"/>
- <Exec Condition="'$(VcpkgConfiguration)' == 'Debug'"
+ <Exec Condition="$(VcpkgConfiguration.StartsWith('Debug'))"
Command="powershell.exe -ExecutionPolicy Bypass -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(TargetPath)%22 %22$(VcpkgRoot)debug\bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22 %22$(IntDir)vcpkg.applocal.log%22"
StandardOutputImportance="Normal">
</Exec>
- <Exec Condition="'$(VcpkgConfiguration)' == 'Release'"
+ <Exec Condition="$(VcpkgConfiguration.StartsWith('Release'))"
Command="powershell.exe -ExecutionPolicy Bypass -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(TargetPath)%22 %22$(VcpkgRoot)bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22 %22$(IntDir)vcpkg.applocal.log%22"
StandardOutputImportance="Normal">
</Exec>
diff --git a/scripts/cmake/vcpkg_acquire_msys.cmake b/scripts/cmake/vcpkg_acquire_msys.cmake
index 87c34c274..830022906 100644
--- a/scripts/cmake/vcpkg_acquire_msys.cmake
+++ b/scripts/cmake/vcpkg_acquire_msys.cmake
@@ -58,13 +58,13 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT)
set(URL "https://sourceforge.net/projects/msys2/files/Base/x86_64/msys2-base-x86_64-20161025.tar.xz/download")
set(ARCHIVE "msys2-base-x86_64-20161025.tar.xz")
set(HASH 6c4c18ec59db80b8269698d074866438a624f1ce735ee5005a01b148b02e8f2e966ae381aa1cb4c50f6226c3b7feb271e36907cf26580df084d695b3c9f5c0eb)
- set(STAMP "initialized-msys2.stamp")
+ set(STAMP "initialized-msys2_64.stamp")
else()
set(TOOLSUBPATH msys32)
set(URL "https://sourceforge.net/projects/msys2/files/Base/i686/msys2-base-i686-20161025.tar.xz/download")
set(ARCHIVE "msys2-base-i686-20161025.tar.xz")
set(HASH c9260a38e0c6bf963adeaea098c4e376449c1dd0afe07480741d6583a1ac4c138951ccb0c5388bd148e04255a5c1a23bf5ee2d58dcd6607c14f1eaa5639a7c85)
- set(STAMP "initialized-msys2_x64.stamp")
+ set(STAMP "initialized-msys2_32.stamp")
endif()
set(PATH_TO_ROOT ${TOOLPATH}/${TOOLSUBPATH})
diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake
index 29f0f8dff..81e8e5813 100644
--- a/scripts/cmake/vcpkg_common_functions.cmake
+++ b/scripts/cmake/vcpkg_common_functions.cmake
@@ -6,6 +6,7 @@ include(vcpkg_execute_required_process_repeat)
include(vcpkg_find_acquire_program)
include(vcpkg_fixup_cmake_targets)
include(vcpkg_from_github)
+include(vcpkg_from_bitbucket)
include(vcpkg_build_cmake)
include(vcpkg_build_msbuild)
include(vcpkg_build_qmake)
diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake
index 07acfc8ea..fecea8f1c 100644
--- a/scripts/cmake/vcpkg_configure_cmake.cmake
+++ b/scripts/cmake/vcpkg_configure_cmake.cmake
@@ -141,22 +141,22 @@ function(vcpkg_configure_cmake)
if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL dynamic)
list(APPEND _csc_OPTIONS_DEBUG
- "-DCMAKE_CXX_FLAGS_DEBUG=/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}"
- "-DCMAKE_C_FLAGS_DEBUG=/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}"
+ "-DCMAKE_CXX_FLAGS_DEBUG=/D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}"
+ "-DCMAKE_C_FLAGS_DEBUG=/D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}"
)
list(APPEND _csc_OPTIONS_RELEASE
- "-DCMAKE_CXX_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Zi ${VCPKG_CXX_FLAGS_RELEASE}"
- "-DCMAKE_C_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Zi ${VCPKG_C_FLAGS_RELEASE}"
+ "-DCMAKE_CXX_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_CXX_FLAGS_RELEASE}"
+ "-DCMAKE_C_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_C_FLAGS_RELEASE}"
)
elseif(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL static)
list(APPEND _csc_OPTIONS_DEBUG
- "-DCMAKE_CXX_FLAGS_DEBUG=/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}"
- "-DCMAKE_C_FLAGS_DEBUG=/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}"
+ "-DCMAKE_CXX_FLAGS_DEBUG=/D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}"
+ "-DCMAKE_C_FLAGS_DEBUG=/D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}"
)
list(APPEND _csc_OPTIONS_RELEASE
- "-DCMAKE_CXX_FLAGS_RELEASE=/MT /O2 /Oi /Gy /DNDEBUG /Zi ${VCPKG_CXX_FLAGS_RELEASE}"
- "-DCMAKE_C_FLAGS_RELEASE=/MT /O2 /Oi /Gy /DNDEBUG /Zi ${VCPKG_C_FLAGS_RELEASE}"
+ "-DCMAKE_CXX_FLAGS_RELEASE=/MT /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_CXX_FLAGS_RELEASE}"
+ "-DCMAKE_C_FLAGS_RELEASE=/MT /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_C_FLAGS_RELEASE}"
)
endif()
diff --git a/scripts/cmake/vcpkg_configure_meson.cmake b/scripts/cmake/vcpkg_configure_meson.cmake
index 277f91e11..143bb74de 100644
--- a/scripts/cmake/vcpkg_configure_meson.cmake
+++ b/scripts/cmake/vcpkg_configure_meson.cmake
@@ -9,17 +9,17 @@ function(vcpkg_configure_meson)
set(MESON_COMMON_CXXFLAGS "${MESON_COMMON_CXXFLAGS} /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc")
if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL dynamic)
- set(MESON_DEBUG_CFLAGS "${MESON_DEBUG_CFLAGS} /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1")
- set(MESON_DEBUG_CXXFLAGS "${MESON_DEBUG_CXXFLAGS} /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1")
+ set(MESON_DEBUG_CFLAGS "${MESON_DEBUG_CFLAGS} /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1")
+ set(MESON_DEBUG_CXXFLAGS "${MESON_DEBUG_CXXFLAGS} /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1")
- set(MESON_RELEASE_CFLAGS "${MESON_RELEASE_CFLAGS} /MD /O2 /Oi /Gy /DNDEBUG /Zi")
- set(MESON_RELEASE_CXXFLAGS "${MESON_RELEASE_CXXFLAGS} /MD /O2 /Oi /Gy /DNDEBUG /Zi")
+ set(MESON_RELEASE_CFLAGS "${MESON_RELEASE_CFLAGS} /MD /O2 /Oi /Gy /DNDEBUG /Z7")
+ set(MESON_RELEASE_CXXFLAGS "${MESON_RELEASE_CXXFLAGS} /MD /O2 /Oi /Gy /DNDEBUG /Z7")
elseif(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL static)
- set(MESON_DEBUG_CFLAGS "${MESON_DEBUG_CFLAGS} /D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
- set(MESON_DEBUG_CXXFLAGS "${MESON_DEBUG_CXXFLAGS} /D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
+ set(MESON_DEBUG_CFLAGS "${MESON_DEBUG_CFLAGS} /D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1")
+ set(MESON_DEBUG_CXXFLAGS "${MESON_DEBUG_CXXFLAGS} /D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1")
- set(MESON_RELEASE_CFLAGS "${MESON_RELEASE_CFLAGS} /MT /O2 /Oi /Gy /DNDEBUG /Zi")
- set(MESON_RELEASE_CXXFLAGS "${MESON_RELEASE_CXXFLAGS} /MT /O2 /Oi /Gy /DNDEBUG /Zi")
+ set(MESON_RELEASE_CFLAGS "${MESON_RELEASE_CFLAGS} /MT /O2 /Oi /Gy /DNDEBUG /Z7")
+ set(MESON_RELEASE_CXXFLAGS "${MESON_RELEASE_CXXFLAGS} /MT /O2 /Oi /Gy /DNDEBUG /Z7")
endif()
set(MESON_COMMON_LDFLAGS "${MESON_COMMON_LDFLAGS} /DEBUG")
diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake
index fef62da53..e718fc7da 100644
--- a/scripts/cmake/vcpkg_find_acquire_program.cmake
+++ b/scripts/cmake/vcpkg_find_acquire_program.cmake
@@ -67,9 +67,9 @@ function(vcpkg_find_acquire_program VAR)
elseif(VAR MATCHES "PYTHON3")
set(PROGNAME python)
set(PATHS ${DOWNLOADS}/tools/python)
- set(URL "https://www.python.org/ftp/python/3.5.3/python-3.5.3-embed-win32.zip")
- set(ARCHIVE "python-3.5.3-embed-win32.zip")
- set(HASH c8cfdc09d052dc27e4380e8e4bf0d32a4c0def7e03896c1fa6cabc26dde78bb74dbb04e3673cc36e3e307d65a1ef284d69174f0cc80008c83bc6178f192ac5cf)
+ set(URL "https://www.python.org/ftp/python/3.5.4/python-3.5.4-embed-win32.zip")
+ set(ARCHIVE "python-3.5.4-embed-win32.zip")
+ set(HASH b5240fdc95088c2d7f65d2dd598650f8dd106b49589d94156bd4a078b108c6cabbe7a38ef73e2b2cf00e8312a93d2e587eac2c54ce85540d3c7a26cc60013156)
elseif(VAR MATCHES "PYTHON2")
find_program(PYTHON2 NAMES python2 python PATHS C:/python27 c:/Python27amd64 ENV PYTHON)
if(NOT PYTHON2 MATCHES "NOTFOUND")
diff --git a/scripts/cmake/vcpkg_from_bitbucket.cmake b/scripts/cmake/vcpkg_from_bitbucket.cmake
new file mode 100644
index 000000000..227de5141
--- /dev/null
+++ b/scripts/cmake/vcpkg_from_bitbucket.cmake
@@ -0,0 +1,190 @@
+## # vcpkg_from_bitbucket
+##
+## Download and extract a project from Bitbucket.
+## Enables support for installing HEAD `vcpkg.exe install --head <port>`.
+##
+## ## Usage:
+## ```cmake
+## vcpkg_from_bitbucket(
+## OUT_SOURCE_PATH <SOURCE_PATH>
+## REPO <Microsoft/cpprestsdk>
+## [REF <v2.0.0>]
+## [SHA512 <45d0d7f8cc350...>]
+## [HEAD_REF <master>]
+## )
+## ```
+##
+## ## Parameters:
+## ### OUT_SOURCE_PATH
+## Specifies the out-variable that will contain the extracted location.
+##
+## This should be set to `SOURCE_PATH` by convention.
+##
+## ### REPO
+## The organization or user and repository on GitHub.
+##
+## ### REF
+## A stable git commit-ish (ideally a tag) that will not change contents. **This should not be a branch.**
+##
+## For repositories without official releases, this can be set to the full commit id of the current latest master.
+##
+## If `REF` is specified, `SHA512` must also be specified.
+##
+## ### SHA512
+## The SHA512 hash that should match the archive (https://bitbucket.com/${REPO}/get/${REF}.tar.gz).
+##
+## This is most easily determined by first setting it to `1`, then trying to build the port. The error message will contain the full hash, which can be copied back into the portfile.
+##
+## ### HEAD_REF
+## The unstable git commit-ish (ideally a branch) to pull for `--head` builds.
+##
+## For most projects, this should be `master`. The chosen branch should be one that is expected to be always buildable on all supported platforms.
+##
+## ## Notes:
+## At least one of `REF` and `HEAD_REF` must be specified, however it is preferable for both to be present.
+##
+## This exports the `VCPKG_HEAD_VERSION` variable during head builds.
+##
+## ## Examples:
+##
+## * [blaze](https://github.com/Microsoft/vcpkg/blob/master/ports/blaze/portfile.cmake)
+function(vcpkg_from_bitbucket)
+ set(oneValueArgs OUT_SOURCE_PATH REPO REF SHA512 HEAD_REF)
+ set(multipleValuesArgs)
+ cmake_parse_arguments(_vdud "" "${oneValueArgs}" "${multipleValuesArgs}" ${ARGN})
+
+ if(NOT _vdud_OUT_SOURCE_PATH)
+ message(FATAL_ERROR "OUT_SOURCE_PATH must be specified.")
+ endif()
+
+ if((_vdud_REF AND NOT _vdud_SHA512) OR (NOT _vdud_REF AND _vdud_SHA512))
+ message(FATAL_ERROR "SHA512 must be specified if REF is specified.")
+ endif()
+
+ if(NOT _vdud_REPO)
+ message(FATAL_ERROR "The Bitbucket repository must be specified.")
+ endif()
+
+ if(NOT _vdud_REF AND NOT _vdud_HEAD_REF)
+ message(FATAL_ERROR "At least one of REF and HEAD_REF must be specified.")
+ endif()
+
+ string(REGEX REPLACE ".*/" "" REPO_NAME ${_vdud_REPO})
+ string(REGEX REPLACE "/.*" "" ORG_NAME ${_vdud_REPO})
+
+ macro(set_SOURCE_PATH BASE BASEREF)
+ set(SOURCE_PATH "${BASE}/${ORG_NAME}-${REPO_NAME}-${BASEREF}")
+ if(EXISTS ${SOURCE_PATH})
+ set(${_vdud_OUT_SOURCE_PATH} "${SOURCE_PATH}" PARENT_SCOPE)
+ else()
+ # Sometimes GitHub strips a leading 'v' off the REF.
+ string(REGEX REPLACE "^v" "" REF ${BASEREF})
+ set(SOURCE_PATH "${BASE}/${ORG_NAME}-${REPO_NAME}-${REF}")
+ if(EXISTS ${SOURCE_PATH})
+ set(${_vdud_OUT_SOURCE_PATH} "${SOURCE_PATH}" PARENT_SCOPE)
+ else()
+ message(FATAL_ERROR "Could not determine source path: '${BASE}/${ORG_NAME}-${REPO_NAME}-${BASEREF}' does not exist")
+ endif()
+ endif()
+ endmacro()
+
+ if(VCPKG_USE_HEAD_VERSION AND NOT _vdud_HEAD_REF)
+ message(STATUS "Package does not specify HEAD_REF. Falling back to non-HEAD version.")
+ set(VCPKG_USE_HEAD_VERSION OFF)
+ endif()
+
+ # Handle --no-head scenarios
+ if(NOT VCPKG_USE_HEAD_VERSION)
+ if(NOT _vdud_REF)
+ message(FATAL_ERROR "Package does not specify REF. It must built using --head.")
+ endif()
+
+ set(URL "https://bitbucket.com/${ORG_NAME}/${REPO_NAME}/get/${_vdud_REF}.tar.gz")
+ set(downloaded_file_path "${DOWNLOADS}/${ORG_NAME}-${REPO_NAME}-${_vdud_REF}.tar.gz")
+
+ file(DOWNLOAD "https://api.bitbucket.com/2.0/repositories/${ORG_NAME}/${REPO_NAME}/refs/tags/${_vdud_REF}"
+ ${downloaded_file_path}.version
+ STATUS download_status
+ )
+ list(GET download_status 0 status_code)
+ if ("${status_code}" STREQUAL "0")
+ # Parse the github refs response with regex.
+ # TODO: use some JSON swiss-army-knife utility instead.
+ file(READ "${downloaded_file_path}.version" _contents)
+ string(REGEX MATCH "\"hash\": \"[a-f0-9]+\"" x "${_contents}")
+ string(REGEX REPLACE "\"hash\": \"([a-f0-9]+)\"" "\\1" _version ${x})
+ string(SUBSTRING ${_version} 0 12 _version) # Get the 12 first numbers from commit hash
+ else()
+ set(_version ${_vdud_REF})
+ endif()
+
+ vcpkg_download_distfile(ARCHIVE
+ URLS "https://bitbucket.com/${ORG_NAME}/${REPO_NAME}/get/${_vdud_REF}.tar.gz"
+ SHA512 "${_vdud_SHA512}"
+ FILENAME "${ORG_NAME}-${REPO_NAME}-${_vdud_REF}.tar.gz"
+ )
+ vcpkg_extract_source_archive_ex(ARCHIVE "${ARCHIVE}")
+ set_SOURCE_PATH(${CURRENT_BUILDTREES_DIR}/src ${_version})
+ return()
+ endif()
+
+ # The following is for --head scenarios
+ set(URL "https://bitbucket.com/${ORG_NAME}/${REPO_NAME}/get/${_vdud_HEAD_REF}.tar.gz")
+ set(downloaded_file_path "${DOWNLOADS}/${ORG_NAME}-${REPO_NAME}-${_vdud_HEAD_REF}.tar.gz")
+
+ if(_VCPKG_NO_DOWNLOADS)
+ if(NOT EXISTS ${downloaded_file_path} OR NOT EXISTS ${downloaded_file_path}.version)
+ message(FATAL_ERROR "Downloads are disabled, but '${downloaded_file_path}' does not exist.")
+ endif()
+ message(STATUS "Using cached ${downloaded_file_path}")
+ else()
+ if(EXISTS ${downloaded_file_path})
+ message(STATUS "Purging cached ${downloaded_file_path} to fetch latest (use --no-downloads to suppress)")
+ file(REMOVE ${downloaded_file_path})
+ endif()
+ if(EXISTS ${downloaded_file_path}.version)
+ file(REMOVE ${downloaded_file_path}.version)
+ endif()
+ if(EXISTS ${CURRENT_BUILDTREES_DIR}/src/head)
+ file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/src/head)
+ endif()
+
+ # Try to download the file and version information from bitbucket.
+ message(STATUS "Downloading ${URL}...")
+ file(DOWNLOAD "https://api.bitbucket.com/2.0/repositories/${ORG_NAME}/${REPO_NAME}/refs/branches/${_vdud_HEAD_REF}"
+ ${downloaded_file_path}.version
+ STATUS download_status
+ )
+ list(GET download_status 0 status_code)
+ if (NOT "${status_code}" STREQUAL "0")
+ file(REMOVE ${downloaded_file_path}.version)
+ message(FATAL_ERROR "Downloading version info for ${URL}... Failed. Status: ${download_status}")
+ endif()
+
+ file(DOWNLOAD ${URL} ${downloaded_file_path} STATUS download_status)
+ list(GET download_status 0 status_code)
+ if (NOT "${status_code}" STREQUAL "0")
+ file(REMOVE ${downloaded_file_path})
+ message(FATAL_ERROR "Downloading ${URL}... Failed. Status: ${download_status}")
+ else()
+ message(STATUS "Downloading ${URL}... OK")
+ endif()
+ endif()
+
+ vcpkg_extract_source_archive_ex(
+ ARCHIVE "${downloaded_file_path}"
+ WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/src/head"
+ )
+
+ # Parse the github refs response with regex.
+ # TODO: use some JSON swiss-army-knife utility instead.
+ file(READ "${downloaded_file_path}.version" _contents)
+ string(REGEX MATCH "\"hash\": \"[a-f0-9]+\"" x "${_contents}")
+ string(REGEX REPLACE "\"hash\": \"([a-f0-9]+)\"" "\\1" _version ${x})
+ string(SUBSTRING ${_version} 0 12 _vdud_HEAD_REF) # Get the 12 first numbers from commit hash
+
+ # exports VCPKG_HEAD_VERSION to the caller. This will get picked up by ports.cmake after the build.
+ set(VCPKG_HEAD_VERSION ${_version} PARENT_SCOPE)
+
+ set_SOURCE_PATH(${CURRENT_BUILDTREES_DIR}/src/head ${_vdud_HEAD_REF})
+endfunction()
diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1
index 13799cc73..4aca0c811 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,8 @@ 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")
- }
+ # Can't print because vcpkg captures the output and expects only the path that is returned at the end of this script file
+ # Write-Host "A suitable version of $Dependency was not found (required v$requiredVersion). Downloading portable $Dependency v$downloadVersion..."
if (!(Test-Path $downloadDir))
{
@@ -151,12 +105,12 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency)
if($Dependency -eq "cmake")
{
- $requiredVersion = "3.9.0"
- $downloadVersion = "3.9.0"
- $url = "https://cmake.org/files/v3.9/cmake-3.9.0-win32-x86.zip"
- $downloadPath = "$downloadsDir\cmake-3.9.0-win32-x86.zip"
- $expectedDownloadedFileHash = "9d593839f64b94718a1b75b8519b56ecb959e4d37d406bf2a087e2c1f7a6b89c"
- $executableFromDownload = "$downloadsDir\cmake-3.9.0-win32-x86\bin\cmake.exe"
+ $requiredVersion = "3.9.2"
+ $downloadVersion = "3.9.2"
+ $url = "https://cmake.org/files/v3.9/cmake-3.9.2-win32-x86.zip"
+ $downloadPath = "$downloadsDir\cmake-3.9.2-win32-x86.zip"
+ $expectedDownloadedFileHash = "9fe68d50f065666cb2861f53751390f15c6363c440e86a07677689378bb8329f"
+ $executableFromDownload = "$downloadsDir\cmake-3.9.2-win32-x86\bin\cmake.exe"
$extractionType = $ExtractionType_ZIP
$extractionFolder = $downloadsDir
}
@@ -172,16 +126,16 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency)
}
elseif($Dependency -eq "git")
{
- $requiredVersion = "2.0.0"
- $downloadVersion = "2.11.1"
- $url = "https://github.com/git-for-windows/git/releases/download/v2.11.1.windows.1/MinGit-2.11.1-32-bit.zip" # We choose the 32-bit version
- $downloadPath = "$downloadsDir\MinGit-2.11.1-32-bit.zip"
- $expectedDownloadedFileHash = "6ca79af09015625f350ef4ad74a75cfb001b340aec095b6963be9d45becb3bba"
+ $requiredVersion = "2.14.1"
+ $downloadVersion = "2.14.1"
+ $url = "https://github.com/git-for-windows/git/releases/download/v2.14.1.windows.1/MinGit-2.14.1-32-bit.zip" # We choose the 32-bit version
+ $downloadPath = "$downloadsDir\MinGit-2.14.1-32-bit.zip"
+ $expectedDownloadedFileHash = "77b468e0ead1e7da4cb3a1cf35dabab5210bf10457b4142f5e9430318217cdef"
# There is another copy of git.exe in MinGit\bin. However, an installed version of git add the cmd dir to the PATH.
# Therefore, choosing the cmd dir here as well.
- $executableFromDownload = "$downloadsDir\MinGit-2.11.1-32-bit\cmd\git.exe"
+ $executableFromDownload = "$downloadsDir\MinGit-2.14.1-32-bit\cmd\git.exe"
$extractionType = $ExtractionType_ZIP
- $extractionFolder = "$downloadsDir\MinGit-2.11.1-32-bit"
+ $extractionFolder = "$downloadsDir\MinGit-2.14.1-32-bit"
}
else
{
@@ -202,7 +156,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 $? }