forked from bilibili/ijkplayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
version.sh
executable file
·61 lines (40 loc) · 1.71 KB
/
version.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
#!/bin/sh
set -e
VERSION_CODE=600000
VERSION_NAME=0.6.0
echo_usage() {
echo ""
echo "Usage:"
echo " version.sh 102003 1.2.3"
echo ""
}
if [ -z "$VERSION_CODE" -o -z "$VERSION_NAME" ]; then
echo_usage
exit 1
fi
# README.md
# cat README.md \
# | sed "s/\(#compile 'tv.danmaku.ijk.media:ijkplayer-java:#\)[[:digit:]][[:digit:].]*\(#'#\)/\1:$VERSION_NAME\2/" \
# > README.md.new
cat README.md \
| sed "s/\(compile \'tv.danmaku.ijk.media:ijkplayer-[[:alnum:]_]*:\)[[:digit:].]*[[:digit:]]/\1$VERSION_NAME/g" \
| sed "s/\(git checkout -B latest k\)[[:digit:]][[:digit:].]*/\1$VERSION_NAME/g" \
> README.md.new
mv -f README.md.new README.md
# android/ijkplayer/build.gradle
cat android/ijkplayer/build.gradle \
| sed "s/\(versionCode[[:space:]]*=[[:space:]]*\)[[:digit:]][[:digit:]]*/\1$VERSION_CODE/" \
| sed "s/\(versionName[[:space:]]*=[[:space:]]*\)\"[[:digit:].]*[[:digit:]]\"/\1\"$VERSION_NAME\"/" \
> android/ijkplayer/build.gradle.new
mv -f android/ijkplayer/build.gradle.new android/ijkplayer/build.gradle
# android/ijkplayer/gradle.properties
cat android/ijkplayer/gradle.properties \
| sed "s/\(VERSION_NAME=\)[[:digit:].]*[[:digit:]]/\1$VERSION_NAME/" \
| sed "s/\(VERSION_CODE=\)[[:digit:]][[:digit:]]*/\1$VERSION_CODE/" \
> android/ijkplayer/gradle.properties.new
mv -f android/ijkplayer/gradle.properties.new android/ijkplayer/gradle.properties
# android/ijkplayer/ijkplayer-exo/build.gradle
cat android/ijkplayer/ijkplayer-exo/build.gradle \
| sed "s/\(compile \'tv.danmaku.ijk.media:ijkplayer-java:\)[[:digit:].]*[[:digit:]]/\1$VERSION_NAME/g" \
> android/ijkplayer/ijkplayer-exo/build.gradle.new
mv -f android/ijkplayer/ijkplayer-exo/build.gradle.new android/ijkplayer/ijkplayer-exo/build.gradle