def _find_or_generate_target_ninja_file(self, target): target_ninja = target._target_file_path('%s.ninja' % target.name) old_rule_hash = self._read_rule_hash(target_ninja) rule_hash = target.rule_hash() if rule_hash == old_rule_hash: return target_ninja rules = target.get_rules() if rules: self._write_target_ninja_file(target, target_ninja, rules, rule_hash) return target_ninja return None
def _find_or_generate_target_ninja_file(self, target): # The `.build.` infix is used to avoid the target ninja file with the # same name as the main build.ninja file (when target.name == 'build') target_ninja = target._target_file_path('%s.build.ninja' % target.name) old_rule_hash = self._read_rule_hash(target_ninja) rule_hash = target.rule_hash() if rule_hash == old_rule_hash: console.debug('Using cached %s' % target_ninja) # If the command is "clean", we still need to generate rules to obtain the clean list if self.__command == 'clean': target.get_rules() return target_ninja rules = target.get_rules() if rules: console.debug('Generating %s' % target_ninja) self._write_target_ninja_file(target, target_ninja, rules, rule_hash) return target_ninja return None