fix(convert): use set instead list for cached
All checks were successful
build / build (push) Successful in 2m31s
build / build (pull_request) Successful in 2m30s

This commit is contained in:
李衍志523370910113 2025-03-03 11:09:14 +08:00
parent 0c2baf67bd
commit 635405ea2b
3 changed files with 28 additions and 28 deletions

View File

@ -1,5 +1,5 @@
import os
from typing import List
from typing import Set
from joj3_config_generator.models import joj1, repo, result, task
from joj3_config_generator.models.const import CACHE_ROOT, JOJ3_CONFIG_ROOT
@ -35,10 +35,10 @@ def convert(repo_conf: repo.Config, task_conf: task.Config) -> result.Config:
# Construct health check stage
if not repo_conf.force_skip_health_check_on_test or not current_test:
result_conf.stage.stages.append(get_health_check_config(repo_conf))
cached: List[str] = []
cached: Set[str] = set()
# Convert each stage in the task configuration
for task_stage in task_conf.stages:
executor_with_config, cached = get_executor_with_config(task_stage, cached)
executor_with_config = get_executor_with_config(task_stage, cached)
conf_stage = get_conf_stage(task_stage, executor_with_config)
conf_stage = fix_result_detail(task_stage, conf_stage)
conf_stage = fix_dummy(task_stage, conf_stage)

View File

@ -1,6 +1,6 @@
import re
import shlex
from typing import List, Tuple
from typing import Set
from joj3_config_generator.models import result, task
from joj3_config_generator.models.const import JOJ3_CONFIG_ROOT
@ -33,8 +33,8 @@ def get_conf_stage(
def get_executor_with_config(
task_stage: task.Stage, cached: List[str]
) -> Tuple[result.ExecutorWith, List[str]]:
task_stage: task.Stage, cached: Set[str]
) -> result.ExecutorWith:
file_import = task_stage.files.import_
copy_in_files = [file for file in file_import if file not in cached]
file_export = task_stage.files.export
@ -61,8 +61,8 @@ def get_executor_with_config(
)
for file in file_export:
if file not in cached:
cached.append(file)
return (executor_with_config, cached)
cached.add(file)
return executor_with_config
def fix_keyword(

View File

@ -222,11 +222,11 @@
}
},
"copyInCached": {
"h7/build/ex2": "h7/build/ex2",
"h7/build/ex2-asan": "h7/build/ex2-asan",
"h7/build/ex2-ubsan": "h7/build/ex2-ubsan",
"h7/build/ex2-msan": "h7/build/ex2-msan",
"h7/build/compile_commands.json": "h7/build/compile_commands.json"
"h7/build/ex2-asan": "h7/build/ex2-asan",
"h7/build/compile_commands.json": "h7/build/compile_commands.json",
"h7/build/ex2": "h7/build/ex2",
"h7/build/ex2-ubsan": "h7/build/ex2-ubsan"
},
"copyInDir": ".",
"copyOut": [
@ -322,11 +322,11 @@
}
},
"copyInCached": {
"h7/build/ex2": "h7/build/ex2",
"h7/build/ex2-asan": "h7/build/ex2-asan",
"h7/build/ex2-ubsan": "h7/build/ex2-ubsan",
"h7/build/ex2-msan": "h7/build/ex2-msan",
"h7/build/compile_commands.json": "h7/build/compile_commands.json"
"h7/build/ex2-asan": "h7/build/ex2-asan",
"h7/build/compile_commands.json": "h7/build/compile_commands.json",
"h7/build/ex2": "h7/build/ex2",
"h7/build/ex2-ubsan": "h7/build/ex2-ubsan"
},
"copyInDir": ".",
"copyOut": [
@ -444,11 +444,11 @@
"cpuSetLimit": "",
"copyIn": {},
"copyInCached": {
"h7/build/ex2": "h7/build/ex2",
"h7/build/ex2-asan": "h7/build/ex2-asan",
"h7/build/ex2-ubsan": "h7/build/ex2-ubsan",
"h7/build/ex2-msan": "h7/build/ex2-msan",
"h7/build/compile_commands.json": "h7/build/compile_commands.json"
"h7/build/ex2-asan": "h7/build/ex2-asan",
"h7/build/compile_commands.json": "h7/build/compile_commands.json",
"h7/build/ex2": "h7/build/ex2",
"h7/build/ex2-ubsan": "h7/build/ex2-ubsan"
},
"copyInDir": ".",
"copyOut": [
@ -542,11 +542,11 @@
"cpuSetLimit": "",
"copyIn": {},
"copyInCached": {
"h7/build/ex2": "h7/build/ex2",
"h7/build/ex2-asan": "h7/build/ex2-asan",
"h7/build/ex2-ubsan": "h7/build/ex2-ubsan",
"h7/build/ex2-msan": "h7/build/ex2-msan",
"h7/build/compile_commands.json": "h7/build/compile_commands.json"
"h7/build/ex2-asan": "h7/build/ex2-asan",
"h7/build/compile_commands.json": "h7/build/compile_commands.json",
"h7/build/ex2": "h7/build/ex2",
"h7/build/ex2-ubsan": "h7/build/ex2-ubsan"
},
"copyInDir": ".",
"copyOut": [
@ -639,11 +639,11 @@
"cpuSetLimit": "",
"copyIn": {},
"copyInCached": {
"h7/build/ex2": "h7/build/ex2",
"h7/build/ex2-asan": "h7/build/ex2-asan",
"h7/build/ex2-ubsan": "h7/build/ex2-ubsan",
"h7/build/ex2-msan": "h7/build/ex2-msan",
"h7/build/compile_commands.json": "h7/build/compile_commands.json"
"h7/build/ex2-asan": "h7/build/ex2-asan",
"h7/build/compile_commands.json": "h7/build/compile_commands.json",
"h7/build/ex2": "h7/build/ex2",
"h7/build/ex2-ubsan": "h7/build/ex2-ubsan"
},
"copyInDir": ".",
"copyOut": [