taste-edit-project 1.6 KB
Newer Older
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
1
#!/bin/bash
Maxime Perrotin's avatar
Maxime Perrotin committed
2

Maxime Perrotin's avatar
Maxime Perrotin committed
3 4
if [ -t 0 ]
then
Maxime Perrotin's avatar
Maxime Perrotin committed
5 6 7 8 9 10 11 12 13
    COLORON="\e[1m\e[32m"
    REDCOLORON="\e[1m\e[31m"
    COLOROFF="\e[0m"
else
    COLORON=""
    REDCOLORON=""
    COLOROFF=""
fi

Maxime Perrotin's avatar
Maxime Perrotin committed
14 15
INFO="${COLORON}[INFO]${COLOROFF}"
ERROR="${REDCOLORON}[ERROR]${COLOROFF}"
Maxime Perrotin's avatar
Maxime Perrotin committed
16

Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
17 18
if [ -f InterfaceView.aadl ]
then
Maxime Perrotin's avatar
Maxime Perrotin committed
19
    echo -e "${INFO} Opening TASTE project"
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
20 21
    INTERFACEVIEW=InterfaceView.aadl
else
Maxime Perrotin's avatar
Maxime Perrotin committed
22 23
    echo -e "${ERROR} Missing InterfaceView.aadl"
    echo -e "${ERROR} First use taste-create-project to start a new project"
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
24 25 26 27
    exit 1
fi

grep -i taste-directives.aadl "$INTERFACEVIEW" >/dev/null && {
Maxime Perrotin's avatar
Maxime Perrotin committed
28 29
    echo -e "${ERROR} Your interface view needs to be upgraded\!"
    echo "   Please upgrade it with:"
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
30
    echo
Maxime Perrotin's avatar
Maxime Perrotin committed
31
    echo "      taste-upgrade-IF-view oldIFview newIFview"
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
32
    echo
Maxime Perrotin's avatar
Maxime Perrotin committed
33
    echo "   ...and use the newIFview instead."
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
34 35 36 37 38 39 40 41 42
    exit 1
}

# If there is no deployment view, only load interface view
EXTRA_CMD=
if [ ! -f DeploymentView.aadl ]
then
    EXTRA_CMD+=--load-interface-view
    EXTRA_CMD+=' InterfaceView.aadl' 
43
    EXTRA_CMD+=' --aadl-library $(taste-config --prefix)/share/ocarina/AADLv2/ocarina_components.aadl '
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
44 45 46
else
    EXTRA_CMD=
fi
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62

# Add the components from the components library
FIRST=1
LIBDIR=$(taste-config --prefix)/share/components_library
for each in $LIBDIR/*
do
    if [ $FIRST -eq 1 ]
    then
        EXTRA_CMD+='--edit-aadl '
    else
        EXTRA_CMD+=,
    fi
    EXTRA_CMD+=$each/interfaceview.aadl
    FIRST=0
done

Maxime Perrotin's avatar
Maxime Perrotin committed
63
echo -e "${INFO} Running
Maxime Perrotin's avatar
Maxime Perrotin committed
64
    TASTE $EXTRA_CMD          --data-view DataView.aadl 
Maxime Perrotin's avatar
Maxime Perrotin committed
65 66
          --load-deployment-view DeploymentView.aadl
"
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
67
TASTE $EXTRA_CMD --data-view DataView.aadl --load-deployment-view DeploymentView.aadl