<commit_before>#!/bin/bash

source /data/src/docker/joynr-base/scripts/global.sh

GCOV='OFF'
ENABLE_CLANG_FORMATTER='ON'
BUILD_TESTS='ON'
ADDITIONAL_CMAKE_ARGS=''

function usage
{
    echo "usage: cpp-clean-build.sh [--gcov ON|OFF --jobs X \
    --enableclangformatter ON|OFF --buildtests ON|OFF --additionalcmakeargs <args>]"
    echo "default gcov is $GCOV, jobs is $JOBS, additionalcmakeargs is \
    $ADDITIONAL_CMAKE_ARGS"
}

while [ "$1" != "" ]; do
    case $1 in
        --gcov )                 shift
                                 GCOV=$1
                                 ;;
        --jobs )                 shift
                                 JOBS=$1
                                 ;;
        --enableclangformatter ) shift
                                 ENABLE_CLANG_FORMATTER=$1
                                 ;;
        --buildtests )           shift
                                 BUILD_TESTS=$1
                                 ;;
        --additionalcmakeargs )  shift
                                 ADDITIONAL_CMAKE_ARGS=$1
                                 ;;
        * )                      usage
                                 exit 1
    esac
    shift
done

log "CPP CLEAN BUILD GCOV: $GCOV JOBS: $JOBS"

log "Enable core dumps"
ulimit -c unlimited

START=$(date +%s)


log "ENVIRONMENT"
env
echo "ADDITIONAL_CMAKE_ARGS is $ADDITIONAL_CMAKE_ARGS"

log "CLEAN BUILD DIRECTORY"
rm -rf ~/.cmake/packages
rm -rf /data/build/joynr
mkdir -p /data/build/joynr

cd /data/build/joynr

log "RUN CMAKE"

# fail on first error
set -e -x
cmake -DENABLE_GCOV=$GCOV \
      -DPYTHON_EXECUTABLE=/usr/bin/python \
      -DJOYNR_SERVER=localhost:8080 \
      -DCMAKE_BUILD_TYPE=Debug \<commit_msg>[Build] Optionally specify BUILD_TYPE when building C++ in docker.<commit_after>#!/bin/bash

source /data/src/docker/joynr-base/scripts/global.sh

GCOV='OFF'
ENABLE_CLANG_FORMATTER='ON'
BUILD_TESTS='ON'
ADDITIONAL_CMAKE_ARGS=''
BUILD_TYPE='DEBUG'

function usage
{
    echo "usage: cpp-clean-build.sh
            --jobs X
            --enableclangformatter ON|OFF
            --buildtests ON|OFF
            [--buildtype [DEBUG|RELEASE|RELWITHDEBINFO|MINSIZEREL] <default: DEBUG>]
            [--gcov ON|OFF <default: OFF>]
            [--additionalcmakeargs <args> <default: "">]"
}

while [ "$1" != "" ]; do
    case $1 in
        --gcov )                 shift
                                 GCOV=$1
                                 ;;
        --jobs )                 shift
                                 JOBS=$1
                                 ;;
        --enableclangformatter ) shift
                                 ENABLE_CLANG_FORMATTER=$1
                                 ;;
        --buildtests )           shift
                                 BUILD_TESTS=$1
                                 ;;
        --buildtype )            shift
                                 BUILD_TYPE=$1
                                 ;;
        --additionalcmakeargs )  shift
                                 ADDITIONAL_CMAKE_ARGS=$1
                                 ;;
        * )                      usage
                                 exit 1
    esac
    shift
done

log "CPP CLEAN BUILD GCOV: $GCOV JOBS: $JOBS"

log "Enable core dumps"
ulimit -c unlimited

START=$(date +%s)


log "ENVIRONMENT"
env
echo "ADDITIONAL_CMAKE_ARGS is $ADDITIONAL_CMAKE_ARGS"

log "CLEAN BUILD DIRECTORY"
rm -rf ~/.cmake/packages
rm -rf /data/build/joynr
mkdir -p /data/build/joynr

cd /data/build/joynr

log "RUN CMAKE"

# fail on first error
set -e -x
cmake -DENABLE_GCOV=$GCOV \
      -DPYTHON_EXECUTABLE=/usr/bin/python \
      -DJOYNR_SERVER=localhost:8080 \
      -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
{'fraction_non_alphanumeric': 0.09900188831939574, 'fraction_numerical': 0.006743997841920691, 'mean_word_length': 1.2748466257668711, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4225691', 'n_tokens_mistral': 1190, 'n_tokens_neox': 1096, 'n_words': 236}