aboutsummaryrefslogtreecommitdiff
path: root/zorg/buildbot/builders/SphinxDocsBuilder.py
blob: bde3223848a1982d84b07299b8177dffb8203afd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
import os
import buildbot.process.factory
from buildbot.steps.source import SVN
from buildbot.steps.shell import ShellCommand
from buildbot.process.properties import WithProperties
from zorg.buildbot.commands.NinjaCommand import NinjaCommand

def getSphinxDocsBuildFactory(
        llvm_html         = False, # Build LLVM HTML documentation
        llvm_man          = False, # Build LLVM man pages
        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
        ):

    f = buildbot.process.factory.BuildFactory()

    llvm_srcdir = 'llvm/src'
    llvm_objdir = 'llvm/build'
    clang_srcdir = llvm_srcdir + '/tools/clang'
    clang_tools_srcdir = llvm_srcdir + '/tools/clang/tools/extra'
    lld_srcdir = llvm_srcdir + '/tools/lld'
    lldb_srcdir = llvm_srcdir + '/tools/lldb'
    libcxx_srcdir = llvm_srcdir + '/projects/libcxx'
    libcxxabi_srcdir = llvm_srcdir + '/projects/libcxxabi'
    libunwind_srcdir = llvm_srcdir + '/projects/libunwind'

    # Get LLVM. This is essential for all builds
    # because we build all subprojects in tree
    f.addStep(SVN(name='svn-llvm',
                  mode='update',
                  baseURL='http://llvm.org/svn/llvm-project/llvm/',
                  defaultBranch='trunk',
                  workdir=llvm_srcdir))

    if clang_html or clang_tools_html or lldb_html:
        f.addStep(SVN(name='svn-clang',
                      mode='update',
                      baseURL='http://llvm.org/svn/llvm-project/cfe/',
                      defaultBranch='trunk',
                      workdir=clang_srcdir))

    if clang_tools_html:
        f.addStep(SVN(name='svn-clang-tools',
                      mode='update',
                      baseURL='http://llvm.org/svn/llvm-project/clang-tools-extra/',
                      defaultBranch='trunk',
                      workdir=clang_tools_srcdir))

    if lld_html:
        f.addStep(SVN(name='svn-lld',
                      mode='update',
                      baseURL='http://llvm.org/svn/llvm-project/lld/',
                      defaultBranch='trunk',
                      workdir=lld_srcdir))

    if lldb_html:
        f.addStep(SVN(name='svn-lldb',
                      mode='update',
                      baseURL='http://llvm.org/svn/llvm-project/lldb/',
                      defaultBranch='trunk',
                      workdir=lldb_srcdir))

    if libcxx_html:
        f.addStep(SVN(name='svn-libcxx',
                      mode='update',
                      baseURL='http://llvm.org/svn/llvm-project/libcxx/',
                      defaultBranch='trunk',
                      workdir=libcxx_srcdir))
        f.addStep(SVN(name='svn-libcxxabi',
                      mode='update',
                      baseURL='http://llvm.org/svn/llvm-project/libcxxabi/',
                      defaultBranch='trunk',
                      workdir=libcxxabi_srcdir))

    if libunwind_html:
        f.addStep(SVN(name='svn-libunwind',
                      mode='update',
                      baseURL='http://llvm.org/svn/llvm-project/libunwind/',
                      defaultBranch='trunk',
                      workdir=libunwind_srcdir))

    # Use CMake to configure
    cmakeCommand = [ "cmake",
                     WithProperties('%s/' + llvm_srcdir, 'workdir'),
                     '-G', 'Ninja',
                     '-DLLVM_ENABLE_SPHINX:BOOL=ON',
                     '-DSPHINX_OUTPUT_HTML:BOOL=ON',
                     '-DSPHINX_OUTPUT_MAN:BOOL=ON',
                     '-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON',
                     '-DLLDB_INCLUDE_TESTS=OFF',
                   ]
    f.addStep(ShellCommand(name="cmake-configure",
                               command=cmakeCommand,
                               description=["cmake configure"],
                               workdir=llvm_objdir))

    if llvm_html:
        f.addStep(NinjaCommand(name="docs-llvm-html",
                               haltOnFailure=True,
                               description=["Build LLVM Sphinx HTML documentation"],
                               workdir=llvm_objdir,
                               targets=['docs-llvm-html']
                              ))

    if llvm_man:
        f.addStep(NinjaCommand(name="docs-llvm-man",
                               haltOnFailure=True,
                               description=["Build LLVM Sphinx man pages"],
                               workdir=llvm_objdir,
                               targets=['docs-llvm-man']
                              ))

    if clang_html:
        f.addStep(NinjaCommand(name="docs-clang-html",
                               haltOnFailure=True,
                               description=["Build Clang Sphinx HTML documentation"],
                               workdir=llvm_objdir,
                               targets=['docs-clang-html']
                              ))

    if clang_tools_html:
        f.addStep(NinjaCommand(name="docs-clang-tools-html",
                               haltOnFailure=True,
                               description=["Build Clang Extra Tools Sphinx HTML documentation"],
                               workdir=llvm_objdir,
                               targets=['docs-clang-tools-html']
                              ))

    if lld_html:
        f.addStep(NinjaCommand(name="docs-lld-html",
                               haltOnFailure=True,
                               description=["Build LLD Sphinx HTML documentation"],
                               workdir=llvm_objdir,
                               targets=['docs-lld-html']
                              ))

    if lldb_html:
        f.addStep(NinjaCommand(name="docs-lldb-html",
                               haltOnFailure=True,
                               description=["Build LLDB Sphinx HTML documentation"],
                               workdir=llvm_objdir,
                               targets=['docs-lldb-html']
                              ))

    if libcxx_html:
        f.addStep(NinjaCommand(name="docs-libcxx-html",
                               haltOnFailure=True,
                               description=["Build Libc++ Sphinx HTML documentation"],
                               workdir=llvm_objdir,
                               targets=['docs-libcxx-html']
                              ))

    if libunwind_html:
        f.addStep(NinjaCommand(name="docs-libunwind-html",
                               haltOnFailure=True,
                               description=["Build libunwind Sphinx HTML documentation"],
                               workdir=llvm_objdir,
                               targets=['docs-libunwind-html']
                              ))

    return f