#!/bin/bash

FLAGS=""

if [ -z "$JULIA" ]
then
    JULIA=julia
fi

if [ ${JULIA_PROTOBUF_MODULE_POSTFIX:-0} -eq 1 ]; then
    FLAGS="${FLAGS} --module-postfix-enabled"
fi

if [ ${JULIA_PROTOBUF_MAP_AS_ARRAY:-0} -eq 1 ]; then
    FLAGS="${FLAGS} --map-as-array"
fi

if [ -z ${FLAGS} ]
then
    ${JULIA} ${COVERAGE} -e 'using ProtoBuf; using ProtoBuf.Gen; gen()'
else
    ${JULIA} ${COVERAGE} -e 'using ProtoBuf; using ProtoBuf.Gen; gen()' -- ${FLAGS}
fi
