diff --git a/buildbot/osuosl/master/config/builders.py b/buildbot/osuosl/master/config/builders.py --- a/buildbot/osuosl/master/config/builders.py +++ b/buildbot/osuosl/master/config/builders.py @@ -2187,7 +2187,7 @@ 'tags' : ["libunwind", "doc"], 'workernames':["gribozavr3"], 'builddir':"libunwind-sphinx-docs", - 'factory': SphinxDocsBuilder.getSphinxDocsBuildFactory(libunwind_html=True)}, + 'factory': SphinxDocsBuilder.getSphinxRuntimesDocsBuildFactory(libunwind_html=True)}, # Sphinx doc Publisher {'name' : "publish-sphinx-docs", @@ -2196,6 +2196,12 @@ 'builddir': "publish-sphinx-docs", 'factory' : SphinxDocsBuilder.getLLVMDocsBuildFactory(clean=True)}, + {'name' : "publish-runtimes-sphinx-docs", + 'tags' : ["doc"], + 'workernames' : ["as-worker-4"], + 'builddir': "publish-runtimes-sphinx-docs", + 'factory' : SphinxDocsBuilder.getLLVMRuntimesDocsBuildFactory(clean=True)}, + {'name' : "publish-lnt-sphinx-docs", 'tags' : ["doc"], 'workernames' : ["as-worker-4"], diff --git a/zorg/buildbot/builders/SphinxDocsBuilder.py b/zorg/buildbot/builders/SphinxDocsBuilder.py --- a/zorg/buildbot/builders/SphinxDocsBuilder.py +++ b/zorg/buildbot/builders/SphinxDocsBuilder.py @@ -1,4 +1,5 @@ from collections import OrderedDict +import os from buildbot.steps.shell import ShellCommand @@ -28,8 +29,6 @@ clang_html = False, # Build Clang HTML documentation clang_tools_html = False, # Build Clang Extra Tools HTML documentation lld_html = False, # Build LLD HTML documentation - libcxx_html = False, # Build Libc++ HTML documentation - libunwind_html = False, # Build libunwind HTML documentation lldb_html = False, # Build LLDB HTML documentation polly_html = False, # Build Polly HTML documentation extra_configure_args = None, @@ -63,17 +62,12 @@ depends_on_projects.append('lld') if lldb_html: depends_on_projects.append('lldb') - if libcxx_html: - depends_on_projects.append('libcxx') - depends_on_projects.append('libcxxabi') - if libunwind_html: - depends_on_projects.append('libunwind') if polly_html: depends_on_projects.append('polly') + f = UnifiedTreeBuilder.getCmakeBuildFactory( depends_on_projects=depends_on_projects, - enable_runtimes=[], # Docs don't support runtimes build yet. llvm_srcdir=llvm_srcdir, obj_dir=llvm_objdir, extra_configure_args=cmake_args, @@ -127,6 +121,57 @@ targets=['docs-lldb-html'] )) + if polly_html: + f.addStep(NinjaCommand(name="docs-polly-html", + haltOnFailure=True, + description=["Build Polly Sphinx HTML documentation"], + workdir=llvm_objdir, + targets=['docs-polly-html'] + )) + + return f + +def getSphinxRuntimesDocsBuildFactory( + libcxx_html = False, # Build Libc++ HTML documentation + libunwind_html = False, # Build libunwind HTML documentation + extra_configure_args = None, + **kwargs): + + if extra_configure_args: + cmake_args = extra_configure_args[:] + else: + cmake_args = list() + + # Set proper defaults for the config flags. + CmakeCommand.applyDefaultOptions(cmake_args, [ + ('-G', 'Ninja'), + ('-DLLVM_ENABLE_SPHINX=', 'ON'), + ('-DSPHINX_OUTPUT_HTML=', 'ON'), + ('-DSPHINX_OUTPUT_MAN=', 'ON'), + ('-DLLDB_INCLUDE_TESTS=', 'OFF'), + ('-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=', 'ON'), + ('-DLLVM_ENABLE_ASSERTIONS=', 'OFF'), + ]) + + llvm_srcdir = 'llvm/src' + llvm_objdir = 'llvm/build' + + depends_on_runtimes = [] + if libcxx_html: + depends_on_runtimes.append('libcxx') + depends_on_runtimes.append('libcxxabi') + if libunwind_html: + depends_on_runtimes.append('libunwind') + + + f = UnifiedTreeBuilder.getCmakeBuildFactory( + enable_runtimes=depends_on_runtimes, + llvm_srcdir=llvm_srcdir, + src_to_build_dir=os.path.join(llvm_srcdir, 'runtimes'), + obj_dir=llvm_objdir, + extra_configure_args=cmake_args, + **kwargs) # Pass through all the extra arguments. + if libcxx_html: f.addStep(NinjaCommand(name="docs-libcxx-html", haltOnFailure=True, @@ -143,14 +188,6 @@ targets=['docs-libunwind-html'] )) - if polly_html: - f.addStep(NinjaCommand(name="docs-polly-html", - haltOnFailure=True, - description=["Build Polly Sphinx HTML documentation"], - workdir=llvm_objdir, - targets=['docs-polly-html'] - )) - return f @@ -168,9 +205,6 @@ "clang", "clang-tools-extra", "libc", - "libcxx", - "libcxxabi", - "libunwind", "lld", "lldb", "flang", @@ -187,12 +221,6 @@ "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: @@ -227,7 +255,104 @@ f = UnifiedTreeBuilder.getCmakeBuildFactory( clean=clean, depends_on_projects=_depends_on_projects, - enable_runtimes=[], # Docs don't support runtimes build yet. + 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 {}".format(target), + description=[ + "Publish", "just", "built", "documentation", "for", + "{}".format(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/{}".format(remote_path), + ], + env=merged_env, + ) + ) + + return f + +def getLLVMRuntimesDocsBuildFactory( + clean = False, + depends_on_runtimes = None, + extra_configure_args = None, + env = None, + **kwargs): + + if depends_on_runtimes is None: + # All the projects by default. + _depends_on_runtimes=[ + "libcxx", + "libcxxabi", + "libunwind", + ] + else: + # Make a local copy of depends_on_runtimes, as we are going to modify + # that. + _depends_on_runtimes=depends_on_runtimes[:] + # Some runtimes are interdependent for the purpose of documentation. + # Enforce the dependencies. + if "libcxx" in _depends_on_runtimes and \ + "libcxxabi" not in _depends_on_runtimes: + _depends_on_runtimes.append("libcxxabi") + if "libcxxabi" in _depends_on_runtimes and \ + "libcxx" not in _depends_on_runtimes: + _depends_on_runtimes.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 runtimes this builder depends on + docs = [ + llvm_docs[project] for project in llvm_docs.keys() + if project in _depends_on_runtimes + ] + + f = UnifiedTreeBuilder.getCmakeBuildFactory( + clean=clean, + depends_on_projects=[], + enable_runtimes=_depends_on_runtimes, + src_to_build_dir=os.path.join(llvm_srcdir, 'runtimes'), extra_configure_args=cmake_args, env=merged_env, **kwargs) # Pass through all the extra arguments.