!10437 stub code comment 输出文件压缩

Merge pull request !10437 from yangliping/day1129
This commit is contained in:
openharmony_ci 2024-12-04 03:54:03 +00:00 committed by Gitee
commit 4d938a74a4
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 9 additions and 8 deletions

View File

@ -542,7 +542,7 @@ action("gen_stub_file") {
]
outputs = [ "$stub_file_gen_dir/stub.an" ]
if (is_ohos) {
outputs += [ "$stub_file_gen_dir/stub_code_comment.txt" ]
outputs += [ "$stub_file_gen_dir/stub_code_comment.zip" ]
}
}

View File

@ -23,10 +23,11 @@ Description: run script
import argparse
import os
import stat
import subprocess
import sys
import time
import zipfile
from io import StringIO
def get_env_path_from_rsp(script_file: str) -> list:
@ -120,15 +121,15 @@ def process_open(args: object) -> [str, object]:
def generate_stub_code_comment(out_str:str):
flags = os.O_WRONLY | os.O_CREAT
mode = stat.S_IWUSR | stat.S_IRUSR
dir_path = './gen/arkcompiler/ets_runtime/'
if not os.path.exists(dir_path):
return
file_path = dir_path + 'stub_code_comment.txt'
fd = os.open(file_path, flags, mode)
with os.fdopen(fd, "w") as code_comment_file:
code_comment_file.write(out_str)
zip_path = dir_path + 'stub_code_comment.zip'
memory_file = StringIO()
memory_file.write(out_str)
memory_file.seek(0)
with zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) as zip_file:
zip_file.writestr('stub_code_comment.txt', memory_file.getvalue())
def judge_output(args: object):