-
Notifications
You must be signed in to change notification settings - Fork 328
/
configure.sh
executable file
·92 lines (74 loc) · 2.71 KB
/
configure.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
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash
set -ex
source configuration
# Defaults are set in configuration file, but can be overridden here.
# We can't put these overrides in the configuration file because it is parsed
# very naively on windows.
export DENO=${DENO_VERSION=$DENO}
export DENO_DOM=${DENO_DOM_VERSION=$DENO_DOM}
export PANDOC=${PANDOC_VERSION=$PANDOC}
export DARTSASS=${DART_SASS_VERSION=$DARTSASS}
export ESBUILD=${ESBUILD_VERSION=$ESBUILD}
export TYPST=${TYPST_VERSION=$TYPST}
source package/scripts/common/utils.sh
source package/src/set_package_paths.sh
# Selects curl or wget based on availability and https support.
function download() {
url=$1
destination=$2
if curl --version | grep -qF ' https '; then
curl --fail -L -o "$destination" "$url"
else
wget -q -O "$destination" "$url"
fi
}
QUARTO_VENDOR_BINARIES=${QUARTO_VENDOR_BINARIES=true}
DENO_BIN=${QUARTO_DENO=$QUARTO_BIN_PATH/tools/$DENO_DIR/deno}
if [[ "${QUARTO_VENDOR_BINARIES}" = "true" ]]; then
DENO_VERSION_NO_V=$(echo $DENO | sed 's/v//')
if [[ (! -f "$DENO_BIN") || $("$DENO_BIN" --version | grep $DENO_VERSION_NO_V) == "" ]]; then
# Ensure directory is there for Deno
echo "Bootstrapping Deno..."
rm -rf $QUARTO_DIST_PATH
## Binary Directory
mkdir -p "$QUARTO_BIN_PATH/tools"
cd $QUARTO_BIN_PATH/tools
# Download Deno
for DENOFILE in $DENOFILES; do
download "$DENOURL/$DENO/$DENOFILE" "$DENOFILE"
unzip -o $DENOFILE
mkdir -p $DENO_DIR
mv deno $DENO_DIR
rm $DENOFILE
done
# we create a symlink here so that we need only one quarto-cli.code-workspace file
ln -s $DENO_DIR/deno deno
# If a canary commit is provided, upgrade to that
if [ ! -z "$DENO_CANARY_COMMIT" ]; then
echo [Upgrading Deno to Canary]
./deno upgrade --canary --version $DENO_CANARY_COMMIT
fi
# write deno version file for later use
mkdir -p $QUARTO_BIN_PATH/../config
echo $DENO > $QUARTO_BIN_PATH/../config/deno-version
fi
export DENO_BIN_PATH=$QUARTO_BIN_PATH/tools/$DENO_DIR/deno
else
if [ -z "$DENO_BIN_PATH" ]; then
echo "DENO_BIN_PATH is not set. You either need to allow QUARTO_VENDOR_BINARIES or set DENO_BIN_PATH to the path of a deno binary."
exit 1
fi
fi
echo "Downloading Deno Stdlib"
"${QUARTO_PACKAGE_PATH}/scripts/deno_std/download.sh"
pushd "$QUARTO_PACKAGE_PATH/src/"
# Run the configure command to bootstrap installation
./quarto-bld configure --log-level info
# Run the quarto command with 'reload', which will force the import_map dependencies
# to be reloaded
if ! quarto_loc="$(type -p quarto)" || [[ -z $quarto_loc ]]; then
echo "Quarto symlink doesn't appear to be configured."
else
export QUARTO_DENO_EXTRA_OPTIONS="--reload"
quarto --version
fi