<commit_before>#!/usr/bin/env bash

set -e

export EXTRA_STACK="--no-haddock-deps"

if [[ ("$TRAVIS_OS_NAME" == "linux") && ("$TRAVIS_BRANCH" == "master") ]];
  then with_haddock=true
  else with_haddock=false
fi

if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
    if [[ "$with_haddock" == "true" ]]; then
      # export EXTRA_STACK="--haddock";

      # We need to pass CONFIG=wallet to compile cardano-sl-core, but Stack doesn't
      # support passing arguments to Haddock yet (this will be fixed in the next
      # release after 1.4.0). For now, a workaround is to manually replace CONFIG
      # with "wallet" in *.hs files.
      #
      # When new Stack is released, delete this and add an argument to Stack:
      #    --haddock-arguments="--optghc=-DCONFIG=wallet"
      find core/ -name '*.hs' -exec sed -i 's/defined(CONFIG)/1/g' {} +
      find core/ -name '*.hs' -exec sed -i 's/QUOTED(CONFIG)/"'$DCONFIG'"/g' {} +
    fi

    export EXTRA_STACK="--test $EXTRA_STACK";
fi

if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
  export EXTRA_STACK="--flag cardano-sl-tools:for-installer $EXTRA_STACK"
fi

stack --nix --no-terminal install happy \
  $EXTRA_STACK --fast --ghc-options="-j +RTS -A128m -n2m -RTS" --jobs=4

# We need to pass CONFIG=wallet to compile cardano-sl-core, but Stack doesn't
# support passing arguments to Haddock yet (this will be fixed in the next
# release after 1.4.0). For now, a workaround is to manually replace CONFIG
# with "wallet" in *.hs files.
#
# When new Stack is released, delete this and add an argument to Stack:
#    --haddock-arguments="--optghc=-DCONFIG=wallet"
if [[ "$with_haddock" == "true" ]]; then
  find core/ -name '*.hs' -exec sed -i 's/defined(CONFIG)/1/g' {} +
  find core/ -name '*.hs' -exec sed -i 's/QUOTED(CONFIG)/"'$DCONFIG'"/g' {} +
fi

targets="cardano-sl cardano-sl-lwallet cardano-sl-tools"

for trgt in $targets; do

    stack --nix --no-terminal --local-bin-path daedalus/ install "$trgt" \
      $EXTRA_STACK --fast --jobs=2 \
      --ghc-options="-j -DCONFIG=$DCONFIG +RTS -A128m -n2m -RTS" \
      --flag cardano-sl-core:-asserts \
      --flag cardano-sl-core:-dev-mode

done<commit_msg>[DEVOPS-204] Remove happy as it's provided with Nix<commit_after>#!/usr/bin/env bash

set -e

export EXTRA_STACK="--no-haddock-deps"

if [[ ("$TRAVIS_OS_NAME" == "linux") && ("$TRAVIS_BRANCH" == "master") ]];
  then with_haddock=true
  else with_haddock=false
fi

if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
    if [[ "$with_haddock" == "true" ]]; then
      # export EXTRA_STACK="--haddock";

      # We need to pass CONFIG=wallet to compile cardano-sl-core, but Stack doesn't
      # support passing arguments to Haddock yet (this will be fixed in the next
      # release after 1.4.0). For now, a workaround is to manually replace CONFIG
      # with "wallet" in *.hs files.
      #
      # When new Stack is released, delete this and add an argument to Stack:
      #    --haddock-arguments="--optghc=-DCONFIG=wallet"
      find core/ -name '*.hs' -exec sed -i 's/defined(CONFIG)/1/g' {} +
      find core/ -name '*.hs' -exec sed -i 's/QUOTED(CONFIG)/"'$DCONFIG'"/g' {} +
    fi

    export EXTRA_STACK="--test $EXTRA_STACK";
fi

if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
  export EXTRA_STACK="--flag cardano-sl-tools:for-installer $EXTRA_STACK"
fi

# We need to pass CONFIG=wallet to compile cardano-sl-core, but Stack doesn't
# support passing arguments to Haddock yet (this will be fixed in the next
# release after 1.4.0). For now, a workaround is to manually replace CONFIG
# with "wallet" in *.hs files.
#
# When new Stack is released, delete this and add an argument to Stack:
#    --haddock-arguments="--optghc=-DCONFIG=wallet"
if [[ "$with_haddock" == "true" ]]; then
  find core/ -name '*.hs' -exec sed -i 's/defined(CONFIG)/1/g' {} +
  find core/ -name '*.hs' -exec sed -i 's/QUOTED(CONFIG)/"'$DCONFIG'"/g' {} +
fi

targets="cardano-sl cardano-sl-lwallet cardano-sl-tools"

for trgt in $targets; do

    stack --nix --no-terminal --local-bin-path daedalus/ install "$trgt" \
      $EXTRA_STACK --fast --jobs=2 \
      --ghc-options="-j -DCONFIG=$DCONFIG +RTS -A128m -n2m -RTS" \
      --flag cardano-sl-core:-asserts \
      --flag cardano-sl-core:-dev-mode

done
{'fraction_non_alphanumeric': 0.16182376565083864, 'fraction_numerical': 0.008032128514056224, 'mean_word_length': 3.0285442435775454, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6677985', 'n_tokens_mistral': 1582, 'n_tokens_neox': 1543, 'n_words': 451}