Skip to content

Commit 66c5d16

Browse files
committed
every plat has a pre compile version
1 parent 95c4276 commit 66c5d16

File tree

7 files changed

+85
-49
lines changed

7 files changed

+85
-49
lines changed

.github/workflows/onestep.sh

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,57 @@ function make_xcfmwk_bundle()
8181
cd $ROOT_DIR
8282
}
8383

84+
function replace_tag()
85+
{
86+
local file=$1
87+
local key=$2
88+
# check PRE_COMPILE_TAG_IOS
89+
if grep -q "$key" "$file_path"; then
90+
# replace PRE_COMPILE_TAG_IOS=new_tag
91+
sed -i "" "s/^export $key=.*/export $key=$TAG/" $file
92+
else
93+
# PRE_COMPILE_TAG_IOS not found, check PRE_COMPILE_TAG
94+
if grep -q "PRE_COMPILE_TAG" "$file"; then
95+
# insert PRE_COMPILE_TAG_IOS=new_tag after PRE_COMPILE_TAG
96+
sed -i "" "/PRE_COMPILE_TAG/a\
97+
export $key=$TAG" "$file"
98+
else
99+
echo "can't find PRE_COMPILE_TAG in $file"
100+
fi
101+
fi
102+
}
103+
84104
function upgrade()
85105
{
86-
file="configs/libs/${LIB_NAME}.sh"
87-
sed -i "" "s/^export PRE_COMPILE_TAG=.*/export PRE_COMPILE_TAG=$TAG/" $file
106+
local file="configs/libs/${LIB_NAME}.sh"
107+
case $PLAT in
108+
ios)
109+
replace_tag $file $TAG PRE_COMPILE_TAG_IOS
110+
;;
111+
macos)
112+
replace_tag $file $TAG PRE_COMPILE_TAG_MACOS
113+
;;
114+
tvos)
115+
replace_tag $file $TAG PRE_COMPILE_TAG_TVOS
116+
;;
117+
apple)
118+
replace_tag $file $TAG PRE_COMPILE_TAG_IOS
119+
replace_tag $file $TAG PRE_COMPILE_TAG_MACOS
120+
replace_tag $file $TAG PRE_COMPILE_TAG_TVOS
121+
;;
122+
android)
123+
replace_tag $file $TAG PRE_COMPILE_TAG_ANDROID
124+
;;
125+
all)
126+
replace_tag $file $TAG PRE_COMPILE_TAG_IOS
127+
replace_tag $file $TAG PRE_COMPILE_TAG_MACOS
128+
replace_tag $file $TAG PRE_COMPILE_TAG_TVOS
129+
replace_tag $file $TAG PRE_COMPILE_TAG_ANDROID
130+
;;
131+
esac
132+
88133
git add $file
89-
git commit -m "upgrade $LIB_NAME to $TAG by cd"
134+
git commit -m "upgrade $LIB_NAME to $TAG for $PLAT by cd"
90135
git pull --rebase
91136
git push origin
92137
}
@@ -149,7 +194,6 @@ function main()
149194
publish
150195
;;
151196
esac
152-
153197
}
154198

155199
if [[ $LIB_NAME == 'test' ]];then

do-compile/android/main.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ do
3333

3434
echo "LIB_NAME : [$LIB_NAME]"
3535
echo "GIT_COMMIT : [$GIT_COMMIT]"
36-
echo "PRE_COMPILE_TAG : [$PRE_COMPILE_TAG]"
3736
echo "LIPO_LIBS : [$LIPO_LIBS]"
3837
echo "GIT_UPSTREAM : [$GIT_UPSTREAM]"
3938

do-compile/apple/main.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,13 @@ cd "$THIS_DIR"
2525
# 循环编译所有的库
2626
for lib in $MR_VENDOR_LIBS
2727
do
28-
[[ ! -f "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" ]] && (echo "$lib config not exist,compile will stop.";exit 1;)
28+
[[ ! -f "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" ]] && (echo "$lib config not exist, compile will stop.";exit 1;)
2929

3030
echo "===[$MR_CMD $lib]===================="
3131
source "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh"
3232

3333
echo "LIB_NAME : [$LIB_NAME]"
3434
echo "GIT_COMMIT : [$GIT_COMMIT]"
35-
echo "PRE_COMPILE_TAG : [$PRE_COMPILE_TAG]"
3635
echo "LIPO_LIBS : [$LIPO_LIBS]"
3736
echo "GIT_UPSTREAM : [$GIT_UPSTREAM]"
3837

do-install/install-pre-lib.sh

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,42 +20,20 @@ set -e
2020
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
2121
cd "$THIS_DIR"
2222

