|
6 | 6 |
|
7 | 7 |
|
8 | 8 | globalStore = {} |
9 | | -# inherit compile file, for situation crossing root dir |
10 | | -firstCompileFile = None |
11 | 9 |
|
12 | 10 | cmd_split_pattern = re.compile( |
13 | 11 | r""" |
@@ -214,29 +212,20 @@ def GetFlags(filename: str, compileFile=None, **kwargs): |
214 | 212 | # see store.setdefault to get child attributes |
215 | 213 | store = kwargs.get("store", globalStore) |
216 | 214 | filename = os.path.realpath(filename) |
217 | | - global firstCompileFile |
| 215 | + |
218 | 216 | if compileFile: |
219 | | - if firstCompileFile is None: |
220 | | - firstCompileFile = compileFile |
221 | 217 | if final_flags := GetFlagsInCompile(filename, compileFile, store): |
222 | 218 | return {"flags": final_flags, "do_cache": True} |
223 | 219 |
|
224 | | - if firstCompileFile and firstCompileFile != compileFile: |
225 | | - if final_flags := GetFlagsInCompile(filename, firstCompileFile, store): |
226 | | - return {"flags": final_flags, "do_cache": True} |
227 | | - |
228 | 220 | if filename.endswith(".swift"): |
229 | | - return InferFlagsForSwift(filename, store) |
| 221 | + return InferFlagsForSwift(filename, compileFile, store) |
230 | 222 | return {"flags": [], "do_cache": False} |
231 | 223 |
|
232 | 224 |
|
233 | | -def InferFlagsForSwift(filename, store): |
| 225 | +def InferFlagsForSwift(filename, compileFile, store): |
234 | 226 | """try infer flags by convention and workspace files""" |
235 | | - global firstCompileFile |
236 | 227 | project_root, flagFile, compileFile = findSwiftModuleRoot(filename) |
237 | 228 | logging.debug(f"infer root: {project_root}, {compileFile}") |
238 | | - if firstCompileFile is None: |
239 | | - firstCompileFile = compileFile |
240 | 229 | final_flags = GetFlagsInCompile(filename, compileFile, store) |
241 | 230 |
|
242 | 231 | if not final_flags and flagFile: |
|
0 commit comments