pass in path should be absolute and normalized :param new_version: if LSP is new version and support target prepare
(self, root_path: str, cache_path, new_version)
| 52 | |
| 53 | class State(object): |
| 54 | def __init__(self, root_path: str, cache_path, new_version): |
| 55 | """ |
| 56 | pass in path should be absolute and normalized |
| 57 | :param new_version: if LSP is new version and support target prepare |
| 58 | """ |
| 59 | self.root_path = root_path |
| 60 | self.cache_path = cache_path |
| 61 | self.new_version = new_version |
| 62 | os.makedirs(cache_path, exist_ok=True) |
| 63 | |
| 64 | # buildServer.json used as config dict |
| 65 | config_path = os.path.join(root_path, "buildServer.json") |
| 66 | self.config = ServerConfig(config_path) |
| 67 | |
| 68 | # opened files need to be notified when flags changed |
| 69 | self.observed_uri = set() |
| 70 | # background thread to observe changes |
| 71 | self.observed_thread: Optional[Thread] = None |
| 72 | |
| 73 | # {path: mtime} cache. use to find changes |
| 74 | self.observed_info = {self.config.path: get_mtime(self.config.path)} |
| 75 | |
| 76 | self.reinit_compile_info() |
| 77 | # NOTE:thread-safety: for state shared by main and background watch thread, |
| 78 | # can only changed in sync_compile_file, which block all thread and no one access it. |
| 79 | # other time, the shared state is readonly and safe.. |
| 80 | |
| 81 | def get_compile_file(self, config: ServerConfig): |
| 82 | # isolate xcode generate compile file and manual compile_file |
nothing calls this directly
no test coverage detected