<commit_before>#!/bin/bash

. "${OBJROOT}/autorevision.tmp"
BUILD_NUMBER="2821" # Magic number; do not touch!
N_VCS_NUM="$(echo "${BUILD_NUMBER} + ${VCS_NUM}" | bc)"
N_VCS_TAG="$(echo "${VCS_TAG}" | sed -e 's:^v/::')" # for urls/files
V_VCS_TAG="$(echo "${N_VCS_TAG}" | sed -e 's:_beta: Beta :' -e 's:_rc: RC :')" # for display
VIENNA_UPLOADS_DIR="${BUILT_PRODUCTS_DIR}/Uploads"
DOWNLOAD_BASE_URL="${BASE_URL_TYP}://${BASE_URL_LOC}" # values set in project-all.xcconfig
TGZ_FILENAME="Vienna${N_VCS_TAG}.tgz"
dSYM_FILENAME="Vienna${N_VCS_TAG}.${VCS_SHORT_HASH}-dSYM"
case "${N_VCS_TAG}" in
	*_beta*)
		VIENNA_CHANGELOG="changelog_beta.xml"
		DOWNLOAD_SUB_DIR="TestVersions"
	;;
	*_rc*)
		VIENNA_CHANGELOG="changelog_rc.xml"
		DOWNLOAD_SUB_DIR="TestVersions"
	;;
	*)
		VIENNA_CHANGELOG="changelog.xml"
		DOWNLOAD_SUB_DIR="ReleasedVersions"
	;;
esac
DOWNLOAD_TAG_DIR="${N_VCS_TAG}"
DOWNLOAD_BASE_URL="${DOWNLOAD_BASE_URL}/${DOWNLOAD_SUB_DIR}/${DOWNLOAD_TAG_DIR}"

# codesign setup
function signd {
	if [ ! -z "${CODE_SIGN_IDENTITY}" ]; then
		# Local Config
		local idetd="${CODE_SIGN_IDENTITY}"
		local resrul="${CODE_SIGN_RESOURCE_RULES_PATH}"
		local appth="${BUILT_PRODUCTS_DIR}/Vienna.app"

		# Sign and verify the app
		if [ ! -z "${resrul}" ]; then
			cp -a "${resrul}" "${appth}/ResourceRules.plist"
			codesign -f -s "${idetd}" --resource-rules="${appth}/ResourceRules.plist" -vvv "${appth}"
			rm "${appth}/ResourceRules.plist"
		else
			codesign -f -s "${idetd}" -vvv "${appth}"
		fi
		codesign -vvv --verify "${appth}"
	else
		echo "warning: No code signing identity configured; code will not be signed." 1>&2
	fi
}


# Fail if not deployment
if [ ! "${CONFIGURATION}" = "Deployment" ]; then
	echo "error: This should only be run as Deployment" >&2
	exit 1
fi


cd "${BUILT_PRODUCTS_DIR}"


# Make the dSYM Bundle
mkdir -p "${VIENNA_UPLOADS_DIR}/${dSYM_FILENAME}"
cp -a *.dSYM "${VIENNA_UPLOADS_DIR}/${dSYM_FILENAME}"
cd "${VIENNA_UPLOADS_DIR}"
tar -czf "${dSYM_FILENAME}.tgz" --exclude '.DS_Store' "${dSYM_FILENAME}"


# Zip up the app
cd "${BUILT_PRODUCTS_DIR}"
signd<commit_msg>No need to keep the uncompressed folder<commit_after>#!/bin/bash

. "${OBJROOT}/autorevision.tmp"
BUILD_NUMBER="2821" # Magic number; do not touch!
N_VCS_NUM="$(echo "${BUILD_NUMBER} + ${VCS_NUM}" | bc)"
N_VCS_TAG="$(echo "${VCS_TAG}" | sed -e 's:^v/::')" # for urls/files
V_VCS_TAG="$(echo "${N_VCS_TAG}" | sed -e 's:_beta: Beta :' -e 's:_rc: RC :')" # for display
VIENNA_UPLOADS_DIR="${BUILT_PRODUCTS_DIR}/Uploads"
DOWNLOAD_BASE_URL="${BASE_URL_TYP}://${BASE_URL_LOC}" # values set in project-all.xcconfig
TGZ_FILENAME="Vienna${N_VCS_TAG}.tgz"
dSYM_FILENAME="Vienna${N_VCS_TAG}.${VCS_SHORT_HASH}-dSYM"
case "${N_VCS_TAG}" in
	*_beta*)
		VIENNA_CHANGELOG="changelog_beta.xml"
		DOWNLOAD_SUB_DIR="TestVersions"
	;;
	*_rc*)
		VIENNA_CHANGELOG="changelog_rc.xml"
		DOWNLOAD_SUB_DIR="TestVersions"
	;;
	*)
		VIENNA_CHANGELOG="changelog.xml"
		DOWNLOAD_SUB_DIR="ReleasedVersions"
	;;
esac
DOWNLOAD_TAG_DIR="${N_VCS_TAG}"
DOWNLOAD_BASE_URL="${DOWNLOAD_BASE_URL}/${DOWNLOAD_SUB_DIR}/${DOWNLOAD_TAG_DIR}"

# codesign setup
function signd {
	if [ ! -z "${CODE_SIGN_IDENTITY}" ]; then
		# Local Config
		local idetd="${CODE_SIGN_IDENTITY}"
		local resrul="${CODE_SIGN_RESOURCE_RULES_PATH}"
		local appth="${BUILT_PRODUCTS_DIR}/Vienna.app"

		# Sign and verify the app
		if [ ! -z "${resrul}" ]; then
			cp -a "${resrul}" "${appth}/ResourceRules.plist"
			codesign -f -s "${idetd}" --resource-rules="${appth}/ResourceRules.plist" -vvv "${appth}"
			rm "${appth}/ResourceRules.plist"
		else
			codesign -f -s "${idetd}" -vvv "${appth}"
		fi
		codesign -vvv --verify "${appth}"
	else
		echo "warning: No code signing identity configured; code will not be signed." 1>&2
	fi
}


# Fail if not deployment
if [ ! "${CONFIGURATION}" = "Deployment" ]; then
	echo "error: This should only be run as Deployment" >&2
	exit 1
fi


cd "${BUILT_PRODUCTS_DIR}"


# Make the dSYM Bundle
mkdir -p "${VIENNA_UPLOADS_DIR}/${dSYM_FILENAME}"
cp -a *.dSYM "${VIENNA_UPLOADS_DIR}/${dSYM_FILENAME}"
cd "${VIENNA_UPLOADS_DIR}"
tar -czf "${dSYM_FILENAME}.tgz" --exclude '.DS_Store' "${dSYM_FILENAME}"
rm -rf "${VIENNA_UPLOADS_DIR}/${dSYM_FILENAME}"


# Zip up the app
cd "${BUILT_PRODUCTS_DIR}"
signd
{'fraction_non_alphanumeric': 0.17865538316878232, 'fraction_numerical': 0.0037611659614480487, 'mean_word_length': 5.50611620795107, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '1868887', 'n_tokens_mistral': 1857, 'n_tokens_neox': 1765, 'n_words': 340}