Access to compiler `stdout`
Access is needed to compiler stdout so that warnings may be inspected. A hook allowing post compile processes to crawl this output would allow existing warning checking scripts to be used.
The current fcm-based UM warning checker processes the entire compiler output log. When run against a branch, it restricts itself to reporting problems in the files updated in the branch. According to @jennyhickson, the biggest problems come from changes to the format of the output from the compiler.
I'm going to suggest we split this into two feature requests:
- a hook framework that allows functions to be triggered after specific parts of the build process (see #454)
- an exploration of compiler options that can be used to reformat diagnostic messages (see #455)
In the meantime, if we consolidate the fab logs into a single file, we should be able to carry on using the existing warnings checker.
I am getting tired of writing this :)
The new FabBase can alreay support this easily, since each step is a method that can be overwritten:
class FabBaseWithHooks(FabBase):
def __init__(self):
self._fortran_compile_hook = SOME_FUNCTION_OR_OTHER_OR_NONE
def compile_fortran_step(
self,
common_flags: Optional[List[str]] = None,
path_flags: Optional[List[AddFlags]] = None
) -> None:
"""
super().compile_fortran_step(common_flags, path_flags)
if self._fortran_compile_hook:
self._fortran_compile_hook(....)
You get the idea. Then any build script that inherits from FabBaseWithHooks will have the hooks (as configured).
You could also implement this as a mixin class. I do this with the kernel extraction:
class FabGunghoExtract(ExtractMixin, FabGungho):
pass
That is literally all (except for quite a few of comments etc :) ) to add kernel extraction features to the Gungho (and the same for lfric_atm, gravity_wave, ...)