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

# adding dotnet to the path. it is needed to run toolset csc. 
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
dotnet_path=$parent_path/dotnet
export PATH=$PATH:$dotnet_path

usage()
{
    echo "build.sh [ Debug(default) | Release ]"
}

if [ "$1" == "-?" ] || [ "$1" == "-h" ]; then
    usage
	exit
fi

if [ $# -eq 0 ]
  then
    Configuration="Debug"
  else
    Configuration=$1
fi

BuildVersion="e$(date '+%y%m%d')-1"
Version="<default>"
Restore="true"
echo "Configuration=$Configuration."
echo "Restore=$Restore."
echo "Version=$Version."
echo "BuildVersion=$BuildVersion."

if [ ! -d "dotnet" ]; then
  echo "dotnet.exe not installed, downloading and installing."
  if [ "$Version" = "<default>" ]; then 
    Version=$(head -n 1 "DotnetCLIVersion.txt")
  fi
  ./scripts/install-dotnet.sh -Version $Version -InstallDir "dotnet"
  ret=$?
  if [ $ret -ne 0 ]; then
    echo "Failed to install latest dotnet.exe, exit code "$ret", aborting build."
    exit -1
  fi
  ./scripts/install-dotnet.sh -Version 1.0.0 -InstallDir "dotnet"
  ret=$?
  if [ $ret -ne 0 ]; then
    echo "Failed to install framework version 1.0.0, exit code "$ret", aborting build."
    exit -1
  fi
fi

dotnetExePath="dotnet/dotnet"

myFile="corefxlab.sln"

if [ "$Restore" = "true" ]; then
  echo "Restoring all packages"
  ./$dotnetExePath restore $myFile /p:VersionSuffix=$BuildVersion
  ret=$?
  if [ $ret -ne 0 ]; then
    echo "Failed to restore packages."
    exit -1
  fi
fi

echo "Building solution $myFile..."

./$dotnetExePath build $myFile -c $Configuration /p:VersionSuffix=$BuildVersion
ret=$?
if [ $ret -ne 0 ]; then
  echo "Failed to build solution $myFile"
  exit -1
fi

errorsEncountered=0
declare -a projectsFailed

while read testFile;
do
  if [[ $testFile == *"System.IO.Compression.Tests"* ]]; then
    echo "Skipping tests in $testFile. Cannot build the brotli dll yet."
    continue
  fi
  echo "Building and running tests for project $testFile..."
  ./$dotnetExePath test $testFile -c $Configuration --no-build -- -notrait category=performance -notrait category=outerloop
  ret=$?
  if [ $ret -ne 0 ]; then
    echo "Some tests failed in project $testFile"
    projectsFailed[${#projectsFailed[@]}]="$testFile"
	((errorsEncountered=errorsEncountered+1))
  fi
done < <(find tests -name "*.csproj")

RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'

if [ $errorsEncountered -ne 0 ]; then
  echo -e "${RED}** Build failed. $errorsEncountered projects failed to build or test. **${NC}"
  for i in "${projectsFailed[@]}"
  do
   echo -e "${RED}    $i${NC}"
  done
else
  echo -e "${GREEN}** Build succeeded. **${NC}"
fi

exit $errorsEncountered<commit_msg>Fixing quote usage in script (#1596)<commit_after>#!/usr/bin/env bash

# adding dotnet to the path. it is needed to run toolset csc. 
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
dotnet_path=$parent_path/dotnet
export PATH=$PATH:$dotnet_path

usage()
{
    echo "build.sh [ Debug(default) | Release ]"
}

if [ "$1" == "-?" ] || [ "$1" == "-h" ]; then
    usage
	exit
fi

if [ $# -eq 0 ]
  then
    Configuration="Debug"
  else
    Configuration=$1
fi

BuildVersion="e$(date '+%y%m%d')-1"
Version="<default>"
Restore="true"
echo "Configuration=$Configuration."
echo "Restore=$Restore."
echo "Version=$Version."
echo "BuildVersion=$BuildVersion."

if [ ! -d "dotnet" ]; then
  echo "dotnet.exe not installed, downloading and installing."
  if [ "$Version" = "<default>" ]; then 
    Version=$(head -n 1 "DotnetCLIVersion.txt")
  fi
  ./scripts/install-dotnet.sh -Version "$Version" -InstallDir "dotnet"
  ret=$?
  if [ $ret -ne 0 ]; then
    echo "Failed to install latest dotnet.exe, exit code $ret, aborting build."
    exit -1
  fi
  ./scripts/install-dotnet.sh -Version 1.0.0 -InstallDir "dotnet"
  ret=$?
  if [ $ret -ne 0 ]; then
    echo "Failed to install framework version 1.0.0, exit code $ret, aborting build."
    exit -1
  fi
fi

dotnetExePath="dotnet/dotnet"

myFile="corefxlab.sln"

if [ "$Restore" = "true" ]; then
  echo "Restoring all packages"
  ./$dotnetExePath restore $myFile /p:VersionSuffix="$BuildVersion"
  ret=$?
  if [ $ret -ne 0 ]; then
    echo "Failed to restore packages."
    exit -1
  fi
fi

echo "Building solution $myFile..."

./$dotnetExePath build $myFile -c "$Configuration" /p:VersionSuffix="$BuildVersion"
ret=$?
if [ $ret -ne 0 ]; then
  echo "Failed to build solution $myFile"
  exit -1
fi

errorsEncountered=0
declare -a projectsFailed

while read -r testFile;
do
  if [[ $testFile == *"System.IO.Compression.Tests"* ]]; then
    echo "Skipping tests in $testFile. Cannot build the brotli dll yet."
    continue
  fi
  echo "Building and running tests for project $testFile..."
  ./$dotnetExePath test "$testFile" -c "$Configuration" --no-build -- -notrait category=performance -notrait category=outerloop
  ret=$?
  if [ $ret -ne 0 ]; then
    echo "Some tests failed in project $testFile"
    projectsFailed[${#projectsFailed[@]}]="$testFile"
	((errorsEncountered=errorsEncountered+1))
  fi
done < <(find tests -name "*.csproj")

RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'

if [ $errorsEncountered -ne 0 ]; then
  echo -e "${RED}** Build failed. $errorsEncountered projects failed to build or test. **${NC}"
  for i in "${projectsFailed[@]}"
  do
   echo -e "${RED}    $i${NC}"
  done
else
  echo -e "${GREEN}** Build succeeded. **${NC}"
fi

exit $errorsEncountered
{'fraction_non_alphanumeric': 0.16169429097605892, 'fraction_numerical': 0.01583793738489871, 'mean_word_length': 3.681896551724138, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7495374', 'n_tokens_mistral': 1975, 'n_tokens_neox': 1900, 'n_words': 581}