示例#1
0
def getLLVMDocsBuildFactory(clean=False,
                            depends_on_projects=None,
                            extra_configure_args=None,
                            env=None,
                            **kwargs):

    if depends_on_projects is None:
        # All the projects by default.
        _depends_on_projects = [
            "llvm",
            "clang",
            "clang-tools-extra",
            "libcxx",
            "libcxxabi",
            "libunwind",
            "lld",
            "lldb",
            "flang",
            "openmp",
            "polly",
        ]
    else:
        # Make a local copy of depends_on_projects, as we are going to modify
        # that.
        _depends_on_projects = depends_on_projects[:]
        # Some projects are interdependent for the purpose of documentation.
        # Enforce the dependencies.
        if ("clang-tools-extra" in _depends_on_projects or \
            "lldb" in _depends_on_projects
           ) and "clang" not in _depends_on_projects:
            _depends_on_projects.append("clang")
        if "libcxx" in _depends_on_projects and \
           "libcxxabi" not in _depends_on_projects:
            _depends_on_projects.append("libcxxabi")
        if "libcxxabi" in _depends_on_projects and \
           "libcxx" not in _depends_on_projects:
            _depends_on_projects.append("libcxx")

    # Make a local copy of the configure args, as we are going to modify that.
    if extra_configure_args:
        cmake_args = extra_configure_args[:]
    else:
        cmake_args = list()

    # Prepare environmental variables. Set here all env we want everywhere.
    merged_env = {
        'TERM': 'dumb'  # Be cautious and disable color output from all tools.
    }
    if env is not None:
        # Overwrite pre-set items with the given ones, so user can set anything.
        merged_env.update(env)

    CmakeCommand.applyDefaultOptions(cmake_args, [
        ("-G", "Ninja"),
        ("-DLLVM_ENABLE_SPHINX=", "ON"),
        ("-DSPHINX_OUTPUT_HTML=", "ON"),
        ("-DSPHINX_OUTPUT_MAN=", "OFF"),
        ("-DSPHINX_WARNINGS_AS_ERRORS=", "OFF"),
        ("-DLLVM_ENABLE_ASSERTIONS=", "OFF"),
        ("-DCMAKE_BUILD_TYPE=", "Release"),
    ])

    # Build docs for each of the projects this builder depends on
    docs = [
        llvm_docs[project] for project in llvm_docs.keys()
        if project in _depends_on_projects
    ]

    f = UnifiedTreeBuilder.getCmakeBuildFactory(
        clean=clean,
        depends_on_projects=_depends_on_projects,
        extra_configure_args=cmake_args,
        env=merged_env,
        **kwargs)  # Pass through all the extra arguments.

    UnifiedTreeBuilder.addNinjaSteps(f,
                                     targets=[d[0] for d in docs],
                                     checks=[],
                                     env=merged_env,
                                     **kwargs)

    # Publish just built documentation
    for target, local_path, remote_path in docs:
        f.addStep(
            ShellCommand(
                name="Publish %s" % target,
                description=[
                    "Publish",
                    "just",
                    "built",
                    "documentation",
                    "fior",
                    "%s" % target,
                ],
                command=[
                    'rsync',
                    '-vrl',
                    '--delete',
                    '--force',
                    '--delay-updates',
                    '--delete-delay',
                    '--ignore-times',
                    '--checksum',
                    '-p',
                    '--chmod=Du=rwx,Dg=rwx,Do=rx,Fu=rw,Fg=rw,Fo=r',
                    "%s" % local_path,
                    "lists.llvm.org:web/%s" % remote_path,
                ],
                env=merged_env,
            ))

    return f
示例#2
0
def getLLVMDocsBuildFactory(clean=True,
                            depends_on_projects=None,
                            extra_configure_args=None,
                            env=None,
                            **kwargs):

    if depends_on_projects is None:
        # All the projects from llvm_docs, and remove all duplicates.
        _depends_on_projects = list(
            set([project for project in llvm_docs if project]))
    else:
        # Make a local copy of depends_on_projects, as we are going to modify
        # that.
        _depends_on_projects = depends_on_projects[:]
        # Some projects are interdependent for the purpose of documentation.
        # Enforce the dependencies.
        # TODO: Check later the dependencies for doxygen docs and enforce them
        # here if needed.

    # Make a local copy of the configure args, as we are going to modify that.
    if extra_configure_args:
        cmake_args = extra_configure_args[:]
    else:
        cmake_args = list()

    # Prepare environmental variables. Set here all env we want everywhere.
    merged_env = {
        'TERM': 'dumb'  # Be cautious and disable color output from all tools.
    }
    if env is not None:
        # Overwrite pre-set items with the given ones, so user can set anything.
        merged_env.update(env)

    CmakeCommand.CmakeCommand.applyDefaultOptions(cmake_args, [
        ("-G", "Ninja"),
        ("-DLLVM_ENABLE_DOXYGEN=", "ON"),
        ("-DLLVM_BUILD_DOCS=", "ON"),
        ("-DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=", "ON"),
        ("-DLLVM_ENABLE_ASSERTIONS=", "OFF"),
        ("-DCMAKE_BUILD_TYPE=", "Release"),
    ])

    f = UnifiedTreeBuilder.getCmakeBuildFactory(
        clean=clean,
        depends_on_projects=_depends_on_projects,
        extra_configure_args=cmake_args,
        env=merged_env,
        **kwargs)  # Pass through all the extra arguments.

    # Build the documentation for all the projects.
    for project in llvm_docs:
        target = llvm_docs[project][0]

        # Build only those with specifies targets.
        if target:
            UnifiedTreeBuilder.addNinjaSteps(
                f,
                # Doxygen builds the final result for really
                # long time without any output.
                # We have to have a long timeout at this step.
                timeout=10800,
                targets=[target],
                checks=[],
                env=merged_env,
                **kwargs)

    # Publish just built documentation
    for project in llvm_docs:
        target, local_path, remote_path = llvm_docs[project]

        f.addStep(
            ShellCommand(
                name="Publish {}".format(project or target),
                description=[
                    "Publish", "just", "built", "documentation", "for",
                    "{}".format(project or target)
                ],
                command=[
                    'rsync',
                    '-vrl',
                    '--delete',
                    '--force',
                    '--delay-updates',
                    '--delete-delay',
                    '--ignore-times',
                    '--checksum',
                    '-p',
                    '--chmod=Du=rwx,Dg=rwx,Do=rx,Fu=rw,Fg=rw,Fo=r',
                    "{}".format(local_path),
                    "lists.llvm.org:web/doxygen/{}".format(remote_path),
                ],
                env=merged_env,
            ))

    return f