build-script.sh 3.55 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 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
# Inside these files you may set some environment variables:
#    C_INCLUDE_PATH=/usr/include/xenomai/analogy/:${C_INCLUDE_PATH}
#    unset USE_POHIC   

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

# Set up the cache to limit the calls to ASN1SCC in DMT tools
34 35 36
mkdir -p .cache
export PROJECT_CACHE=$(pwd)/.cache

Maxime Perrotin's avatar
Maxime Perrotin committed
37 38 39 40 41 42 43 44 45 46 47 48 49 50
# 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
};

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

Maxime Perrotin's avatar
Maxime Perrotin committed
56 57 58 59 60 61 62
# 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
};

63 64
SKELS="./"

Maxime Perrotin's avatar
Maxime Perrotin committed
65 66 67
# Check if Dataview references existing files 
mono $(which taste-extract-asn-from-design.exe) -i "$INTERFACEVIEW" -j /tmp/dv.asn

68
# Generate code for OpenGEODE function orchestrator
Maxime Perrotin's avatar
Maxime Perrotin committed
69
cd "$SKELS"/orchestrator && opengeode --toAda orchestrator.pr system_structure.pr && cd $OLDPWD || exit -1
70 71

# Generate code for OpenGEODE function memoryscrub
Maxime Perrotin's avatar
Maxime Perrotin committed
72
cd "$SKELS"/memoryscrub && opengeode --toAda memoryscrub.pr system_structure.pr && cd $OLDPWD || exit -1
73

Maxime Perrotin's avatar
Maxime Perrotin committed
74
cd "$SKELS" && rm -f orchestrator.zip && zip -r orchestrator orchestrator/* && cd $OLDPWD || exit -1
75

Maxime Perrotin's avatar
Maxime Perrotin committed
76
cd "$SKELS" && rm -f passivefunction.zip && zip -r passivefunction passivefunction/* && cd $OLDPWD || exit -1
77

Maxime Perrotin's avatar
Maxime Perrotin committed
78
cd "$SKELS" && rm -f memoryscrub.zip && zip -r memoryscrub memoryscrub/* && cd $OLDPWD || exit -1
79

80
[ ! -z "$CLEANUP" ] && rm -rf binary*
81 82 83 84

if [ -f ConcurrencyView.pro ]
then
    ORCHESTRATOR_OPTIONS+=" -w ConcurrencyView.pro "
Maxime Perrotin's avatar
Maxime Perrotin committed
85 86 87 88 89 90 91 92 93
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
94 95
fi

Maxime Perrotin's avatar
Maxime Perrotin committed
96 97 98 99
if [ -f additionalCommands.sh ]
then
    source additionalCommands.sh
fi
100 101 102

if [ ! -z "$USE_POHIC" ]
then
Maxime Perrotin's avatar
Maxime Perrotin committed
103
    OUTPUTDIR=binary.c
104 105 106
    ORCHESTRATOR_OPTIONS+=" -p "
elif [ ! -z "$USE_POHIADA" ]
then
Maxime Perrotin's avatar
Maxime Perrotin committed
107
    OUTPUTDIR=binary.ada
108 109 110
else
    OUTPUTDIR=binary
fi
Maxime Perrotin's avatar
Maxime Perrotin committed
111 112

cd "$CWD" && assert-builder-ocarina.py \
113
	--fast \
Maxime Perrotin's avatar
Maxime Perrotin committed
114
	$DEBUG_MODE \
115 116
	--aadlv2 \
	--keep-case \
Maxime Perrotin's avatar
Maxime Perrotin committed
117
	--interfaceView "$INTERFACEVIEW" \
118 119 120 121 122 123
	--deploymentView "$DEPLOYMENTVIEW" \
	-o "$OUTPUTDIR" \
	--subAda orchestrator:"$SKELS"/orchestrator.zip \
	--subC passivefunction:"$SKELS"/passivefunction.zip \
	--subAda memoryscrub:"$SKELS"/memoryscrub.zip \
	$ORCHESTRATOR_OPTIONS
Maxime Perrotin's avatar
Maxime Perrotin committed
124 125 126 127 128 129 130

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