From cd38efaa5827926b9e8308ab8a1ee81b387bd033 Mon Sep 17 00:00:00 2001 From: hezhengyi Date: Tue, 19 Nov 2024 16:15:46 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8DDevEco-Studio=205.0.5.200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hezhengyi --- attachment/scripts/ohos.py | 2 +- attachment/scripts/ohos_create_flutter_har.py | 67 +------------------ .../flutter_embedding/build-profile.json5 | 5 +- tools/gn | 2 +- 4 files changed, 5 insertions(+), 71 deletions(-) diff --git a/attachment/scripts/ohos.py b/attachment/scripts/ohos.py index 49f44d3865..2d21f7848f 100644 --- a/attachment/scripts/ohos.py +++ b/attachment/scripts/ohos.py @@ -328,7 +328,7 @@ def addParseParam(parser): help='Extra param to src/flutter/tools/gn. Such as: -g "\\--enable-unittests"', ) parser.add_argument( - "--ohos_api_int", type=int, choices=[11, 12], default=12, help="Ohos api int." + "--ohos_api_int", type=int, default=13, help="Ohos api int. Deprecated." ) parser.add_argument( "--har-unstripped", action="store_true", help="Use so.unstripped or not." diff --git a/attachment/scripts/ohos_create_flutter_har.py b/attachment/scripts/ohos_create_flutter_har.py index bf21568bdf..cc481911fe 100644 --- a/attachment/scripts/ohos_create_flutter_har.py +++ b/attachment/scripts/ohos_create_flutter_har.py @@ -24,76 +24,12 @@ import subprocess import sys -HAR_CONFIG_TEMPLATE = """ -{ - "app": { - "signingConfigs": [], - "products": [ - { - "name": "default", - "signingConfig": "default", - "compileSdkVersion": "%s", - "compatibleSdkVersion": "%s", - "runtimeOS": "HarmonyOS", - } - ], - "buildModeSet": [ - { - "name": "debug", - }, - { - "name": "release" - }, - { - "name": "profile" - }, - ] - }, - "modules": [ - { - "name": "flutter", - "srcPath": "./flutter" - } - ] -} -""" - - -HVIGOR_CONFIG = """ -{ - "modelVersion": "5.0.0", - "dependencies": { - } -} -""" - - def runGitCommand(command): result = subprocess.run(command, capture_output=True, text=True, shell=True) if result.returncode != 0: raise Exception(f"Git command failed: {result.stderr}") return result.stdout.strip() -# 更新har的配置文件,指定编译使用的api版本 -def updateConfig(buildDir, apiInt): - apiVersionMap = { - 11: "4.1.0(11)", - 12: "5.0.0(12)", - } - apiStr = apiVersionMap[apiInt] - with open( - os.path.join(buildDir, "build-profile.json5"), "w", encoding="utf-8" - ) as file: - file.write(HAR_CONFIG_TEMPLATE % (apiStr, apiStr)) - - if apiInt != 11: - with open( - os.path.join(buildDir, "hvigor", "hvigor-config.json5"), - "w", - encoding="utf-8", - ) as file: - file.write(HVIGOR_CONFIG) - # 自动更新flutter.har的版本号,把日期加到末尾。如: 1.0.0-20240731 def updateVersion(buildDir): @@ -137,7 +73,6 @@ def runCommand(command, checkCode=True, timeout=None): # 编译har文件,通过hvigorw的命令行参数指定编译类型(debug/release/profile) def buildHar(buildDir, apiInt, buildType): - updateConfig(buildDir, apiInt) updateVersion(buildDir) hvigorwCommand = "hvigorw" if apiInt != 11 else (".%shvigorw" % os.sep) runCommand( @@ -160,7 +95,7 @@ def main(): parser.add_argument("--native_lib", action="append", help="Native code library.") parser.add_argument("--ohos_abi", help="Native code ABI.") parser.add_argument( - "--ohos_api_int", type=int, choices=[11, 12], help="Ohos api int." + "--ohos_api_int", type=int, default=13, help="Ohos api int. Deprecated." ) options = parser.parse_args() # copy source code diff --git a/shell/platform/ohos/flutter_embedding/build-profile.json5 b/shell/platform/ohos/flutter_embedding/build-profile.json5 index 87805d1f43..c4150bb5a3 100755 --- a/shell/platform/ohos/flutter_embedding/build-profile.json5 +++ b/shell/platform/ohos/flutter_embedding/build-profile.json5 @@ -20,9 +20,8 @@ { "name": "default", "signingConfig": "default", - "compileSdkVersion": "5.0.0(12)", "compatibleSdkVersion": "5.0.0(12)", - "runtimeOS": "HarmonyOS", + "runtimeOS": "HarmonyOS" } ], "buildModeSet": [ @@ -34,7 +33,7 @@ }, { "name": "profile" - }, + } ] }, "modules": [ diff --git a/tools/gn b/tools/gn index dab248aff2..ccbb3b75e9 100755 --- a/tools/gn +++ b/tools/gn @@ -763,7 +763,7 @@ def parse_args(args): '--ohos-cpu', type=str, choices=['x64', 'x86', 'arm64', 'arm'] ) parser.add_argument( - '--ohos-api-int', type=int, choices=[11, 12], default=11 + '--ohos-api-int', type=int, default=13 ) parser.add_argument( '--fuchsia-cpu', type=str, choices=['x64', 'arm64'], default='x64' -- Gitee