<commit_before>#!/bin/bash

set -e

echo
echo Preparing symbolic links for WebRTC...
echo

BUILD_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/build/
BORINGSSL_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/boringssl/src/
COLORAMA_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/colorama/src/
JSONCPP_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/jsoncpp/source/
LIBJPEG_TURBO_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/libjpeg_turbo/

LIBSRTP_TURBO_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/libsrtp/
LIBVPX_TURBO_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/libvpx_new/source/libvpx/
LIBYUV_TURBO_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/libyuv/
OPENMAX_TURBO_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/openmax_dl/
OPUS_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/opus/src/

USRSCTP_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/usrsctp/usrsctplib/
PATCHED_YASM_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/yasm/source/patched-yasm/
YASM_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/yasm/binaries/
GYP_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/tools/gyp/
GTEST_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/testing/gtest/

GFLAGS_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/gflags/src/
GMOCK_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/testing/gmock/

SRC_FILES_PATH=./chromium/src
SRC_FILES_DESTINATION=../webrtc/chromium/src/

NINJA_PATH=../../bin/ninja/
NINJA_PATH_TO_REPLACE_WITH=""
NINJA_URL="http://github.com/martine/ninja/releases/download/v1.6.0/ninja-mac.zip"
NINJA_ZIP_FILE="ninja-mac.zip"

PROJECT_FILE=all.ninja.xcworkspace
PROJECT_MAC_FILE=all_osx.xcodeproj
PROJECT_IOS_FILE=all_ios.xcodeproj

OUTPUT_IOS=out_ios
OUTPUT_MAC=out_mac


setNinjaPathForWrappers()
{
	if  hash ninja 2>/dev/null; then
		echo "Ninja is present in the PATH"
		NINJA_PATH_TO_REPLACE_WITH="$(which ninja)"
		NINJA_PATH_TO_REPLACE_WITH=${NINJA_PATH_TO_REPLACE_WITH%/ninja}
	else
		NINJA_PATH_TO_REPLACE_WITH="..\/..\/..\/..\/..\/bin\/ninja"
	fi
	
	echo Ninja path is $NINJA_PATH_TO_REPLACE_WITH
	
	#WEBRTC_WRAPPER_IOS_PATH=../../ios/projects/xcode/webrtcWrappers/webrtcWrapper_ios/webrtcWrapper_ios.xcodeproj/project.pbxproj
	#WEBRTC_WRAPPER_MAC_PATH=../../ios/projects/xcode/webrtcWrappers/webrtcWrapper_mac/webrtcWrapper_mac.xcodeproj/project.pbxproj

	WEBRTC_WRAPPER_IOS_PATH=../../ios/projects/xcode/webrtcWrappers/webrtcWrapper_ios/webrtcWrapper_ios.xcodeproj/
	WEBRTC_WRAPPER_MAC_PATH=../../ios/projects/xcode/webrtcWrappers/webrtcWrapper_mac/webrtcWrapper_mac.xcodeproj/
	
	if ! grep -q $NINJA_PATH_TO_REPLACE_WITH "${WEBRTC_WRAPPER_IOS_PATH}project.pbxproj"; then
		pushd $WEBRTC_WRAPPER_IOS_PATH
		sed -i -e "s~PATH=~PATH=$NINJA_PATH_TO_REPLACE_WITH:~g" project.pbxproj
		git update-index --assume-unchanged project.pbxproj
		popd
		#sed -i -e "s~PATH=~PATH=$NINJA_PATH_TO_REPLACE_WITH:~g" "$WEBRTC_WRAPPER_IOS_PATH"
		#git update-index --assume-unchanged "$WEBRTC_WRAPPER_IOS_PATH"
	fi
	
	if ! grep -q $NINJA_PATH_TO_REPLACE_WITH "${WEBRTC_WRAPPER_MAC_PATH}project.pbxproj"; then
		pushd $WEBRTC_WRAPPER_MAC_PATH
		sed -i -e "s~PATH=~PATH=$NINJA_PATH_TO_REPLACE_WITH:~g" project.pbxproj
		git update-index --assume-unchanged project.pbxproj
		popd
		#sed -i -e "s~PATH=~PATH=$NINJA_PATH_TO_REPLACE_WITH:~g" "$WEBRTC_WRAPPER_MAC_PATH"
		#git update-index --assume-unchanged "$WEBRTC_WRAPPER_MAC_PATH"
	fi
}
setNinja()
{
	echo Start

	if  hash ninja 2>/dev/null; then
		echo "Ninja is present in the PATH"
		EXISTING_NINJA_PATH="$(which ninja)"
		
	else
		if [ -f "$NINJA_PATH/ninja" ]; then
			echo "Ninja already installed"
			NINJA_PATH_TO_REPLACE_WITH="..\/..\/bin\/ninja"
			echo ninja path: $NINJA_PATH_TO_REPLACE_WITH
		else
			echo  $PWD
			echo "Downloading ninja"
			mkdir -p $NINJA_PATH                        		&& \
			pushd $NINJA_PATH                          		&& \
			curl -L0k $NINJA_URL >  $NINJA_ZIP_FILE			&& \
			unzip $NINJA_ZIP_FILE                       && \
			rm $NINJA_ZIP_FILE
			popd
			NINJA_PATH_TO_REPLACE_WITH="..\/..\/bin\/ninja"
			echo ninja path: $NINJA_PATH_TO_REPLACE_WITH
		fi
	fi
}

