dev #10
|
@ -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))
|
||||
jon-lee marked this conversation as resolved
Outdated
|
||||
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)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import re
|
||||
jon-lee marked this conversation as resolved
张泊明518370910136
commented
Path should not be relative to Path should not be relative to `JOJ3_CONFIG_ROOT` in this file, should be relative to `task.toml` dir
李衍志523370910113
commented
I reckon you said things is relative to I reckon you said things is relative to `JOJ3_CONFIG_ROOT` in JTC before. we have a `task.type` in `task.toml` to mend the path
张泊明518370910136
commented
`config.path` is relative to `JOJ3_CONFIG_ROOT`.
李衍志523370910113
commented
could you explain further? I m not quite sure my understanding is clear. could you explain further? I m not quite sure my understanding is clear.
张泊明518370910136
commented
In In `joj3_config_generator/models/task.py`, `Config.path` is relative to `JOJ3_CONFIG_ROOT`, so `task.toml` will located at `JOJ3_CONFIG_ROOT / task_conf.path` in JTC.
|
||||
import shlex
|
||||
jon-lee marked this conversation as resolved
张泊明518370910136
commented
Some Some `with_.update` is still using raw dict, not model with `model_dump`.
|
||||
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(
|
|||
|
||||
|
||||
jon-lee marked this conversation as resolved
Outdated
张泊明518370910136
commented
should loop through should loop through `conf_stage.parsers` here and update the `with` field according to the parser name.
李衍志523370910113
commented
I think its already implemented in each of the I think its already implemented in each of the `fix_parsers` functions
张泊明518370910136
commented
No, do not find the parser in the No, do not find the parser in the `fix_xxx` function. Instead, iterate through the parsers here and decide how to fill in the `with`.
李衍志523370910113
commented
resolved. resolved.
张泊明518370910136
commented
Use a dict to store parser name, field, function to process.
Use a dict to store parser name, field, function to process.
```
process_dict: Dict[
str, Tuple[Callable[[result.ParserConfig, BaseModel], None], BaseModel]
] = {
"clangtidy": (fix_keyword, task_stage.clangtidy),
"keyword": (fix_keyword, task_stage.keyword),
"diff": (fix_diff, task_stage.diff),
}
for i, parser in enumerate(task_stage.parsers):
if parser in process_dict:
func, parser_model = process_dict[parser]
func(conf_stage.parsers[i], parser_model)
```
李衍志523370910113
commented
resolved. resolved.
|
||||
def get_executor_with_config(
|
||||
jon-lee marked this conversation as resolved
Outdated
张泊明518370910136
commented
Do we need to support both kinds of names? Do we need to support both kinds of names?
李衍志523370910113
commented
probably yes, since it is easy for new ta to type it wrong probably yes, since it is easy for new ta to type it wrong
张泊明518370910136
commented
parsers name should be a str enum, force them to use the correct names parsers name should be a str enum, force them to use the correct names
李衍志523370910113
commented
ok, then removed. ok, then removed.
|
||||
task_stage: task.Stage, cached: List[str]
|
||||
) -> Tuple[result.ExecutorWith, List[str]]:
|
||||
task_stage: task.Stage, cached: Set[str]
|
||||
jon-lee marked this conversation as resolved
Outdated
张泊明518370910136
commented
underscore underscore
李衍志523370910113
commented
fixed fixed
|
||||
) -> 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:
|
||||
jon-lee marked this conversation as resolved
Outdated
张泊明518370910136
commented
not necessary not necessary
李衍志523370910113
commented
resolved. resolved.
|
||||
cached.append(file)
|
||||
return (executor_with_config, cached)
|
||||
cached.add(file)
|
||||
return executor_with_config
|
||||
|
||||
|
||||
def fix_keyword(
|
||||
|
|
|
@ -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": [
|
||||
|
|
where is it used?
this should be storing all the files that are about to be copy in or out
It is as the input and output for the following functions about parsers
so this feature is not implemented?
it is
this is a loop, so this
cached
will be updated in every round of stageThe return value is unnecessary.
I have a lazing coding style here, everything has get imported would get exported, so should maintain this until the end of the loop. Everything is exported in previous stage would be imported in the next stage.
set
try it yourself
I see why
resolved.