Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions scripts/compile-plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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