copyFolder()
{
	SOURCE=$1
	TARGET=$2

	if [[ -n $SOURCE && -n $TARGET ]]; then
		if [ -d $SOURCE ]; then
			echo "Copying $SOURCE to $TARGET"
			mkdir -p $TARGET && cp -r $SOURCE $TARGET
		else
			echo "ERROR (copyFolder): Folder $SOURCE doesn't exist."
		fi
	else
		echo "ERROR (copyFolder): Missing source and destination folders"
	fi
}
makeFolderStructure()
{
	echo Creating folder structure

	#copyFolder ../webrtc-deps/build/ $BUILD_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/boringssl/ $BORINGSSL_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/colorama/ $COLORAMA_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/jsoncpp/ $JSONCPP_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/libjpeg_turbo/ $LIBJPEG_TURBO_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/libsrtp/ $LIBSRTP_TURBO_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/libvpx/ $LIBVPX_TURBO_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/libyuv/ $LIBYUV_TURBO_FOLDER_CHROMIUM_DESTINATION
  copyFolder ../webrtc-deps/openmax/ $OPENMAX_TURBO_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/openmax/ $OPENMAX_TURBO_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/opus/ $OPUS_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/usrsctp/ $USRSCTP_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/patched-yasm/ $PATCHED_YASM_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/yasm/ $YASM_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/gyp/ $GYP_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/googletest/ $GTEST_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/gflags/ $GFLAGS_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/gmock/ $GMOCK_FOLDER_CHROMIUM_DESTINATION<commit_msg>- removed duplicate copy<commit_after>#!/bin/bash

set -e

echo
echo Preparing symbolic links for WebRTC...
echo

BUILD_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/build/
BORINGSSL_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/boringssl/src/
COLORAMA_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/colorama/src/
JSONCPP_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/jsoncpp/source/
LIBJPEG_TURBO_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/libjpeg_turbo/

LIBSRTP_TURBO_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/libsrtp/
LIBVPX_TURBO_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/libvpx_new/source/libvpx/
LIBYUV_TURBO_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/libyuv/
OPENMAX_TURBO_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/openmax_dl/
OPUS_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/opus/src/

USRSCTP_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/usrsctp/usrsctplib/
PATCHED_YASM_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/yasm/source/patched-yasm/
YASM_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/yasm/binaries/
GYP_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/tools/gyp/
GTEST_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/testing/gtest/

GFLAGS_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/gflags/src/
GMOCK_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/testing/gmock/

SRC_FILES_PATH=./chromium/src
SRC_FILES_DESTINATION=../webrtc/chromium/src/

NINJA_PATH=../../bin/ninja/
NINJA_PATH_TO_REPLACE_WITH=""
NINJA_URL="http://github.com/martine/ninja/releases/download/v1.6.0/ninja-mac.zip"
NINJA_ZIP_FILE="ninja-mac.zip"

PROJECT_FILE=all.ninja.xcworkspace
PROJECT_MAC_FILE=all_osx.xcodeproj
PROJECT_IOS_FILE=all_ios.xcodeproj

OUTPUT_IOS=out_ios
OUTPUT_MAC=out_mac


setNinjaPathForWrappers()
{
	if  hash ninja 2>/dev/null; then
		echo "Ninja is present in the PATH"
		NINJA_PATH_TO_REPLACE_WITH="$(which ninja)"
		NINJA_PATH_TO_REPLACE_WITH=${NINJA_PATH_TO_REPLACE_WITH%/ninja}
	else
		NINJA_PATH_TO_REPLACE_WITH="..\/..\/..\/..\/..\/bin\/ninja"
	fi
	
	echo Ninja path is $NINJA_PATH_TO_REPLACE_WITH
	
	#WEBRTC_WRAPPER_IOS_PATH=../../ios/projects/xcode/webrtcWrappers/webrtcWrapper_ios/webrtcWrapper_ios.xcodeproj/project.pbxproj
	#WEBRTC_WRAPPER_MAC_PATH=../../ios/projects/xcode/webrtcWrappers/webrtcWrapper_mac/webrtcWrapper_mac.xcodeproj/project.pbxproj

	WEBRTC_WRAPPER_IOS_PATH=../../ios/projects/xcode/webrtcWrappers/webrtcWrapper_ios/webrtcWrapper_ios.xcodeproj/
	WEBRTC_WRAPPER_MAC_PATH=../../ios/projects/xcode/webrtcWrappers/webrtcWrapper_mac/webrtcWrapper_mac.xcodeproj/
	
	if ! grep -q $NINJA_PATH_TO_REPLACE_WITH "${WEBRTC_WRAPPER_IOS_PATH}project.pbxproj"; then
		pushd $WEBRTC_WRAPPER_IOS_PATH
		sed -i -e "s~PATH=~PATH=$NINJA_PATH_TO_REPLACE_WITH:~g" project.pbxproj
		git update-index --assume-unchanged project.pbxproj
		popd
		#sed -i -e "s~PATH=~PATH=$NINJA_PATH_TO_REPLACE_WITH:~g" "$WEBRTC_WRAPPER_IOS_PATH"
		#git update-index --assume-unchanged "$WEBRTC_WRAPPER_IOS_PATH"
	fi
	
	if ! grep -q $NINJA_PATH_TO_REPLACE_WITH "${WEBRTC_WRAPPER_MAC_PATH}project.pbxproj"; then
		pushd $WEBRTC_WRAPPER_MAC_PATH
		sed -i -e "s~PATH=~PATH=$NINJA_PATH_TO_REPLACE_WITH:~g" project.pbxproj
		git update-index --assume-unchanged project.pbxproj
		popd
		#sed -i -e "s~PATH=~PATH=$NINJA_PATH_TO_REPLACE_WITH:~g" "$WEBRTC_WRAPPER_MAC_PATH"
		#git update-index --assume-unchanged "$WEBRTC_WRAPPER_MAC_PATH"
	fi
}
setNinja()
{
	echo Start

	if  hash ninja 2>/dev/null; then
		echo "Ninja is present in the PATH"
		EXISTING_NINJA_PATH="$(which ninja)"
		
	else
		if [ -f "$NINJA_PATH/ninja" ]; then
			echo "Ninja already installed"
			NINJA_PATH_TO_REPLACE_WITH="..\/..\/bin\/ninja"
			echo ninja path: $NINJA_PATH_TO_REPLACE_WITH
		else
			echo  $PWD
			echo "Downloading ninja"
			mkdir -p $NINJA_PATH                        		&& \
			pushd $NINJA_PATH                          		&& \
			curl -L0k $NINJA_URL >  $NINJA_ZIP_FILE			&& \
			unzip $NINJA_ZIP_FILE                       && \
			rm $NINJA_ZIP_FILE
			popd
			NINJA_PATH_TO_REPLACE_WITH="..\/..\/bin\/ninja"
			echo ninja path: $NINJA_PATH_TO_REPLACE_WITH
		fi
	fi
}

copyFolder()
{
	SOURCE=$1
	TARGET=$2

	if [[ -n $SOURCE && -n $TARGET ]]; then
		if [ -d $SOURCE ]; then
			echo "Copying $SOURCE to $TARGET"
			mkdir -p $TARGET && cp -r $SOURCE $TARGET
		else
			echo "ERROR (copyFolder): Folder $SOURCE doesn't exist."
		fi
	else
		echo "ERROR (copyFolder): Missing source and destination folders"
	fi
}
makeFolderStructure()
{
	echo Creating folder structure

	#copyFolder ../webrtc-deps/build/ $BUILD_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/boringssl/ $BORINGSSL_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/colorama/ $COLORAMA_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/jsoncpp/ $JSONCPP_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/libjpeg_turbo/ $LIBJPEG_TURBO_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/libsrtp/ $LIBSRTP_TURBO_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/libvpx/ $LIBVPX_TURBO_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/libyuv/ $LIBYUV_TURBO_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/openmax/ $OPENMAX_TURBO_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/opus/ $OPUS_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/usrsctp/ $USRSCTP_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/patched-yasm/ $PATCHED_YASM_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/yasm/ $YASM_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/gyp/ $GYP_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/googletest/ $GTEST_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/gflags/ $GFLAGS_FOLDER_CHROMIUM_DESTINATION
	copyFolder ../webrtc-deps/gmock/ $GMOCK_FOLDER_CHROMIUM_DESTINATION
{'fraction_non_alphanumeric': 0.11551566525388515, 'fraction_numerical': 0.0013296767223468795, 'mean_word_length': 5.029058116232465, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4693609', 'n_tokens_mistral': 5769, 'n_tokens_neox': 5364, 'n_words': 567}