<commit_before>#!/bin/bash

# URLS

TT_SWIFTENV_URL="https://github.com/kylef/swiftenv.git"
TT_GCD_URL="https://github.com/apple/swift-corelibs-libdispatch.git"

#TT_GCD_SWIFT3_BRANCH=experimental/foundation
#TT_GCD_SWIFT22_1404_HASH=65330e06d9bbf75a4c6ddc349548536746845059
TT_GCD_SWIFT3_BRANCH=master
TT_GCD_SWIFT22_1404_HASH=master

# swiftenv

git clone --depth 1 ${TT_SWIFTENV_URL} ~/.swiftenv

export SWIFTENV_ROOT="$HOME/.swiftenv"
export PATH="${SWIFTENV_ROOT}/bin:${SWIFTENV_ROOT}/shims:$PATH"


# Install Swift

swiftenv install ${SWIFT_SNAPSHOT_NAME}

if [ `which swift` ]; then
    echo "Installed Swift: `which swift`"
else
    echo "Failed to install Swift?"
    exit 42
fi
swift --version


# Environment

TT_SWIFT_BINARY=`swiftenv which swift`
TT_SNAP_DIR=`echo $TT_SWIFT_BINARY | sed "s|/usr/bin/swift||g"`


# Install GCD

if [[ "$TRAVIS_OS_NAME" == "Linux" ]]; then
  IS_SWIFT_22=`swift --version|grep 2.2|wc -l|sed s/1/yes/|sed s/0/no/`
  
  git clone --recursive ${TT_GCD_URL} gcd-${SWIFT_SNAPSHOT_NAME}
  cd gcd-${SWIFT_SNAPSHOT_NAME}

  if [[ $IS_SWIFT22 = "no" ]]; then
    git checkout ${TT_GCD_SWIFT3_BRANCH}
  else
    git checkout ${TT_GCD_SWIFT22_1404_HASH}
  fi
  
  mkdir ~/swift-not-so-much
  ln -s ${TT_SNAP_DIR} ~/swift-not-so-much/latest
  
  export CC=clang
  ./autogen.sh
  ./configure --with-swift-toolchain=${TT_SNAP_DIR}/usr --prefix=${TT_SNAP_DIR}/usr
  echo "PWD"
  pwd
  #cd src && dtrace -h -s provider.d && cd ..
  cp xcconfig/trusty-provider.d gcd-${SWIFT_SNAPSHOT_NAME}/src
  cat Makefile
  make all
  make install
fi

if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
  echo ${TT_SWIFT_BINARY}
fi
<commit_msg>Find dispatch<commit_after>#!/bin/bash

# URLS

TT_SWIFTENV_URL="https://github.com/kylef/swiftenv.git"
TT_GCD_URL="https://github.com/apple/swift-corelibs-libdispatch.git"

#TT_GCD_SWIFT3_BRANCH=experimental/foundation
#TT_GCD_SWIFT22_1404_HASH=65330e06d9bbf75a4c6ddc349548536746845059
TT_GCD_SWIFT3_BRANCH=master
TT_GCD_SWIFT22_1404_HASH=master

# swiftenv

git clone --depth 1 ${TT_SWIFTENV_URL} ~/.swiftenv

export SWIFTENV_ROOT="$HOME/.swiftenv"
export PATH="${SWIFTENV_ROOT}/bin:${SWIFTENV_ROOT}/shims:$PATH"


# Install Swift

swiftenv install ${SWIFT_SNAPSHOT_NAME}

if [ `which swift` ]; then
    echo "Installed Swift: `which swift`"
else
    echo "Failed to install Swift?"
    exit 42
fi
swift --version


# Environment

TT_SWIFT_BINARY=`swiftenv which swift`
TT_SNAP_DIR=`echo $TT_SWIFT_BINARY | sed "s|/usr/bin/swift||g"`


# Install GCD

if [[ "$TRAVIS_OS_NAME" == "Linux" ]]; then
  IS_SWIFT_22=`swift --version|grep 2.2|wc -l|sed s/1/yes/|sed s/0/no/`
  
  git clone --recursive ${TT_GCD_URL} gcd-${SWIFT_SNAPSHOT_NAME}
  cd gcd-${SWIFT_SNAPSHOT_NAME}

  if [[ $IS_SWIFT22 = "no" ]]; then
    git checkout ${TT_GCD_SWIFT3_BRANCH}
  else
    git checkout ${TT_GCD_SWIFT22_1404_HASH}
  fi
  
  mkdir ~/swift-not-so-much
  ln -s ${TT_SNAP_DIR} ~/swift-not-so-much/latest
  
  export CC=clang
  ./autogen.sh
  ./configure --with-swift-toolchain=${TT_SNAP_DIR}/usr --prefix=${TT_SNAP_DIR}/usr
  echo "PWD"
  pwd
  #cd src && dtrace -h -s provider.d && cd ..
  cp xcconfig/trusty-provider.d gcd-${SWIFT_SNAPSHOT_NAME}/src
  #cat Makefile
  make all
  make install
  
  find ~ -name "*dispatch*"
fi

if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
  echo ${TT_SWIFT_BINARY}
fi

{'fraction_non_alphanumeric': 0.14144144144144144, 'fraction_numerical': 0.037237237237237236, 'mean_word_length': 4.372580645161291, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '1314724', 'n_tokens_mistral': 1574, 'n_tokens_neox': 1459, 'n_words': 248}