From 2fc5a00300be8840ae2e5fea80d9f7864279f71e Mon Sep 17 00:00:00 2001 From: shijie Date: Tue, 7 Jan 2025 15:27:10 +0800 Subject: [PATCH] update flutter_engine flutter_samples Signed-off-by: shijie --- flutter/engine/compile.sh | 8 ++------ flutter/engine/prepare.sh | 37 ++++++++++++++++++++++++++++++++++++- flutter/samples/compile.sh | 8 ++------ flutter/samples/prepare.sh | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 13 deletions(-) diff --git a/flutter/engine/compile.sh b/flutter/engine/compile.sh index 99a0aad..b6fdfc1 100644 --- a/flutter/engine/compile.sh +++ b/flutter/engine/compile.sh @@ -17,15 +17,11 @@ DIR=$PWD function start_compile() { export PATH="$DIR/depot_tools:$PATH" - export TOOL_HOME=$DIR/flutter_env/command-line-tools-5.0.3.600 - export DEVECO_SDK_HOME=$DIR/new-os-sdk + export TOOL_HOME=$DIR/command-line-tools + export DEVECO_SDK_HOME=$TOOL_HOME/sdk export NODE_HOME=$DIR/flutter_env/node-v16.14.2-linux-x64 export PATH=$TOOL_HOME/ohpm/bin:$TOOL_HOME/hvigor/bin:$NODE_HOME/bin:$PATH - echo "--> Starting prepare_sdk" - $DIR/cicd/flutter/engine/prepare_sdk.sh - echo "--> End prepare_sdk" - echo "--> Starting build flutter_engine" python3 src/flutter/attachment/scripts/ohos.py -n config compile -t debug echo "--> End build flutter_engine" diff --git a/flutter/engine/prepare.sh b/flutter/engine/prepare.sh index 80b5448..980a2ef 100644 --- a/flutter/engine/prepare.sh +++ b/flutter/engine/prepare.sh @@ -139,6 +139,34 @@ function prepare_flutter_env() { return 0 } +function prepare_commandlinetools(){ + echo "prepare_commandlinetools" + + if [ -d "command-line-tools" ];then + echo "command-line-tools exists, do not download again." + else + if [ ! -f "command-line-tools.zip" ];then + echo "start download command-line-tools.zip" + curl -o "command-line-tools.zip" https://repo.huaweicloud.com/harmonyos/ohpm/5.0.5/commandline-tools-linux-x64-5.0.5.310.zip + + # 判断是否下载成功 + if [ $? != 0 ];then + echo "download command-line-tools.zip failed." + rm -rf command-line-tools.zip + return 1 + fi + fi + + # 开始解压zip包 + echo "start unzip command-line-tools.zip" + unzip -oqq "./command-line-tools.zip" + + echo "finish unzip command-line-tools.zip" + fi + + return 0 +} + function prepare() { apt-get update && apt-get install -y python3 unzip make ninja-build pkg-config tree tar curl @@ -192,7 +220,14 @@ function prepare() { then echo "prepare_flutter_env failed!!" return 1 - fi + fi + + prepare_commandlinetools + if [ $? -ne 0 ] + then + echo "prepare_commandlinetools failed!!" + return 1 + fi #创建npmrc文件 rm -f ~/.npmrc diff --git a/flutter/samples/compile.sh b/flutter/samples/compile.sh index a0cb466..98e53fc 100644 --- a/flutter/samples/compile.sh +++ b/flutter/samples/compile.sh @@ -25,9 +25,8 @@ function prepare_env() { export FLUTTER_HOME=$DIR/flutter_flutter export PATH=$JAVA_HOME/bin:$FLUTTER_HOME/bin:$PATH - export TOOL_HOME=$DIR/flutter_env/command-line-tools-5.0.3.600 - export HOS_SDK_HOME=$DIR/new-os-sdk - export DEVECO_SDK_HOME=$HOS_SDK_HOME + export TOOL_HOME=$DIR/command-line-tools + export DEVECO_SDK_HOME=$TOOL_HOME/sdk export NODE_HOME=$DIR/flutter_env/node-v16.14.2-linux-x64 export PATH=$TOOL_HOME/ohpm/bin:$TOOL_HOME/hvigor/bin:$NODE_HOME/bin:$PATH } @@ -80,9 +79,6 @@ function start_compile() { echo "~项目位置:$PROJECT" echo "~引擎位置:$WORK_ROOT" - #SDK准备 - cicd/flutter/engine/prepare_sdk.sh - flutter doctor -v cd ./third_party/flutter/samples/$PROJECT && flutter pub get && rm -rf ./pubspec.lock echo "开始构建hap包" diff --git a/flutter/samples/prepare.sh b/flutter/samples/prepare.sh index 65b8b24..232ea87 100644 --- a/flutter/samples/prepare.sh +++ b/flutter/samples/prepare.sh @@ -55,6 +55,34 @@ function prepare_flutter_flutter() { return 0 } +function prepare_commandlinetools(){ + echo "prepare_commandlinetools" + + if [ -d "command-line-tools" ];then + echo "command-line-tools exists, do not download again." + else + if [ ! -f "command-line-tools.zip" ];then + echo "start download command-line-tools.zip" + curl -o "command-line-tools.zip" https://repo.huaweicloud.com/harmonyos/ohpm/5.0.5/commandline-tools-linux-x64-5.0.5.310.zip + + # 判断是否下载成功 + if [ $? != 0 ];then + echo "download command-line-tools.zip failed." + rm -rf command-line-tools.zip + return 1 + fi + fi + + # 开始解压zip包 + echo "start unzip command-line-tools.zip" + unzip -oqq "./command-line-tools.zip" + + echo "finish unzip command-line-tools.zip" + fi + + return 0 +} + function prepare() { apt-get update && apt-get install -y curl tar unzip python3 tree libc6-dev libc6 binutils wget gcc make gawk bison && apt-get remove -y nodejs @@ -72,6 +100,13 @@ function prepare() { return 1 fi + prepare_commandlinetools + if [ $? -ne 0 ] + then + echo "prepare_commandlinetools failed!!" + return 1 + fi + #创建npmrc文件 rm -f ~/.npmrc echo -e "registry=https://repo.huaweicloud.com/repository/npm/\n@ohos:registry=https://repo.harmonyos.com/npm/\nlockfile=false" > ~/.npmrc -- Gitee