forked from software-mansion/react-native-reanimated
-
Notifications
You must be signed in to change notification settings - Fork 5
/
createNPMPackage.sh
executable file
·75 lines (60 loc) · 1.75 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
#!/bin/bash
set -e
set -x
ROOT=$(pwd)
unset CI
versions=("0.69.1" "0.68.2" "0.67.3" "0.66.3" "0.65.1")
version_name=("69" "68" "67" "66" "65")
for index in {0..4}
do
yarn add react-native@"${versions[$index]}"
for js_runtime in "hermes" "jsc"
do
echo "js_runtime=${js_runtime}"
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" JS_RUNTIME=${js_runtime} ./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]}-${js_runtime}".aar
cp android/build/outputs/aar/*.aar android/react-native-reanimated-"${version_name[$index]}-${js_runtime}".aar
done
done
yarn add react-native@"${versions[0]}" --dev
cp -R android/build build_output
cd android && ./gradlew clean && cd ..
yarn run type:generate
npm pack
rm -rf ./lib
rm -rf ./android/rnVersionPatch/backup/*
touch ./android/rnVersionPatch/backup/.gitkeep
echo "Done!"