diff --git a/scripts/compile-plugins.sh b/scripts/compile-plugins.sh index dd587d022d6..7610797c933 100755 --- a/scripts/compile-plugins.sh +++ b/scripts/compile-plugins.sh @@ -21,27 +21,24 @@ set -e +echo "Usage: " +echo " build all plugins: $0 [golang build flags...]" +echo " build and keep one plugin only: PLUGIN=jira $0 [golang build flags...]" + SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" PLUGIN_SRC_DIR=$SCRIPT_DIR/../plugins PLUGIN_OUTPUT_DIR=$SCRIPT_DIR/../bin/plugins -if [ ! -z "$PLUGIN" ]; then - for PLUG in $(find $PLUGIN_SRC_DIR/* -maxdepth 0 -type d -not -name core -not -empty); do - NAME=$(basename $PLUG) - - if [ "$NAME" == "$PLUGIN" ]; then - echo "Building plugin $NAME to bin/plugins/$NAME/$NAME.so" - go build -buildmode=plugin "$@" -o $PLUGIN_OUTPUT_DIR/$NAME/$NAME.so $PLUG/*.go - fi - done +if [ -z "$PLUGIN" ]; then + PLUGINS=$(find $PLUGIN_SRC_DIR/* -maxdepth 0 -type d -not -name core -not -name helper -not -empty) else - # When rebuilding from all plugins, clean out old binaries first - rm -rf bin/plugins/* + PLUGINS=$PLUGIN_SRC_DIR/$PLUGIN +fi - for PLUG in $(find $PLUGIN_SRC_DIR/* -maxdepth 0 -type d -not -name core -not -name helper -not -empty); do +rm -rf $PLUGIN_OUTPUT_DIR/* +for PLUG in $PLUGINS; do NAME=$(basename $PLUG) - echo "Building plugin $NAME to bin/plugins/$NAME/$NAME.so" - go build -buildmode=plugin "$@" -o $PLUGIN_OUTPUT_DIR/$NAME/$NAME.so $PLUG/*.go - done -fi + go build -buildmode=plugin "$@" -o $PLUGIN_OUTPUT_DIR/$NAME/$NAME.so $PLUG/*.go & +done +wait