(self)
| 203 | self._cache_path = os.path.join(self._config['build_cache_dir'], 'stat_cache.json') |
| 204 | |
| 205 | def execute(self): |
| 206 | if self._is_append: # reload config while append mode |
| 207 | self.debug('generate_file_stat_task in append mode') |
| 208 | from dispatcher import read_freeline_config |
| 209 | self._config = read_freeline_config() |
| 210 | self._stat_cache = load_json_cache(self._cache_path) |
| 211 | |
| 212 | if 'modules' in self._config: |
| 213 | all_modules = self._config['modules'] |
| 214 | else: |
| 215 | all_modules = get_all_modules(os.getcwd()) |
| 216 | |
| 217 | if self._is_append and os.path.exists(self._cache_path): |
| 218 | old_modules = self._stat_cache.keys() |
| 219 | match_arr = [m['name'] for m in all_modules] |
| 220 | match_map = {m['name']: m for m in all_modules} |
| 221 | new_modules = [] |
| 222 | for m in match_arr: |
| 223 | if m not in old_modules: |
| 224 | self.debug('find new module: {}'.format(m)) |
| 225 | new_modules.append(match_map[m]) |
| 226 | |
| 227 | if len(new_modules) > 0: |
| 228 | self._fill_cache_map(new_modules) |
| 229 | self._save_cache() |
| 230 | else: |
| 231 | self.debug('no new modules found.') |
| 232 | else: |
| 233 | self._fill_cache_map(all_modules) |
| 234 | self._save_cache() |
| 235 | |
| 236 | def _fill_cache_map(self, all_modules): |
| 237 | for module in all_modules: |
nothing calls this directly
no test coverage detected