diff --git a/joj3_config_generator/convert.py b/joj3_config_generator/convert.py index 1834689..6031218 100644 --- a/joj3_config_generator/convert.py +++ b/joj3_config_generator/convert.py @@ -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) diff --git a/joj3_config_generator/processers/task.py b/joj3_config_generator/processers/task.py index fd2c632..5ad6234 100644 --- a/joj3_config_generator/processers/task.py +++ b/joj3_config_generator/processers/task.py @@ -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( diff --git a/tests/convert/basic/task.json b/tests/convert/basic/task.json index 8fb84c8..375540f 100644 --- a/tests/convert/basic/task.json +++ b/tests/convert/basic/task.json @@ -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": [