forked from software-mansion/react-native-reanimated
-
Notifications
You must be signed in to change notification settings - Fork 0
/
createNPMPackage.sh
executable file
·81 lines (66 loc) · 1.87 KB
/
createNPMPackage.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
set -e
set -x
ROOT=$(pwd)
unset CI
versions=("0.68.0-rc.2" "0.67.3" "0.66.3" "0.65.1" "0.64.3")
version_name=("68" "67" "66" "65" "64")
for index in {0..4}
do
yarn add react-native@"${versions[$index]}"
for for_hermes in "True" "False"
do
engine="jsc"
if [ "$for_hermes" == "True" ]; then
engine="hermes"
fi
echo "engine=${engine}"
cd android
echo "APPLY PATCH"
versionNumber=${version_name[$index]}
cd ./rnVersionPatch/$versionNumber
rm -rf ../backup/*
cp -r . ../backup
if [ "$(find . | grep 'java')" ];
then
fileList=$(find . | grep -i 'java')
for file in $fileList; do
echo "COPY: $file"
cp ../../src/main/java/com/swmansion/reanimated/$file ../backup/$file
cp $file ../../src/main/java/com/swmansion/reanimated/$file
done
else
pwd
echo "NO PATCH";
fi
cd ../..
./gradlew clean
CLIENT_SIDE_BUILD="False" FOR_HERMES=${for_hermes} ./gradlew :assembleDebug --no-build-cache --rerun-tasks
cd ./rnVersionPatch/$versionNumber
if [ $(find . | grep 'java') ];
then
echo "RESTORE BACKUP"
for file in $fileList; do
echo "BACKUP: $file"
cp ../backup/$file ../../src/main/java/com/swmansion/reanimated/$file
done
echo "CLEAR BACKUP"
rm -rf ../backup/*
fi
cd ../..
cd $ROOT
rm -rf android/react-native-reanimated-"${version_name[$index]}-${engine}".aar
cp android/build/outputs/aar/*.aar android/react-native-reanimated-"${version_name[$index]}-${engine}".aar
done
done
yarn add react-native@"${versions[0]}" --dev
cp -R android-npm/expo android/
cp -R android/build build_output
cd android && ./gradlew clean && cd ..
yarn run type:generate
npm pack
rm -rf android/expo
rm -rf ./lib
rm -rf ./android/rnVersionPatch/backup/*
touch ./android/rnVersionPatch/backup/.gitkeep
echo "Done!"