def build_artifact(self, artifact, build_func): """Various parts of the system once they have an artifact and a function to build it, will invoke this function. This ultimately is what builds. The return value is the ctx that was used to build this thing if it was built, or `None` otherwise. """ with reporter.build_artifact(artifact, build_func): if not artifact.is_current: with artifact.update() as ctx: build_func(artifact) return ctx
def build_artifact(self, artifact, build_func): """Various parts of the system once they have an artifact and a function to build it, will invoke this function. This ultimately is what builds. The return value is the ctx that was used to build this thing if it was built, or `None` otherwise. """ is_current = artifact.is_current with reporter.build_artifact(artifact, build_func, is_current): if not is_current: with artifact.update() as ctx: # Upon builing anything we record a dependency to the # project file. This is not ideal but for the moment # it will ensure that if the file changes we will # rebuild. project_file = self.env.project.project_file if project_file: ctx.record_dependency(project_file) build_func(artifact) return ctx