def from_file (self, file, file_location, project): """ Creates a virtual target with appropriate name and type from 'file'. If a target with that name in that project was already created, returns that already created target. TODO: more correct way would be to compute path to the file, based on name and source location for the project, and use that path to determine if the target was already created. TODO: passing project with all virtual targets starts to be annoying. """ # Check if we've created a target corresponding to this file. path = os.path.join(os.getcwd(), file_location, file) path = os.path.normpath(path) if self.files_.has_key (path): return self.files_ [path] file_type = type.type (file) result = FileTarget (file, False, file_type, project, None, file_location) self.files_ [path] = result result.set_id(self.next_id_) self.next_id_ = self.next_id_+1 return result
def construct(self, name, source_targets, property_set): action_name = property_set.get("<action>")[0] action = Action(get_manager(), source_targets, action_name[1:], property_set) target = FileTarget(self.name(), type.type(self.name()), self.project(), action, exact=True) return [b2.build.property_set.empty(), [self.project().manager().virtual_targets().register(target)]]
def construct(self, name, source_targets, property_set): action_name = property_set.get("<action>")[0] action = Action(get_manager(), source_targets, action_name[1:], property_set) target = FileTarget(self.name(), type.type(self.name()), self.project(), action, exact=True) return [ b2.build.property_set.empty(), [self.project().manager().virtual_targets().register(target)]]
def construct(self, name, source_targets, property_set): action_name = property_set.get("<action>")[0] action = Action(get_manager(), source_targets, action_name, property_set) # FIXME: type.type uses global data. target = FileTarget(self.name(), 1, type.type(self.name()), self.project(), action) return [ b2.build.property_set.empty(), [self.project().manager().virtual_targets().register(target)]]