精准补充

Signed-off-by: 唐翔蕾 <328491512@qq.com>
This commit is contained in:
唐翔蕾 2024-11-11 14:16:48 +08:00
parent ff5ccc18ed
commit 9696fbb491
2 changed files with 16 additions and 14 deletions

View File

@ -18,7 +18,7 @@
import os
import sys
import json
from targetUtils import ChangeFileEntity, ComponentUtils, XTSUtils, XTSTargetUtils, PathUtils
from targetUtils import ChangeFileEntity, ComponentUtils, XTSUtils, XTSTargetUtils, PathUtils, HOME
class AccurateTarget:
@ -96,7 +96,10 @@ class AccurateTarget:
if ret == 1:
# changeinfo读取失败-全量编译
print (f"未获取到修改文件列表,编译全量代码")
target_paths = [self._xts_root_dir]
xts_suite = os.path.basename(self._xts_root_dir)
relative_path = os.path.relpath(self._xts_root_dir, HOME)
targets = [f"{relative_path}:xts_{xts_suite}"]
else:
func_list = [
self._get_targets_from_testcase_change
@ -113,15 +116,15 @@ class AccurateTarget:
break
target_paths = target_paths.union(m)
# 去除子目录\重复目录
sum_path = PathUtils.removeSubandDumpPath(list(target_paths))
# 去除子目录\重复目录
sum_path = PathUtils.removeSubandDumpPath(list(target_paths))
targets = []
# 每个目录获取 target
for path in sum_path:
targets += XTSTargetUtils.getTargetfromPath(self._xts_root_dir, path)
targets = []
# 每个目录获取 target
for path in sum_path:
targets += XTSTargetUtils.getTargetfromPath(self._xts_root_dir, path)
return 0, list(targets)
return 0, targets
def generate(xts_root_dir, change_info_file, build_target):

View File

@ -23,6 +23,8 @@ import json
HOME = os.path.dirname(os.path.dirname(os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
XTS_SUITENAME = os.getenv("XTS_SUITENAME") if 'XTS_SUITENAME' in os.environ else os.getenv("xts_suitename")
class ChangeFileEntity:
def __init__(self, name, path):
self.name = name
@ -112,9 +114,6 @@ class XTSUtils:
# 当前file对应BUILD.gn路径
build_File = XTSTargetUtils.get_current_Build(self._xts_root_dir, file)
# 计算到根目录或指定目录,直接编译全量
print(f"file: {file}")
print(f"ALL_COM_PATH_LIST: {XTSTargetUtils.ALL_COM_PATH_LIST}")
print(f"HOME: {HOME}")
if (os.path.dirname(build_File) == self._xts_root_dir or
PathUtils.isContainsKeywords(file, XTSTargetUtils.ALL_COM_PATH_LIST)):
self._build_paths = [self._xts_root_dir]
@ -146,7 +145,7 @@ class XTSUtils:
class XTSTargetUtils:
# 不需要编译的目录,包括deploy_testtools(所有的都编),lite
EXCEPTION_PATH_LIST = [
"/acts/testtools/"
f"/{XTS_SUITENAME}/testtools/"
"_lite/",
"/acts/applications/kitframework_ipcamera/",
"/acts/applications/kitframework/",
@ -154,7 +153,7 @@ class XTSTargetUtils:
]
ALL_COM_PATH_LIST = [
"/acts/build/"
f"/{XTS_SUITENAME}/build/"
]
SKIP_JUDGE_PATH_LIST = [