<commit_before>#!/bin/bash
#
# Build Olympus after updating version string and deploy

# Various files that we edit
#SDK_COMMON_HEADER=RestCommClient/Classes/common.h
#OLYMPUS_UTILS=Examples/restcomm-olympus/restcomm-olympus/Utils.m
#OLYMPUS_PLIST=Examples/restcomm-olympus/restcomm-olympus/restcomm-olympus-Info.plist
#OLYMPUS_MAIN_ACTIVITY=Examples/restcomm-olympus/restcomm-olympus/AppDelegate.m

# For starters lets only create keychains in travis, since locally everything is setup already. But ultimately, we should create a separate new keychain locally to so that we can test that better
echo "-- TRAVIS: $TRAVIS"

# Decrypting certs and profiles (not sure if profiles actually need to be encrypted, but this is how others did it so I'm following the same route just to be on the safe side)
echo "-- Setting up signing"
echo "-- Decrypting keys, etc"
echo "-- Setting up keychain"

echo "-- Installing provisioning profiles, so that XCode can find them"


if [ ! -z "$TRAVIS" ]
then
	export ORG_GRADLE_PROJECT_VERSION_CODE=$TRAVIS_BUILD_NUMBER
fi

if [ -z "$ORG_GRADLE_PROJECT_VERSION_CODE" ] || [ -z "$ORG_GRADLE_PROJECT_VERSION_NAME" ]
then
	echo "-- Error: ORG_GRADLE_PROJECT_VERSION_CODE and ORG_GRADLE_PROJECT_VERSION_NAME need to be set"
	exit 1
fi

echo -e "-- Using versionName: $ORG_GRADLE_PROJECT_VERSION_NAME"
echo -e "-- Using versionCode: $ORG_GRADLE_PROJECT_VERSION_CODE"

echo "-- Updating git commit hash for Olympus About screen"
#sed -i '' "s/#GIT-HASH/$COMMIT_SHA1/" $OLYMPUS_UTILS 

# Build and upload to TF
echo "-- Building Olympus and uploading to TestFairy"
if [ -z "$SKIP_TF_UPLOAD" ] || [[ "$SKIP_TF_UPLOAD" == "false" ]]
then
	# Skip the signArchives task until we properly setup Travis for signing + upload of archives to Sonatype. Otherwise the build breaks
	cd Examples/restcomm-olympus && ./gradlew -x signArchives -i -PtestfairyChangelog="Version: $ORG_GRADLE_PROJECT_VERSION_NAME+$ORG_GRADLE_PROJECT_VERSION_CODE, GitHub commit: $COMMIT_SHA1" testfairyDebug
	cd ../..
else
	echo "-- Skipping upload to Test Fairy."
	cd Examples/restcomm-olympus && ./gradlew assemble   # -PVERSION_CODE=$TRAVIS_BUILD_NUMBER -PVERSION_NAME=$VERSION_NAME
	cd ../..
fi

# Clean up
#echo "-- Cleaning up"

#echo "-- Deintegrating olympus pods"

#echo "-- Rolling back changes in source files: $SDK_COMMON_HEADER, $OLYMPUS_UTILS, $OLYMPUS_PLIST"
#git checkout -- $SDK_COMMON_HEADER $OLYMPUS_UTILS $OLYMPUS_PLIST $OLYMPUS_APP_DELEGATE

#echo "-- Setting original keychain, \"$ORIGINAL_KEYCHAIN\", as default"<commit_msg>Fixed build issue in Travis CI for signArchives task<commit_after>#!/bin/bash
#
# Build Olympus after updating version string and deploy

# Various files that we edit
#SDK_COMMON_HEADER=RestCommClient/Classes/common.h
#OLYMPUS_UTILS=Examples/restcomm-olympus/restcomm-olympus/Utils.m
#OLYMPUS_PLIST=Examples/restcomm-olympus/restcomm-olympus/restcomm-olympus-Info.plist
#OLYMPUS_MAIN_ACTIVITY=Examples/restcomm-olympus/restcomm-olympus/AppDelegate.m

# For starters lets only create keychains in travis, since locally everything is setup already. But ultimately, we should create a separate new keychain locally to so that we can test that better
echo "-- TRAVIS: $TRAVIS"

# Decrypting certs and profiles (not sure if profiles actually need to be encrypted, but this is how others did it so I'm following the same route just to be on the safe side)
echo "-- Setting up signing"
echo "-- Decrypting keys, etc"
echo "-- Setting up keychain"

echo "-- Installing provisioning profiles, so that XCode can find them"


if [ ! -z "$TRAVIS" ]
then
	export ORG_GRADLE_PROJECT_VERSION_CODE=$TRAVIS_BUILD_NUMBER
fi

if [ -z "$ORG_GRADLE_PROJECT_VERSION_CODE" ] || [ -z "$ORG_GRADLE_PROJECT_VERSION_NAME" ]
then
	echo "-- Error: ORG_GRADLE_PROJECT_VERSION_CODE and ORG_GRADLE_PROJECT_VERSION_NAME need to be set"
	exit 1
fi

echo -e "-- Using versionName: $ORG_GRADLE_PROJECT_VERSION_NAME"
echo -e "-- Using versionCode: $ORG_GRADLE_PROJECT_VERSION_CODE"

echo "-- Updating git commit hash for Olympus About screen"
#sed -i '' "s/#GIT-HASH/$COMMIT_SHA1/" $OLYMPUS_UTILS 

# Build and upload to TF
echo "-- Building Olympus and uploading to TestFairy"
if [ -z "$SKIP_TF_UPLOAD" ] || [[ "$SKIP_TF_UPLOAD" == "false" ]]
then
	# Skip the signArchives task until we properly setup Travis for signing + upload of archives to Sonatype. Otherwise the build breaks
	cd Examples/restcomm-olympus && ./gradlew -x signArchives -i -PtestfairyChangelog="Version: $ORG_GRADLE_PROJECT_VERSION_NAME+$ORG_GRADLE_PROJECT_VERSION_CODE, GitHub commit: $COMMIT_SHA1" testfairyDebug
	cd ../..
else
	echo "-- Skipping upload to Test Fairy."
	# Skip the signArchives task until we properly setup Travis for signing + upload of archives to Sonatype. Otherwise the build breaks
	cd Examples/restcomm-olympus && ./gradlew -x signArchives assemble   # -PVERSION_CODE=$TRAVIS_BUILD_NUMBER -PVERSION_NAME=$VERSION_NAME
	cd ../..
fi

# Clean up
#echo "-- Cleaning up"

#echo "-- Deintegrating olympus pods"

#echo "-- Rolling back changes in source files: $SDK_COMMON_HEADER, $OLYMPUS_UTILS, $OLYMPUS_PLIST"
#git checkout -- $SDK_COMMON_HEADER $OLYMPUS_UTILS $OLYMPUS_PLIST $OLYMPUS_APP_DELEGATE

#echo "-- Setting original keychain, \"$ORIGINAL_KEYCHAIN\", as default"
{'fraction_non_alphanumeric': 0.0949667616334283, 'fraction_numerical': 0.0011396011396011395, 'mean_word_length': 5.011415525114155, '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': '2730395', 'n_tokens_mistral': 1842, 'n_tokens_neox': 1789, 'n_words': 537}