Files
stream-applications/create-matrices.sh
Corneil du Plessis 2a5050b888 Ensure that matrix generation for modules ignore function paths moved to spring functions catalog (#585)
Added checks for presence of folders when generating module matrix.
2024-11-26 10:31:04 +02:00

71 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
function add_app() {
if ((COUNT > 0)); then
echo "," >> matrix.json
fi
echo "\"$1\"" >> matrix.json
COUNT=$((COUNT+1))
TOTAL=$((TOTAL+1))
}
pushd applications/processor > /dev/null
PROCESSORS=$(find * -maxdepth 0 -type d)
popd > /dev/null
pushd applications/sink > /dev/null
SINKS=$(find * -maxdepth 0 -type d)
popd > /dev/null
pushd applications/source > /dev/null
SOURCES=$(find * -maxdepth 0 -type d)
popd > /dev/null
if [ -d functions ]; then
pushd functions/consumer > /dev/null
CONSUMERS=$(find * -maxdepth 0 -type d)
popd > /dev/null
pushd functions/function > /dev/null
FUNCTIONS=$(find * -maxdepth 0 -type d)
popd > /dev/null
pushd functions/supplier > /dev/null
SUPPLIERS=$(find * -maxdepth 0 -type d)
popd > /dev/null
fi
TOTAL=0
echo "{" > matrix.json
if [ -d functions ]; then
echo "\"functions\":[" >> matrix.json
COUNT=0
for app in $FUNCTIONS; do
add_app $app
done
echo "],\"consumers\":[" >> matrix.json
COUNT=0
for app in $CONSUMERS; do
add_app $app
done
echo "],\"suppliers\":[" >> matrix.json
COUNT=0
for app in $SUPPLIERS; do
add_app $app
done
echo "],"
fi
echo "\"processors\":[" >> matrix.json
COUNT=0
for app in $PROCESSORS; do
add_app $app
done
echo "],\"sinks\":[" >> matrix.json
COUNT=0
for app in $SINKS; do
add_app $app
done
echo "],\"sources\":[" >> matrix.json
COUNT=0
for app in $SOURCES; do
add_app $app
done
echo "]" >> matrix.json
echo ",\"count\": $TOTAL" >> matrix.json
echo "}" >> matrix.json
MATRIX=$(jq -c . matrix.json)
echo "$MATRIX" > matrix.json