2016-08-25 08:16:06 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-10-25 05:17:44 +03:00
|
|
|
# Copyright 2019 The Vitess Authors.
|
2017-05-06 02:21:12 +03:00
|
|
|
#
|
|
|
|
# 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.
|
2016-08-25 08:16:06 +03:00
|
|
|
|
|
|
|
# This script is used to install dependencies for compiling
|
|
|
|
# the code of our upcoming Angular 2 based vtctld UI.
|
|
|
|
#
|
|
|
|
# Regular users should not have to run it. Run bootstrap.sh (located in the
|
|
|
|
# repository root) instead.
|
|
|
|
|
|
|
|
# TODO(mberlin): Merge this back into bootstrap.sh once we support caching the
|
|
|
|
# dependencies on Travis and local disk.
|
|
|
|
|
|
|
|
# Download node
|
|
|
|
node_ver=v6.3.1
|
|
|
|
node_dist=$VTROOT/dist/node
|
|
|
|
if [[ -x $node_dist/bin/node && `$node_dist/bin/node -v` == "$node_ver" ]]; then
|
|
|
|
echo "skipping nodejs download. remove $node_dist to force redownload."
|
|
|
|
else
|
|
|
|
echo "Downloading nodejs"
|
|
|
|
rm -rf $node_dist
|
2016-12-10 05:20:50 +03:00
|
|
|
node_tar="node_linux64.tar.xz"
|
|
|
|
curl -sL https://nodejs.org/dist/$node_ver/node-$node_ver-linux-x64.tar.xz -o $node_tar
|
|
|
|
tar xf $node_tar -C $VTROOT/dist
|
2016-08-25 08:16:06 +03:00
|
|
|
mv $VTROOT/dist/node-$node_ver-linux-x64 $node_dist
|
2016-12-10 05:20:50 +03:00
|
|
|
rm $node_tar
|
|
|
|
# Add the node directory to PATH to make sure that the Angular
|
|
|
|
# installation below can find the "node" binary.
|
|
|
|
# (dev.env does actually append it to PATH.)
|
2019-12-07 22:11:06 +03:00
|
|
|
source $VTROOT/dev.env
|
2016-08-25 08:16:06 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Installing dependencies for building web UI"
|
|
|
|
angular_cli_dir=$VTROOT/dist/angular-cli
|
2019-12-07 22:11:06 +03:00
|
|
|
web_dir2=$VTROOT/web/vtctld2
|
2016-09-14 03:17:22 +03:00
|
|
|
angular_cli_commit=cacaa4eff10e135016ef81076fab1086a3bce92f
|
|
|
|
if [[ -d $angular_cli_dir && `cd $angular_cli_dir && git rev-parse HEAD` == "$angular_cli_commit" ]]; then
|
|
|
|
echo "skipping angular cli download. remove $angular_cli_dir to force download."
|
|
|
|
else
|
|
|
|
cd $VTROOT/dist && git clone https://github.com/angular/angular-cli.git --quiet
|
|
|
|
cd $angular_cli_dir && git checkout $angular_cli_commit --quiet
|
|
|
|
fi
|
2016-08-25 08:16:06 +03:00
|
|
|
cd $angular_cli_dir && $node_dist/bin/npm link --silent
|
|
|
|
cd $web_dir2 && $node_dist/bin/npm install --silent
|
|
|
|
cd $web_dir2 && $node_dist/bin/npm link angular-cli --silent
|