This is an automated email from the ASF dual-hosted git repository.

zhangliang2022 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new f8be355d feat: compile plugins in parallel / compile one plugin only 
(#2157)
f8be355d is described below

commit f8be355df1fc79e7be9b8854c0f6baca976cdb2f
Author: Klesh Wong <[email protected]>
AuthorDate: Fri Jun 10 15:50:50 2022 +0800

    feat: compile plugins in parallel / compile one plugin only (#2157)
---
 scripts/compile-plugins.sh | 29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/scripts/compile-plugins.sh b/scripts/compile-plugins.sh
index dd587d02..7610797c 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

Reply via email to