From 054d12c640e7bb5c7736c1a9cbc275c87aaf1fbb Mon Sep 17 00:00:00 2001 From: thomas-bc Date: Mon, 6 Nov 2023 14:30:19 -0800 Subject: [PATCH 1/2] Print output when refreshing cache --- src/fprime/fbuild/cmake.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fprime/fbuild/cmake.py b/src/fprime/fbuild/cmake.py index 8a2e05c2..f5d0833c 100644 --- a/src/fprime/fbuild/cmake.py +++ b/src/fprime/fbuild/cmake.py @@ -439,7 +439,7 @@ def cmake_refresh_cache(self, build_dir, full=False): run_args, write_override=True, environment=environment, - print_output=self.verbose, + print_output=True, ) else: if self.verbose: @@ -450,7 +450,7 @@ def cmake_refresh_cache(self, build_dir, full=False): None, top_target=True, full_cache_rebuild=True, - print_output=self.verbose, + print_output=True, ) def _run_cmake( From a4c28a8473750ad63e306794b17dfecc79567b0e Mon Sep 17 00:00:00 2001 From: thomas-bc Date: Mon, 13 Nov 2023 16:47:24 -0800 Subject: [PATCH 2/2] Add backwards compatibility --- src/fprime/fbuild/cmake.py | 42 ++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/src/fprime/fbuild/cmake.py b/src/fprime/fbuild/cmake.py index f5d0833c..31542f07 100644 --- a/src/fprime/fbuild/cmake.py +++ b/src/fprime/fbuild/cmake.py @@ -306,6 +306,8 @@ def get_project_relative_path(self, path, build_dir): Returns: path string that is relative to some root of the project. i.e. used for target suffix names """ + if path is None: + path = os.getcwd() # Get module name from the relative path to include root include_root = self.get_include_info(path, build_dir)[1] return os.path.relpath(path, include_root) @@ -341,6 +343,17 @@ def get_available_targets(self, build_dir, path): if make.startswith(prefix) ] + def is_target_supported(self, build_dir: str, target: str): + """Checks if a target is supported by the current build directory + + Args: + build_dir: build directory to use for detecting targets + target: target name to check + """ + # Load in self.cached_help_targets + self.get_available_targets(build_dir, None) + return target in self.cached_help_targets + @staticmethod def purge(build_dir): """ @@ -425,7 +438,7 @@ def cmake_refresh_cache(self, build_dir, full=False): for before the utility gives up and produces. :param build_dir: directory to build in - :param full: full re-generate of the cache. Default: false, attempt to build 'noop' target instead + :param full: full re-generate of the cache. Default: false, attempt to build 'refresh_cache' target instead """ if full: environment = {} @@ -444,14 +457,25 @@ def cmake_refresh_cache(self, build_dir, full=False): else: if self.verbose: print("[CMAKE] Checking CMake cache for rebuild") - self.execute_known_target( - "noop", - build_dir, - None, - top_target=True, - full_cache_rebuild=True, - print_output=True, - ) + # Backwards compatibility: refresh_cache was named noop until v3.3.x + if self.is_target_supported(build_dir, "noop"): + self.execute_known_target( + "noop", + build_dir, + None, + top_target=True, + full_cache_rebuild=True, + print_output=True, + ) + else: + self.execute_known_target( + "refresh_cache", + build_dir, + None, + top_target=True, + full_cache_rebuild=True, + print_output=True, + ) def _run_cmake( self,