forked from lifting-bits/cxx-common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pull_dependencies.sh
executable file
·81 lines (64 loc) · 1.96 KB
/
pull_dependencies.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env bash
# Try to pull prebuilt library dependencies using NuGet with your GitHub
# credentials
set -x -euo pipefail
echo "Old and untested..."
exit 1
usage()
{
cat << EOF
usage: pull_dependencies GITHUB_USERNAME GITHUB_TOKEN
GITHUB_USERNAME | GitHub username associated with Token
GITHUB_TOKEN | GitHub token to pull NuGet packages
WARNING: Will write your token in plaintext at ~/.conig/NuGet/NuGet.config
EOF
}
if [ -z ${1+x} ]; then
echo "First argument GITHUB_USERNAME variable is unset";
usage
exit 1
else
GITHUB_USERNAME="$1"
fi
if [ -z ${2+x} ]; then
echo "Second argument GITHUB_USERNAME variable is unset";
usage
exit 1
else
GITHUB_TOKEN="$2"
fi
#### Bootstrap vcpkg
git clone https://github.com/microsoft/vcpkg.git || true
# Thu Nov 12 23:28:59 2020 +0100
# NOTE: Update .github/workflows/ci.yml as well
pushd vcpkg && git fetch && git checkout b518035a33941380c044b00a1b4f8abff764cbdc && popd
./vcpkg/bootstrap-vcpkg.sh
#### Caching Setup
# NOTE: "Source" is specific to what you name the NuGet feed when adding it
export VCPKG_BINARY_SOURCES='clear;nuget,Source,read'
# WARNING
# Password stored in cleartext
# TODO(ekilmer): Parameterize llvm version
mono "$(./vcpkg/vcpkg fetch nuget | tail -n 1)" sources add \
-source "https://nuget.pkg.github.com/lifting-bits/index.json" \
-storepasswordincleartext \
-name "Source" \
-username "${GITHUB_USERNAME}" \
-password "${GITHUB_TOKEN}" || true
mono "$(./vcpkg/vcpkg fetch nuget | tail -n 1)" setapikey \
-source "https://nuget.pkg.github.com/lifting-bits/index.json" \
"${GITHUB_TOKEN}"
#### Pulling dependencies with correct triplet
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) triplet=x64-linux-rel;;
Darwin*) triplet=x64-osx-rel;;
*) triplet="UNKNOWN:${unameOut}"
esac
echo Using Triplet: "${triplet}"
# TODO(ekilmer): Parameterize llvm version
./vcpkg/vcpkg install \
--triplet "${triplet}" \
--debug \
llvm-10 \
@dependencies.txt