def METHOD_NAME(
    project: Project,
    link: Optional[str],
    tmpdir: bool,
    json: bool,
):
    """Build the current project."""
    if link and (json or tmpdir):
        msg = "The --link option is forbidden when using --json or --tmpdir."
        raise click.BadOptionUsage("link", msg)
    if json:
        click.echo(dump_json(project.build_report(tmpdir=tmpdir)), nl=False)
    else:
        text = "Linking and building project..." if link else "Building project..."
        with message_fence(text):
            if link:
                click.echo(project.link(world=link))
            project.METHOD_NAME(tmpdir=tmpdir)