diff --git a/attachment/scripts/ohos.py b/attachment/scripts/ohos.py index 49f44d38657caa856a78706731ed16738aaf13d7..2d21f7848f4954e6e399f7dcf25ffc2390867848 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 bf21568bdfe8b10c5f4c6e61513f67daccb386c3..cc481911fe2dfe8a7faf5db65e6d39e3ad93c2c2 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 87805d1f439f5c5ecd50c5eb400f07f7cf7957ba..c4150bb5a34dad87dcf290216414a834138b28aa 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 dab248aff26714073cea71e65bf69211f8a47b05..ccbb3b75e933bceb1895a4647097cdc2671c14ae 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'