build-script.sh 3.54 KB
Newer Older
Maxime Perrotin's avatar
Maxime Perrotin committed
1
#!/bin/bash -e
2 3 4

# This script will build your TASTE system.

Maxime Perrotin's avatar
Maxime Perrotin committed
5
# You should not change this file as it was automatically generated.
6

Maxime Perrotin's avatar
Maxime Perrotin committed
7 8 9 10
# If you need additional preprocessing, there are three hook files
# that you can provide and that are called dring the build:
# user_init_pre.sh, user_init_post.sh and user_init_last.sh
# These files will never get overwritten by TASTE.'
11

Maxime Perrotin's avatar
Maxime Perrotin committed
12 13 14 15
# Inside these files you may set some environment variables:
#    C_INCLUDE_PATH=/usr/include/xenomai/analogy/:${C_INCLUDE_PATH}
#    unset USE_POHIC   

16
mkdir -p .cache
17
export PROJECT_CACHE=$HOME/.taste_AST_cache
18

Maxime Perrotin's avatar
Maxime Perrotin committed
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
CWD=$(pwd)

if [ -t 1 ] ; then
    COLORON="\e[1m\e[32m"
    COLOROFF="\e[0m"
else
    COLORON=""
    COLOROFF=""
fi
INFO="${COLORON}[INFO]${COLOROFF}"

if [ -f user_init_pre.sh ]
then
    echo -e "${INFO} Executing user-defined init script"
    source user_init_pre.sh
fi

# Use PolyORB-HI-C runtime
USE_POHIC=1

# Set Debug mode by default
DEBUG_MODE=--debug

# Detect models from Ellidiss tools v2, and convert them to 1.3
INTERFACEVIEW=InterfaceView.aadl
grep "version => \"2" InterfaceView.aadl >/dev/null && {
    echo -e "${INFO} Converting interface view from V2 to V1.3"
    TASTE --load-interface-view InterfaceView.aadl --export-interface-view-to-1_3 __iv_1_3.aadl
    INTERFACEVIEW=__iv_1_3.aadl
};
49

50 51 52 53 54
if [ -z "$DEPLOYMENTVIEW" ]
then
    DEPLOYMENTVIEW=DeploymentView.aadl
fi

Maxime Perrotin's avatar
Maxime Perrotin committed
55 56 57 58 59 60 61
# Detect models from Ellidiss tools v2, and convert them to 1.3
grep "version => \"2" "$DEPLOYMENTVIEW" >/dev/null && {
    echo -e "${INFO} Converting deployment view from V2 to V1.3"
    TASTE --load-deployment-view "$DEPLOYMENTVIEW" --export-deployment-view-to-1_3 __dv_1_3.aadl
    DEPLOYMENTVIEW=__dv_1_3.aadl
};

62 63
SKELS="./"

Maxime Perrotin's avatar
Maxime Perrotin committed
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
# Check if Dataview references existing files 
mono $(which taste-extract-asn-from-design.exe) -i "$INTERFACEVIEW" -j /tmp/dv.asn

# Generate code for OpenGEODE function f1
cd "$SKELS"/f1 && opengeode --toAda f1.pr system_structure.pr && cd $OLDPWD

# Generate code for OpenGEODE function f2
cd "$SKELS"/f2 && opengeode --toAda f2.pr system_structure.pr && cd $OLDPWD

# Generate code for OpenGEODE function f3
cd "$SKELS"/f3 && opengeode --toAda f3.pr system_structure.pr && cd $OLDPWD

# Generate code for OpenGEODE function f4
cd "$SKELS"/f4 && opengeode --toAda f4.pr system_structure.pr && cd $OLDPWD

cd "$SKELS" && rm -f f1.zip && zip f1 f1/* && cd $OLDPWD
80

Maxime Perrotin's avatar
Maxime Perrotin committed
81 82 83 84 85 86 87
cd "$SKELS" && rm -f f2.zip && zip f2 f2/* && cd $OLDPWD

cd "$SKELS" && rm -f f3.zip && zip f3 f3/* && cd $OLDPWD

cd "$SKELS" && rm -f f4.zip && zip f4 f4/* && cd $OLDPWD

[ ! -z "$CLEANUP" ] && rm -rf binary*
88 89 90 91

if [ -f ConcurrencyView.pro ]
then
    ORCHESTRATOR_OPTIONS+=" -w ConcurrencyView.pro "
Maxime Perrotin's avatar
Maxime Perrotin committed
92 93 94 95 96 97 98 99 100 101 102 103 104 105
elif [ -f ConcurrencyView_Properties.aadl ]
then
    ORCHESTRATOR_OPTIONS+=" -w ConcurrencyView_Properties.aadl "
fi

if [ -f user_init_post.sh ]
then
    echo -e "${INFO} Executing user-defined post-init script"
    source user_init_post.sh
fi

if [ -f additionalCommands.sh ]
then
    source additionalCommands.sh
106 107 108 109 110 111 112 113 114 115 116 117
fi

if [ ! -z "$USE_POHIC" ]
then
    OUTPUTDIR=binary.c
    ORCHESTRATOR_OPTIONS+=" -p "
elif [ ! -z "$USE_POHIADA" ]
then
    OUTPUTDIR=binary.ada
else
    OUTPUTDIR=binary
fi
Maxime Perrotin's avatar
Maxime Perrotin committed
118 119 120 121

cd "$CWD" && assert-builder-ocarina.py \
	--fast \
	$DEBUG_MODE \
122 123
	--aadlv2 \
	--keep-case \
Maxime Perrotin's avatar
Maxime Perrotin committed
124
	--interfaceView "$INTERFACEVIEW" \
125 126 127 128 129 130 131
	--deploymentView "$DEPLOYMENTVIEW" \
	-o "$OUTPUTDIR" \
	--subAda f1:"$SKELS"/f1.zip \
	--subAda f2:"$SKELS"/f2.zip \
	--subAda f3:"$SKELS"/f3.zip \
	--subAda f4:"$SKELS"/f4.zip \
	$ORCHESTRATOR_OPTIONS
Maxime Perrotin's avatar
Maxime Perrotin committed
132 133 134 135 136 137 138

if [ -f user_init_last.sh ]
then
    echo -e "${INFO} Executing user-defined post-build script"
    source user_init_last.sh
fi