Files
gerrit/contrib/mitm-ui/mitm-single-plugin.sh
Viktar Donich fc299bc8ae Provide --components for plugin-based mitm scripts
Change-Id: Ifa7efa4281e053e48a80351bc8af54c73d5aa3fd
2019-04-08 13:04:27 -07:00

39 lines
956 B
Bash
Executable File

#!/bin/sh
if [[ -z "$1" ]]; then
echo This script serves one plugin with the rest of static content.
echo Provide path to index plugin file, e.g. buildbucket.html for buildbucket plugin
exit 1
fi
realpath() {
OURPWD=$PWD
cd "$(dirname "$1")"
LINK=$(basename "$1")
while [ -L "$LINK" ]; do
LINK=$(readlink "$LINK")
cd "$(dirname "$LINK")"
LINK="$(basename "$1")"
done
REAL_DIR=`pwd -P`
RESULT=$REAL_DIR/$LINK
cd "$OURPWD"
echo "$RESULT"
}
plugin=$(realpath $1)
plugin_root=$(dirname ${plugin})
mitm_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
${mitm_dir}/dev-chrome.sh &
bazel build //polygerrit-ui/app:test_components &
${mitm_dir}/mitm-docker.sh -v ${plugin_root}:${plugin_root} \
"serve-app-dev.py \
--plugins ${plugin} \
--strip_assets \
--plugin_root ${plugin_root} \
--components $(pwd)/bazel-bin/polygerrit-ui/app/"