#!/bin/sh

set -e

CI_COMMIT_SHORT_SHA=${CI_COMMIT_SHORT_SHA:-local}

for dir in deadlock-plugins/*/; do
    echo
    echo "==============================================="
    echo "Building $dir"
    echo "==============================================="
    echo
    cd $dir
    CURRENT_PLUGIN_DIR=$(basename "$PWD")
    ./install.sh
    ./build.sh CI_COMMIT_SHORT_SHA
    cp -f *.vsix ../../plugins/$CURRENT_PLUGIN_DIR-$CI_COMMIT_SHORT_SHA.vsix
    cd -
done
