forked from oils-for-unix/oils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNINJA_subgraph.py
199 lines (173 loc) · 4.54 KB
/
NINJA_subgraph.py
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
"""
cpp/NINJA_subgraph.py
"""
from __future__ import print_function
from build import ninja_lib
from build.ninja_lib import log
# Some tests use #ifndef CPP_UNIT_TEST to disable circular dependencies on
# generated code
CPP_UNIT_MATRIX = [
('cxx', 'dbg', '-D CPP_UNIT_TEST'),
('cxx', 'asan', '-D CPP_UNIT_TEST'),
('cxx', 'ubsan', '-D CPP_UNIT_TEST'),
#('cxx', 'gcalways', '-D CPP_UNIT_TEST'),
#('cxx', 'rvroot', '-D CPP_UNIT_TEST'),
('clang', 'coverage', '-D CPP_UNIT_TEST'),
]
def NinjaGraph(ru):
ru.comment('Generated by %s' % __name__)
ru.cc_binary(
'cpp/obj_layout_test.cc',
deps = [
'//core/runtime.asdl',
'//mycpp/runtime',
],
# Add tcmalloc for malloc_address_test
matrix = ninja_lib.COMPILERS_VARIANTS + [('cxx', 'tcmalloc')])
ru.cc_library(
'//cpp/core',
srcs = ['cpp/core.cc'],
deps = [
'//frontend/consts', # for gVersion
'//frontend/syntax.asdl',
'//mycpp/runtime',
],
)
ru.cc_binary(
'cpp/core_test.cc',
deps = [
'//cpp/core',
'//cpp/stdlib',
],
matrix = ninja_lib.COMPILERS_VARIANTS)
ru.cc_binary(
'cpp/data_race_test.cc',
deps = [
'//cpp/core',
'//mycpp/runtime',
],
matrix = ninja_lib.SMALL_TEST_MATRIX + [
('cxx', 'tsan'),
('clang', 'tsan'),
])
# Note: depends on code generated by re2c
ru.cc_library(
'//cpp/frontend_match',
srcs = [
'cpp/frontend_match.cc',
],
deps = [
'//frontend/syntax.asdl',
'//frontend/types.asdl',
'//mycpp/runtime',
],
)
ru.cc_library(
'//cpp/frontend_pyreadline',
srcs = [
'cpp/frontend_pyreadline.cc',
],
deps = [
'//cpp/core',
'//mycpp/runtime',
],
)
ru.cc_binary(
'cpp/frontend_match_test.cc',
deps = ['//cpp/frontend_match'],
matrix = ninja_lib.COMPILERS_VARIANTS)
ru.cc_library(
'//cpp/frontend_flag_spec',
srcs = [
'cpp/frontend_flag_spec.cc',
],
deps = [
# Dependencies of //prebuilt/frontend/args.mycpp
'//core/runtime.asdl',
'//frontend/syntax.asdl',
'//frontend/arg_types', # generated code
'//mycpp/runtime',
],
)
ru.cc_binary(
'cpp/frontend_flag_spec_test.cc',
deps = [
'//cpp/frontend_flag_spec',
'//prebuilt/frontend/args.mycpp', # prebuilt args::Reader, etc.
],
# special -D CPP_UNIT_TEST
#matrix = CPP_UNIT_MATRIX)
matrix = ninja_lib.COMPILERS_VARIANTS)
ru.cc_library(
'//cpp/fanos_shared',
srcs = ['cpp/fanos_shared.c'])
ru.cc_library(
'//cpp/fanos',
srcs = ['cpp/fanos.cc'],
deps = ['//cpp/fanos_shared', '//mycpp/runtime'])
ru.cc_library(
'//cpp/libc',
srcs = ['cpp/libc.cc'],
deps = ['//mycpp/runtime'])
ru.cc_binary(
'cpp/libc_test.cc',
deps = ['//cpp/libc'],
matrix = ninja_lib.COMPILERS_VARIANTS)
ru.cc_library(
'//cpp/osh',
srcs = [
'cpp/osh.cc',
'cpp/osh_tdop.cc',
],
deps = [
'//frontend/syntax.asdl',
'//cpp/core',
'//mycpp/runtime',
]
)
ru.cc_binary(
'cpp/osh_test.cc',
deps = [
'//cpp/osh',
'//prebuilt/core/error.mycpp', # prebuilt e_die()
],
matrix = ninja_lib.COMPILERS_VARIANTS)
ru.cc_library(
'//cpp/pgen2',
srcs = ['cpp/pgen2.cc'],
deps = [
'//mycpp/runtime',
'//frontend/syntax.asdl',
])
ru.cc_library(
'//cpp/pylib',
srcs = ['cpp/pylib.cc'],
deps = ['//mycpp/runtime'])
ru.cc_binary(
'cpp/pylib_test.cc',
deps = ['//cpp/pylib'],
matrix = ninja_lib.COMPILERS_VARIANTS)
ru.cc_library(
'//cpp/stdlib',
srcs = ['cpp/stdlib.cc'],
deps = [
'//mycpp/runtime',
# Annoying: because of the circular dep issue, we need to repeat
# dependencies of //prebuilt/core/error.mycpp. We don't want to depend
# on it directly because we'd get duplicate symbols during linking.
'//frontend/syntax.asdl',
])
ru.cc_binary(
'cpp/stdlib_test.cc',
deps = [
'//cpp/stdlib',
'//prebuilt/core/error.mycpp', # prebuilt e_die()
],
matrix = ninja_lib.COMPILERS_VARIANTS)
# Note: there is no cc_library() for qsn.h
ru.cc_binary(
'cpp/qsn_test.cc',
deps = [
'//mycpp/runtime',
],
matrix = ninja_lib.COMPILERS_VARIANTS)