Fix language autodetection - #1241
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1241 +/- ##
==========================================
+ Coverage 83.00% 83.12% +0.11%
==========================================
Files 151 151
Lines 5732 5760 +28
==========================================
+ Hits 4758 4788 +30
+ Misses 974 972 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
||
| for executor in sorted(executors.values(), key=lambda executor: executor.Executor.name): | ||
| if executor.Executor.ext == ext: | ||
| for executor in sorted(executors.values(), key=lambda executor: executor.Executor.ext_priority, reverse=True): |
There was a problem hiding this comment.
Can we specify a fixed order? Like lexicographically increasing by executor name? I don't want any flaky behaviour and dict value order isn't guaranteed...
| return cls.autoconfig_find_first(cls.get_find_first_mapping()) | ||
|
|
||
| @classmethod | ||
| def get_valid_exts(cls) -> Sequence[str]: |
There was a problem hiding this comment.
Is there a reason why this is a method and not just a class variable?
| class Executor(GCCMixin, CExecutor): | ||
| command = 'gcc' | ||
| std = 'c99' | ||
| ext_priority = 1 |
There was a problem hiding this comment.
Can we use a smarter numbering scheme? Like 111 for Clang C11, 10099 for GCC C99, 10111 for C11, 11114 for C++14, etc.? This way, we don't need to shuffle all the numbers to add a new runtime...
| return (cls.ext,) | ||
|
|
||
| @classmethod | ||
| def supports_multifile(cls) -> bool: |
This PR fixes language auto-detection, supporting sorting by version using the
ext_priorityparameter set in the executor.This, however, raises the possibility of generators/interactors/etc also being compiled with
clang/clang++. Thus it was necessary to also fix multifile support for those languages.Fixes #967; fixes #1233.