23-
echo "=== [$0] check env begin==="
24-
env_assert "MR_PLAT"
25-
env_assert "MR_WORKSPACE"
26-
env_assert "PRE_COMPILE_TAG"
27-
echo "===check env end==="
28-
2923
function install_plat() {
3024
local join=""
3125

3226
if [[ "$1" ]];then
3327
join="-$1"
3428
fi
3529

36-
export MR_DOWNLOAD_ONAME="$PRE_COMPILE_TAG-$MR_PLAT${join}.zip"
37-
export MR_DOWNLOAD_URL="https://github.com/debugly/MRFFToolChainBuildShell/releases/download/$PRE_COMPILE_TAG/$LIB_NAME-$MR_PLAT-universal${join}-$VER.zip"
30+
export MR_DOWNLOAD_ONAME="$TAG-$MR_PLAT${join}.zip"
31+
export MR_DOWNLOAD_URL="https://github.com/debugly/MRFFToolChainBuildShell/releases/download/$TAG/$LIB_NAME-$MR_PLAT-universal${join}-$VER.zip"
3832
export MR_UNCOMPRESS_DIR="$MR_WORKSPACE/product/$MR_PLAT/universal${join}"
3933

4034
./download-uncompress.sh
4135
}
4236

43-
if test -z $PRE_COMPILE_TAG ;then
44-
echo "tag can't be nil"
45-
usage
46-
exit
47-
fi
48-
49-
# opus-1.3.1-231124151836
50-
# yuv-stable-eb6e7bb-250225223408
51-
LIB_NAME=$(echo $PRE_COMPILE_TAG | awk -F - '{print $1}')
52-
prefix="${LIB_NAME}-"
53-
suffix=$(echo $PRE_COMPILE_TAG | awk -F - '{printf "-%s", $NF}')
54-
# 去掉前缀
55-
temp=${PRE_COMPILE_TAG#$prefix}
56-
# 去掉后缀
57-
VER=${temp%$suffix}
58-
5937
if [[ "$MR_PLAT" == 'ios' || "$MR_PLAT" == 'tvos' ]];then
6038
install_plat
6139
install_plat "simulator"

do-install/install-pre-xcf.sh

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ set -e
2020
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
2121
cd "$THIS_DIR"
2222

23-
2423
function install_plat() {
2524

2625
export MR_DOWNLOAD_ONAME="$PRE_COMPILE_TAG-xcfmwk.zip"
@@ -30,20 +29,4 @@ function install_plat() {
3029
./download-uncompress.sh
3130
}
3231

33-
if test -z $PRE_COMPILE_TAG ;then
34-
echo "tag can't be nil"
35-
usage
36-
exit
37-
fi
38-
39-
# opus-1.3.1-231124151836
40-
# yuv-stable-eb6e7bb-250225223408
41-
LIB_NAME=$(echo $PRE_COMPILE_TAG | awk -F - '{print $1}')
42-
prefix="${LIB_NAME}-"
43-
suffix=$(echo $PRE_COMPILE_TAG | awk -F - '{printf "-%s", $NF}')
44-
# 去掉前缀
45-
temp=${PRE_COMPILE_TAG#$prefix}
46-
# 去掉后缀
47-
VER=${temp%$suffix}
48-
4932
install_plat

do-install/main.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,46 @@ set -e
2222
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
2323
cd "$THIS_DIR"
2424

25+
function parse_lib_config() {
26+
27+
local t=$(echo "PRE_COMPILE_TAG_$MR_PLAT" | tr '[:lower:]' '[:upper:]')
28+
local vt=$(eval echo "\$$t")
29+
30+
if test -z $vt ;then
31+
TAG="$PRE_COMPILE_TAG"
32+
else
33+
TAG="$vt"
34+
fi
35+
36+
if test -z $TAG ;then
37+
echo "tag can't be nil"
38+
usage
39+
exit
40+
fi
41+
42+
# opus-1.3.1-231124151836
43+
# yuv-stable-eb6e7bb-250225223408
44+
LIB_NAME=$(echo $TAG | awk -F - '{print $1}')
45+
local prefix="${LIB_NAME}-"
46+
local suffix=$(echo $TAG | awk -F - '{printf "-%s", $NF}')
47+
# 去掉前缀
48+
local temp=${TAG#$prefix}
49+
# 去掉后缀
50+
VER=${temp%$suffix}
51+
52+
export VER
53+
export TAG
54+
export LIB_NAME
55+
}
56+
2557
# 循环编译所有的库
2658
for lib in $MR_VENDOR_LIBS
2759
do
2860
[[ ! -f "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" ]] && (echo "$lib config not exist,install will stop.";exit 1;)
2961

3062
echo "===[install $lib]===================="
3163
source "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh"
64+
parse_lib_config
3265
if [[ $FORCE_XCFRAMEWORK ]];then
3366
./install-pre-xcf.sh
3467
else

tools/parse-arguments.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function env_assert()
131131
echo "$name is nil,eg: export $name=xx" >&2
132132
exit 1
133133
else
134-
echo "$name:${value}" >&2
134+
echo "$name : [${value}]" >&2
135135
fi
136136
}
137137

0 commit comments

Comments
 (0)