• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1package {
2    default_applicable_licenses: ["external_clang_license"],
3}
4
5// Added automatically by a large-scale-change that took the approach of
6// 'apply every license found to every target'. While this makes sure we respect
7// every license restriction, it may not be entirely correct.
8//
9// e.g. GPL in an MIT project might only apply to the contrib/ directory.
10//
11// Please consider splitting the single license below into multiple licenses,
12// taking care not to lose any license_kind information, and overriding the
13// default license using the 'licenses: [...]' property on targets as needed.
14//
15// For unused files, consider creating a 'fileGroup' with "//visibility:private"
16// to attach the license to, and including a comment whether the files may be
17// used in the current project.
18//
19// large-scale-change included anything that looked like it might be a license
20// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
21//
22// Please consider removing redundant or irrelevant files from 'license_text:'.
23//
24// large-scale-change filtered out the below license kinds as false-positives:
25//   SPDX-license-identifier-GPL
26// See: http://go/android-license-faq
27license {
28    name: "external_clang_license",
29    visibility: [":__subpackages__"],
30    license_kinds: [
31        "SPDX-license-identifier-Apache-2.0",
32        "SPDX-license-identifier-BSD",
33        "SPDX-license-identifier-MIT",
34        "SPDX-license-identifier-NCSA",
35    ],
36    license_text: [
37        "LICENSE.TXT",
38        "NOTICE",
39    ],
40}
41
42cc_defaults {
43    name: "clang-defaults",
44    defaults: [
45        "llvm-defaults",
46    ],
47
48    header_libs: ["clang-headers"],
49
50    cflags: [
51        "-Wno-cast-qual",
52        "-Wno-long-long",
53        "-Wno-unreachable-code-loop-increment",
54        "-Wno-unused-lambda-capture",
55        "-Wno-unused-private-field",
56    ],
57
58    include_dirs: [
59        "external/clang/include",
60        "external/clang/lib/CodeGen",
61    ],
62
63    tidy_checks: [
64        "-google-runtime-member-string-references",
65    ],
66
67    target: {
68        windows: {
69            enabled: true,
70            cflags: [
71                // This triggers an assertion on cross Windows builds.
72                "-Wno-error=uninitialized",
73            ],
74        },
75        not_windows: {
76            cflags: [
77                "-Wno-unused-lambda-capture",
78            ],
79        },
80    },
81
82}
83
84clang_generated_headers = [
85    "clang-gen-options",
86    "clang-gen-attributes",
87    "clang-gen-checkers",
88    "clang-gen-comment-commands",
89    "clang-gen-comment-html-named-character-references",
90    "clang-gen-html-tags",
91    "clang-gen-comment-nodes",
92    "clang-gen-diagnostics",
93    "clang-gen-declnodes",
94    "clang-gen-statnodes",
95    "clang-gen-arm-neon",
96    "clang-version",
97    "llvm-gen-attributes",
98    "llvm-gen-intrinsics",
99]
100
101cc_library_headers {
102    name: "clang-headers",
103    vendor_available: true,
104    product_available: true,
105    host_supported: true,
106    // TODO(b/153609531): remove when no longer needed.
107    native_bridge_supported: true,
108    generated_headers: clang_generated_headers,
109    export_include_dirs: ["include"],
110    export_generated_headers: clang_generated_headers,
111    target: {
112        windows: {
113            enabled: true,
114        },
115    },
116}
117
118llvm_tblgen {
119    name: "clang-gen-options",
120    in: "include/clang/Driver/Options.td",
121    outs: ["clang/Driver/Options.inc"],
122}
123
124clang_tblgen {
125    name: "clang-gen-attributes",
126    in: "include/clang/Basic/Attr.td",
127    outs: [
128        "clang/AST/AttrDump.inc",
129        "clang/AST/AttrImpl.inc",
130        "clang/AST/Attrs.inc",
131        "clang/AST/AttrVisitor.inc",
132        "clang/Basic/AttrHasAttributeImpl.inc",
133        "clang/Basic/AttrList.inc",
134        "clang/Parse/AttrParserStringSwitches.inc",
135        "clang/Sema/AttrParsedAttrImpl.inc",
136        "clang/Sema/AttrParsedAttrKinds.inc",
137        "clang/Sema/AttrParsedAttrList.inc",
138        "clang/Sema/AttrSpellingListIndex.inc",
139        "clang/Sema/AttrTemplateInstantiate.inc",
140        "clang/Serialization/AttrPCHRead.inc",
141        "clang/Serialization/AttrPCHWrite.inc",
142    ],
143}
144
145clang_tblgen {
146    name: "clang-gen-checkers",
147    in: "include/clang/StaticAnalyzer/Checkers/Checkers.td",
148    outs: ["clang/StaticAnalyzer/Checkers/Checkers.inc"],
149}
150
151clang_tblgen {
152    name: "clang-gen-comment-commands",
153    in: "include/clang/AST/CommentCommands.td",
154    outs: [
155        "clang/AST/CommentCommandInfo.inc",
156        "clang/AST/CommentCommandList.inc",
157    ],
158}
159
160clang_tblgen {
161    name: "clang-gen-comment-html-named-character-references",
162    in: "include/clang/AST/CommentHTMLNamedCharacterReferences.td",
163    outs: ["clang/AST/CommentHTMLNamedCharacterReferences.inc"],
164}
165
166clang_tblgen {
167    name: "clang-gen-html-tags",
168    in: "include/clang/AST/CommentHTMLTags.td",
169    outs: [
170        "clang/AST/CommentHTMLTagsProperties.inc",
171        "clang/AST/CommentHTMLTags.inc",
172    ],
173}
174
175clang_tblgen {
176    name: "clang-gen-comment-nodes",
177    in: "include/clang/Basic/CommentNodes.td",
178    outs: ["clang/AST/CommentNodes.inc"],
179}
180
181clang_tblgen {
182    name: "clang-gen-diagnostics",
183    in: "include/clang/Basic/Diagnostic.td",
184    outs: [
185        "clang/Basic/DiagnosticAnalysisKinds.inc",
186        "clang/Basic/DiagnosticASTKinds.inc",
187        "clang/Basic/DiagnosticCommentKinds.inc",
188        "clang/Basic/DiagnosticCommonKinds.inc",
189        "clang/Basic/DiagnosticDriverKinds.inc",
190        "clang/Basic/DiagnosticFrontendKinds.inc",
191        "clang/Basic/DiagnosticLexKinds.inc",
192        "clang/Basic/DiagnosticParseKinds.inc",
193        "clang/Basic/DiagnosticSemaKinds.inc",
194        "clang/Basic/DiagnosticSerializationKinds.inc",
195        "clang/Basic/DiagnosticGroups.inc",
196        "clang/Basic/DiagnosticIndexName.inc",
197    ],
198}
199
200clang_tblgen {
201    name: "clang-gen-declnodes",
202    in: "include/clang/Basic/DeclNodes.td",
203    outs: ["clang/AST/DeclNodes.inc"],
204}
205
206clang_tblgen {
207    name: "clang-gen-statnodes",
208    in: "include/clang/Basic/StmtNodes.td",
209    outs: ["clang/AST/StmtNodes.inc"],
210}
211
212clang_tblgen {
213    name: "clang-gen-arm-neon",
214    in: "include/clang/Basic/arm_neon.td",
215    outs: [
216        "clang/Basic/arm_neon.inc",
217        "clang/Basic/arm_neon.h",
218    ],
219}
220
221genrule {
222    name: "clang-version",
223    cmd: "$(location) $(in) > $(out)",
224    tool_files: [
225        "clang-version-inc.py",
226        "version.py",
227    ],
228    srcs: [
229        "include/clang/Basic/Version.inc.in",
230    ],
231    out: ["clang/Basic/Version.inc"],
232}
233
234cc_library_shared {
235    name: "libclang_android",
236    defaults: [
237        "clang-defaults",
238        "force_build_llvm_components",
239    ],
240
241    host_supported: true,
242
243    whole_static_libs: [
244        "libclangAnalysis",
245        "libclangAST",
246        "libclangASTMatchers",
247        "libclangBasic",
248        "libclangCodeGen",
249        "libclangDriver",
250        "libclangEdit",
251        "libclangFormat",
252        "libclangFrontend",
253        "libclangIndex",
254        "libclangLex",
255        "libclangLibclang",
256        "libclangParse",
257        "libclangRewrite",
258        "libclangRewriteFrontend",
259        "libclangSema",
260        "libclangSerialization",
261        "libclangTooling",
262        "libclangToolingCore",
263    ],
264
265    export_shared_lib_headers: ["libLLVM_android"],
266    shared_libs: ["libLLVM_android"],
267    export_header_lib_headers: ["clang-headers"],
268
269    target: {
270        windows: {
271            host_ldlibs: [
272                "-limagehlp",
273                "-lpsapi",
274                "-lversion",
275            ],
276        },
277        not_windows: {
278            shared_libs: ["libc++"],
279        },
280    },
281
282    product_variables: {
283        unbundled_build: {
284            // Don't build the library in unbundled branches.
285            enabled: false,
286        },
287    },
288}
289
290genrule {
291    name: "renderscript-clang-include",
292    visibility: ["//development/build"],
293    tools: ["soong_zip"],
294    cmd: "$(location soong_zip) -o $(out) -P renderscript/clang-include " +
295        "-C $$(dirname $(location LICENSE.TXT))/lib/Headers -D $$(dirname $(location LICENSE.TXT))/lib/Headers " +
296        "-C $$(dirname $(location LICENSE.TXT)) -f $(location LICENSE.TXT)",
297    srcs: [
298        "lib/Headers/**/*",
299        "LICENSE.TXT",
300    ],
301    out: ["clang-include.zip"],
302}
303