diff --git a/config/spinoffconfig.py b/config/spinoffconfig.py index bf2f8aa9..abd43e46 100644 --- a/config/spinoffconfig.py +++ b/config/spinoffconfig.py @@ -163,6 +163,7 @@ ctx.filter_file_names = { 'flycheck-dir-locals.el', '.projectile', '.editorconfig', + 'ci.yml', 'LICENSE', 'cloudtool', 'bacloud', @@ -187,6 +188,7 @@ ctx.no_filter_file_names = { '.pylintrc', 'CPPLINT.cfg', '.mypy.ini', + '.efrocachemap', '._ba_sources_hash', '._baplus_sources_hash', '._bascenev1_sources_hash', diff --git a/tools/batools/assetsmakefile.py b/tools/batools/assetsmakefile.py index b4d65c92..1bde1a61 100755 --- a/tools/batools/assetsmakefile.py +++ b/tools/batools/assetsmakefile.py @@ -532,10 +532,11 @@ def generate_assets_makefile( out_files['src/assets/.asset_manifest_public.json'] = _gen_manifest( all_targets_public ) + # Only *generate* the private manifest in the private repo. In public + # we just give what's already on disk. + manprivpath = 'src/assets/.asset_manifest_private.json' if not public: - out_files['src/assets/.asset_manifest_private.json'] = _gen_manifest( - all_targets_private - ) + out_files[manprivpath] = _gen_manifest(all_targets_private) return out_files diff --git a/tools/batools/project/_updater.py b/tools/batools/project/_updater.py index 0d024e08..814deac6 100755 --- a/tools/batools/project/_updater.py +++ b/tools/batools/project/_updater.py @@ -380,15 +380,27 @@ class ProjectUpdater: self._generate_top_level_makefile(path, existing_data) elif path == 'src/assets/Makefile': self._generate_assets_makefile(path, existing_data) - elif path.startswith('src/assets/.asset_manifest_'): - # These are generated as a side-effect of the assets makefile. + elif path.startswith('src/assets/.asset_manifest_public'): + # These are always generated as a side-effect of the + # assets Makefile. self.generate_file('src/assets/Makefile') + elif path.startswith('src/assets/.asset_manifest_private'): + if self.public: + # In public repos these are just pulled through as-is + # from the source project. + self._generate_passthrough_file(path, existing_data) + else: + # In private repos, these are generated as a side-effect + # of the assets Makefile. + self.generate_file('src/assets/Makefile') + elif path == 'src/resources/Makefile': self._generate_resources_makefile(path, existing_data) elif path == 'src/meta/Makefile': self._generate_meta_makefile(existing_data) elif path.startswith('src/meta/.meta_manifest_'): - # These are generated as a side-effect of the meta makefile. + # These are always generated as a side-effect of the + # meta Makefile. self.generate_file('src/meta/Makefile') assert path in self._generated_files else: @@ -649,6 +661,7 @@ class ProjectUpdater: outfiles = generate_assets_makefile( self.projroot, path, existing_data, meta_manifests ) + for out_path, out_contents in outfiles.items(): self._generated_files[out_path] = out_contents @@ -667,6 +680,9 @@ class ProjectUpdater: def _update_meta_makefile(self) -> None: self.enqueue_update('src/meta/Makefile') + def _generate_passthrough_file(self, path: str, existing_data: str) -> None: + self._generated_files[path] = existing_data + def _generate_meta_makefile(self, existing_data: str) -> None: from batools.metamakefile import generate_meta_makefile diff --git a/tools/batools/spinoff/_context.py b/tools/batools/spinoff/_context.py index d8e665e9..64de9df9 100644 --- a/tools/batools/spinoff/_context.py +++ b/tools/batools/spinoff/_context.py @@ -59,6 +59,7 @@ class SpinoffContext: dst_root: str, mode: Mode, force: bool = False, + verbose: bool = False, print_full_lists: bool = False, override_paths: list[str] | None = None, backport_file: str | None = None, @@ -74,6 +75,7 @@ class SpinoffContext: self._mode = mode self._force = force + self._verbose = verbose self._print_full_lists = print_full_lists self._override_paths = override_paths self._backport_file = backport_file @@ -128,6 +130,7 @@ class SpinoffContext: '.asset_manifest_public.json', '.asset_manifest_private.json', } + self._project_file_suffixes = { '.vcxproj', '.vcxproj.filters', @@ -438,11 +441,12 @@ class SpinoffContext: else: assert_never(self._mode) - # Bail at this point if anything went wrong. We don't store state - # or update the .gitignore or anything in that case. - # Note: perhaps we should? If we wrote a bit of stuff and then - # failed we'll get a bunch of complaints about mod times changing - # under us next time we run, right? + # Always write state at this point. Even if there have been + # errors, we want to keep track of the latest states we have for + # anything wrote/etc. + self._write_state() + + # Bail at this point if anything went wrong. if ( self._src_error_entities or self._dst_error_entities @@ -462,10 +466,6 @@ class SpinoffContext: if self._mode is self.Mode.UPDATE or self._mode is self.Mode.OVERRIDE: self._write_gitignore() - # Only writing updated state in case of success. Is there a reason - # we would want to write it on errors also? - self._write_state() - def _apply_project_configs(self) -> None: # pylint: disable=exec-used try: @@ -1418,9 +1418,14 @@ class SpinoffContext: self._execution_error = True print( f'{Clr.RED}Error copying/filtering file:' - f" '{src_path_full}'{Clr.RST}: {exc}.", + f" '{src_path_full}'{Clr.RST}: {exc}" + ' (use --verbose for full traceback)', file=sys.stderr, ) + if self._verbose: + import traceback + + traceback.print_exc(file=sys.stderr) def _handle_src_copy_file( self, diff --git a/tools/batools/spinoff/_main.py b/tools/batools/spinoff/_main.py index 8d8dca0e..9d25b0b2 100644 --- a/tools/batools/spinoff/_main.py +++ b/tools/batools/spinoff/_main.py @@ -124,6 +124,7 @@ def _main() -> None: dst_root, single_run_mode, force='--force' in sys.argv, + verbose='--verbose' in sys.argv, print_full_lists='--full' in sys.argv, ).run()