forked from googleapis/google-cloud-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(vcpkg): create lib/vcpkg.sh used by several builds
Fixes: googleapis#6699 This PR factors the code to fetch the vcpkg repo into a library that's reused in a couple places. It also clones the repo at a recent release tag rather than cloning at HEAD which may break our builds and is not hermetic, or downloading a tarball, which lacks git history.
- Loading branch information
Showing
3 changed files
with
50 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright 2021 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Make our include guard clean against set -o nounset. | ||
test -n "${CI_CLOUDBUILD_BUILDS_LIB_VCPKG_SH__:-}" || declare -i CI_CLOUDBUILD_BUILDS_LIB_VCPKG_SH__=0 | ||
if ((CI_CLOUDBUILD_BUILDS_LIB_VCPKG_SH__++ != 0)); then | ||
return 0 | ||
fi # include guard | ||
|
||
source module ci/cloudbuild/builds/lib/git.sh | ||
source module ci/lib/io.sh | ||
|
||
TIMEFORMAT="==> 🕑 vcpkg installed in %R seconds" | ||
time { | ||
VCPKG_RELEASE_VERSION="2021.05.12" | ||
VCPKG_ROOT_DIR="${HOME}/vcpkg-${VCPKG_RELEASE_VERSION}" | ||
io::log_h2 "Installing vcpkg ${VCPKG_RELEASE_VERSION}" | ||
if [[ ! -d "${VCPKG_ROOT_DIR}" ]]; then | ||
mkdir -p "${VCPKG_ROOT_DIR}" | ||
# vcpkg needs git history to support versioning, so we clone a recent | ||
# release tag rather than just extracting a tarball without history. | ||
git clone https://github.com/microsoft/vcpkg.git "${VCPKG_ROOT_DIR}" \ | ||
-b "${VCPKG_RELEASE_VERSION}" | ||
fi | ||
env -C "${VCPKG_ROOT_DIR}" CC="ccache ${CC:-clang}" CXX="ccache ${CXX:-clang++}" \ | ||
./bootstrap-vcpkg.sh | ||
} | ||
|
||
# Outputs the root directory where vcpkg is installed (and bootstrapped) | ||
function vcpkg::root_dir() { | ||
echo "${VCPKG_ROOT_DIR}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters