Change location of iOS build cache directory to ~/Library/Caches/ (#22688)

Summary:
Instead of using ~/.rncache use the special Caches directory designed for caching files. This fixes #21780.

Changelog:
----------

[iOS] [Changed] - Moved iOS build cache directory from ~/.rncache to ~/Library/Caches/com.facebook.ReactNativeBuild
Pull Request resolved: https://github.com/facebook/react-native/pull/22688

Differential Revision: D13817171

Pulled By: cpojer

fbshipit-source-id: af03dda66f9d49f4fe88bd050b359ccb7abb889a
This commit is contained in:
Sergey Zolotarev 2019-01-25 03:08:52 -08:00 коммит произвёл Facebook Github Bot
Родитель 103880b3c6
Коммит 1024dc251e
1 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -4,14 +4,18 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cachedir="$HOME/.rncache"
if [ -d "$HOME/.rncache" ]; then
cachedir="$HOME/.rncache" # react-native 0.57.8 and older
else
cachedir="$HOME/Library/Caches/com.facebook.ReactNativeBuild"
fi
mkdir -p "$cachedir"
function file_fail () {
cachefile=$1
msg=$2
echo "$msg. Debug info:" 2>&1
echo "$msg. Debug info:" 2>&1
ls -l "$cachefile" 2>&1
shasum "$cachefile" 2>&1
exit 1
@ -29,7 +33,7 @@ function fetch_and_unpack () {
while true; do
if [ -f "$cachedir/$file" ]; then
if shasum -p "$cachedir/$file" |
awk -v hash="$hash" '{exit $1 != hash}'; then
awk -v hash="$hash" '{exit $1 != hash}'; then
break
else
echo "Incorrect hash:" 2>&1