blob: 76c5f3be99a36f6c898c6e7f6edaaf4139745e31 [file] [log] [blame]
Jingwen Chen91220d72021-03-24 02:18:33 -04001// Copyright 2021 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14package cc
15
16import (
Jingwen Chen14a8bda2021-06-02 11:10:02 +000017 "fmt"
Jingwen Chened9c17d2021-04-13 07:14:55 +000018 "path/filepath"
Jingwen Chen3950cd62021-05-12 04:33:00 +000019 "strings"
Chris Parsons484e50a2021-05-13 15:13:04 -040020
21 "android/soong/android"
22 "android/soong/bazel"
Liz Kammerba7a9c52021-05-26 08:45:30 -040023
24 "github.com/google/blueprint/proptools"
Jingwen Chen91220d72021-03-24 02:18:33 -040025)
26
27// bp2build functions and helpers for converting cc_* modules to Bazel.
28
29func init() {
30 android.DepsBp2BuildMutators(RegisterDepsBp2Build)
31}
32
33func RegisterDepsBp2Build(ctx android.RegisterMutatorsContext) {
34 ctx.BottomUp("cc_bp2build_deps", depsBp2BuildMutator)
35}
36
37// A naive deps mutator to add deps on all modules across all combinations of
38// target props for cc modules. This is needed to make module -> bazel label
39// resolution work in the bp2build mutator later. This is probably
40// the wrong way to do it, but it works.
41//
42// TODO(jingwen): can we create a custom os mutator in depsBp2BuildMutator to do this?
43func depsBp2BuildMutator(ctx android.BottomUpMutatorContext) {
44 module, ok := ctx.Module().(*Module)
45 if !ok {
46 // Not a cc module
47 return
48 }
49
50 if !module.ConvertWithBp2build(ctx) {
51 return
52 }
53
54 var allDeps []string
55
Liz Kammer9abd62d2021-05-21 08:37:59 -040056 for _, configToProps := range module.GetArchVariantProperties(ctx, &BaseCompilerProperties{}) {
57 for _, props := range configToProps {
58 if baseCompilerProps, ok := props.(*BaseCompilerProperties); ok {
Rupert Shuttleworthc194ffb2021-05-19 06:49:02 -040059 allDeps = append(allDeps, baseCompilerProps.Generated_headers...)
60 allDeps = append(allDeps, baseCompilerProps.Generated_sources...)
61 }
62 }
Chris Parsons484e50a2021-05-13 15:13:04 -040063 }
64
Liz Kammer9abd62d2021-05-21 08:37:59 -040065 for _, configToProps := range module.GetArchVariantProperties(ctx, &BaseLinkerProperties{}) {
66 for _, props := range configToProps {
67 if baseLinkerProps, ok := props.(*BaseLinkerProperties); ok {
Rupert Shuttleworthc194ffb2021-05-19 06:49:02 -040068 allDeps = append(allDeps, baseLinkerProps.Header_libs...)
69 allDeps = append(allDeps, baseLinkerProps.Export_header_lib_headers...)
70 allDeps = append(allDeps, baseLinkerProps.Static_libs...)
Liz Kammer9abd62d2021-05-21 08:37:59 -040071 allDeps = append(allDeps, baseLinkerProps.Exclude_static_libs...)
Rupert Shuttleworthc194ffb2021-05-19 06:49:02 -040072 allDeps = append(allDeps, baseLinkerProps.Whole_static_libs...)
Liz Kammer9abd62d2021-05-21 08:37:59 -040073 allDeps = append(allDeps, baseLinkerProps.Shared_libs...)
74 allDeps = append(allDeps, baseLinkerProps.Exclude_shared_libs...)
Rupert Shuttleworthc194ffb2021-05-19 06:49:02 -040075 }
76 }
Jingwen Chened9c17d2021-04-13 07:14:55 +000077 }
78
Jingwen Chen53681ef2021-04-29 08:15:13 +000079 // Deps in the static: { .. } and shared: { .. } props of a cc_library.
80 if lib, ok := module.compiler.(*libraryDecorator); ok {
Jingwen Chenbcf53042021-05-26 04:42:42 +000081 appendDeps := func(deps []string, p StaticOrSharedProperties) []string {
82 deps = append(deps, p.Static_libs...)
83 deps = append(deps, p.Whole_static_libs...)
84 deps = append(deps, p.Shared_libs...)
85 return deps
86 }
Jingwen Chen53681ef2021-04-29 08:15:13 +000087
Jingwen Chenbcf53042021-05-26 04:42:42 +000088 allDeps = appendDeps(allDeps, lib.SharedProperties.Shared)
89 allDeps = appendDeps(allDeps, lib.StaticProperties.Static)
Jingwen Chen45dec102021-05-19 10:30:29 +000090
91 // TODO(b/186024507, b/186489250): Temporarily exclude adding
92 // system_shared_libs deps until libc and libm builds.
93 // allDeps = append(allDeps, lib.SharedProperties.Shared.System_shared_libs...)
94 // allDeps = append(allDeps, lib.StaticProperties.Static.System_shared_libs...)
Jingwen Chenbcf53042021-05-26 04:42:42 +000095
96 // Deps in the target/arch nested static: { .. } and shared: { .. } props of a cc_library.
97 // target: { <target>: shared: { ... } }
Liz Kammer9abd62d2021-05-21 08:37:59 -040098 for _, configToProps := range module.GetArchVariantProperties(ctx, &SharedProperties{}) {
99 for _, props := range configToProps {
100 if p, ok := props.(*SharedProperties); ok {
Jingwen Chenbcf53042021-05-26 04:42:42 +0000101 allDeps = appendDeps(allDeps, p.Shared)
102 }
103 }
104 }
Liz Kammer9abd62d2021-05-21 08:37:59 -0400105
106 for _, configToProps := range module.GetArchVariantProperties(ctx, &StaticProperties{}) {
107 for _, props := range configToProps {
108 if p, ok := props.(*StaticProperties); ok {
Jingwen Chenbcf53042021-05-26 04:42:42 +0000109 allDeps = appendDeps(allDeps, p.Static)
110 }
111 }
112 }
Jingwen Chen53681ef2021-04-29 08:15:13 +0000113 }
114
Liz Kammer47535c52021-06-02 16:02:22 -0400115 // product variables only support a limited set of fields, this is the full list of field names
116 // related to cc module dependency management that are supported.
117 productVariableDepFields := [4]string{
118 "Shared_libs",
119 "Static_libs",
120 "Exclude_static_libs",
121 "Whole_static_libs",
122 }
123
124 productVariableProps := android.ProductVariableProperties(ctx)
125 for _, name := range productVariableDepFields {
126 props, exists := productVariableProps[name]
127 if !exists {
128 continue
129 }
130 for _, prop := range props {
131 if p, ok := prop.Property.([]string); !ok {
132 ctx.ModuleErrorf("Could not convert product variable %s property", name)
133 } else {
134 allDeps = append(allDeps, p...)
135 }
136 }
137 }
138
Jingwen Chen91220d72021-03-24 02:18:33 -0400139 ctx.AddDependency(module, nil, android.SortedUniqueStrings(allDeps)...)
140}
141
Liz Kammer2222c6b2021-05-24 15:41:47 -0400142// staticOrSharedAttributes are the Bazel-ified versions of StaticOrSharedProperties --
Jingwen Chenbcf53042021-05-26 04:42:42 +0000143// properties which apply to either the shared or static version of a cc_library module.
Liz Kammer2222c6b2021-05-24 15:41:47 -0400144type staticOrSharedAttributes struct {
Jingwen Chenc4dc9b42021-06-11 12:51:48 +0000145 Srcs bazel.LabelListAttribute
146 Srcs_c bazel.LabelListAttribute
147 Srcs_as bazel.LabelListAttribute
148 Copts bazel.StringListAttribute
Jingwen Chen14a8bda2021-06-02 11:10:02 +0000149
Jingwen Chenc4dc9b42021-06-11 12:51:48 +0000150 Static_deps bazel.LabelListAttribute
151 Dynamic_deps bazel.LabelListAttribute
152 Whole_archive_deps bazel.LabelListAttribute
Jingwen Chen53681ef2021-04-29 08:15:13 +0000153}
154
Jingwen Chen14a8bda2021-06-02 11:10:02 +0000155func groupSrcsByExtension(ctx android.TopDownMutatorContext, srcs bazel.LabelListAttribute) (cppSrcs, cSrcs, asSrcs bazel.LabelListAttribute) {
156 // Branch srcs into three language-specific groups.
157 // C++ is the "catch-all" group, and comprises generated sources because we don't
158 // know the language of these sources until the genrule is executed.
159 // TODO(b/190006308): Handle language detection of sources in a Bazel rule.
160 isCSrcOrFilegroup := func(s string) bool {
161 return strings.HasSuffix(s, ".c") || strings.HasSuffix(s, "_c_srcs")
162 }
163
164 isAsmSrcOrFilegroup := func(s string) bool {
165 return strings.HasSuffix(s, ".S") || strings.HasSuffix(s, ".s") || strings.HasSuffix(s, "_as_srcs")
166 }
167
168 // Check that a module is a filegroup type named <label>.
169 isFilegroupNamed := func(m android.Module, fullLabel string) bool {
170 if ctx.OtherModuleType(m) != "filegroup" {
171 return false
172 }
173 labelParts := strings.Split(fullLabel, ":")
174 if len(labelParts) > 2 {
175 // There should not be more than one colon in a label.
176 panic(fmt.Errorf("%s is not a valid Bazel label for a filegroup", fullLabel))
177 } else {
178 return m.Name() == labelParts[len(labelParts)-1]
179 }
180 }
181
182 // Convert the filegroup dependencies into the extension-specific filegroups
183 // filtered in the filegroup.bzl macro.
184 cppFilegroup := func(label string) string {
185 ctx.VisitDirectDeps(func(m android.Module) {
186 if isFilegroupNamed(m, label) {
187 label = label + "_cpp_srcs"
188 return
189 }
190 })
191 return label
192 }
193 cFilegroup := func(label string) string {
194 ctx.VisitDirectDeps(func(m android.Module) {
195 if isFilegroupNamed(m, label) {
196 label = label + "_c_srcs"
197 return
198 }
199 })
200 return label
201 }
202 asFilegroup := func(label string) string {
203 ctx.VisitDirectDeps(func(m android.Module) {
204 if isFilegroupNamed(m, label) {
205 label = label + "_as_srcs"
206 return
207 }
208 })
209 return label
210 }
211
212 cSrcs = bazel.MapLabelListAttribute(srcs, cFilegroup)
213 cSrcs = bazel.FilterLabelListAttribute(cSrcs, isCSrcOrFilegroup)
214
215 asSrcs = bazel.MapLabelListAttribute(srcs, asFilegroup)
216 asSrcs = bazel.FilterLabelListAttribute(asSrcs, isAsmSrcOrFilegroup)
217
218 cppSrcs = bazel.MapLabelListAttribute(srcs, cppFilegroup)
219 cppSrcs = bazel.SubtractBazelLabelListAttribute(cppSrcs, cSrcs)
220 cppSrcs = bazel.SubtractBazelLabelListAttribute(cppSrcs, asSrcs)
221 return
222}
223
Jingwen Chen53681ef2021-04-29 08:15:13 +0000224// bp2buildParseSharedProps returns the attributes for the shared variant of a cc_library.
Liz Kammer2222c6b2021-05-24 15:41:47 -0400225func bp2BuildParseSharedProps(ctx android.TopDownMutatorContext, module *Module) staticOrSharedAttributes {
Jingwen Chen53681ef2021-04-29 08:15:13 +0000226 lib, ok := module.compiler.(*libraryDecorator)
227 if !ok {
Liz Kammer2222c6b2021-05-24 15:41:47 -0400228 return staticOrSharedAttributes{}
Jingwen Chen53681ef2021-04-29 08:15:13 +0000229 }
230
Jingwen Chenbcf53042021-05-26 04:42:42 +0000231 return bp2buildParseStaticOrSharedProps(ctx, module, lib, false)
Jingwen Chen53681ef2021-04-29 08:15:13 +0000232}
233
234// bp2buildParseStaticProps returns the attributes for the static variant of a cc_library.
Liz Kammer2222c6b2021-05-24 15:41:47 -0400235func bp2BuildParseStaticProps(ctx android.TopDownMutatorContext, module *Module) staticOrSharedAttributes {
Jingwen Chen53681ef2021-04-29 08:15:13 +0000236 lib, ok := module.compiler.(*libraryDecorator)
237 if !ok {
Liz Kammer2222c6b2021-05-24 15:41:47 -0400238 return staticOrSharedAttributes{}
Jingwen Chen53681ef2021-04-29 08:15:13 +0000239 }
240
Jingwen Chenbcf53042021-05-26 04:42:42 +0000241 return bp2buildParseStaticOrSharedProps(ctx, module, lib, true)
Liz Kammer2222c6b2021-05-24 15:41:47 -0400242}
243
Jingwen Chenbcf53042021-05-26 04:42:42 +0000244func bp2buildParseStaticOrSharedProps(ctx android.TopDownMutatorContext, module *Module, lib *libraryDecorator, isStatic bool) staticOrSharedAttributes {
245 var props StaticOrSharedProperties
246 if isStatic {
247 props = lib.StaticProperties.Static
248 } else {
249 props = lib.SharedProperties.Shared
Jingwen Chen53681ef2021-04-29 08:15:13 +0000250 }
Jingwen Chenbcf53042021-05-26 04:42:42 +0000251
252 attrs := staticOrSharedAttributes{
Jingwen Chenc4dc9b42021-06-11 12:51:48 +0000253 Copts: bazel.StringListAttribute{Value: props.Cflags},
254 Srcs: bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrc(ctx, props.Srcs)),
255 Static_deps: bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, props.Static_libs)),
256 Dynamic_deps: bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, props.Shared_libs)),
257 Whole_archive_deps: bazel.MakeLabelListAttribute(android.BazelLabelForModuleWholeDeps(ctx, props.Whole_static_libs)),
Jingwen Chenbcf53042021-05-26 04:42:42 +0000258 }
259
Liz Kammer9abd62d2021-05-21 08:37:59 -0400260 setAttrs := func(axis bazel.ConfigurationAxis, config string, props StaticOrSharedProperties) {
Jingwen Chenc4dc9b42021-06-11 12:51:48 +0000261 attrs.Copts.SetSelectValue(axis, config, props.Cflags)
262 attrs.Srcs.SetSelectValue(axis, config, android.BazelLabelForModuleSrc(ctx, props.Srcs))
263 attrs.Static_deps.SetSelectValue(axis, config, android.BazelLabelForModuleDeps(ctx, props.Static_libs))
264 attrs.Dynamic_deps.SetSelectValue(axis, config, android.BazelLabelForModuleDeps(ctx, props.Shared_libs))
265 attrs.Whole_archive_deps.SetSelectValue(axis, config, android.BazelLabelForModuleWholeDeps(ctx, props.Whole_static_libs))
Jingwen Chenbcf53042021-05-26 04:42:42 +0000266 }
267
268 if isStatic {
Liz Kammer9abd62d2021-05-21 08:37:59 -0400269 for axis, configToProps := range module.GetArchVariantProperties(ctx, &StaticProperties{}) {
270 for config, props := range configToProps {
271 if staticOrSharedProps, ok := props.(*StaticProperties); ok {
272 setAttrs(axis, config, staticOrSharedProps.Static)
Jingwen Chenbcf53042021-05-26 04:42:42 +0000273 }
274 }
275 }
276 } else {
Liz Kammer9abd62d2021-05-21 08:37:59 -0400277 for axis, configToProps := range module.GetArchVariantProperties(ctx, &SharedProperties{}) {
278 for config, props := range configToProps {
279 if staticOrSharedProps, ok := props.(*SharedProperties); ok {
280 setAttrs(axis, config, staticOrSharedProps.Shared)
Jingwen Chenbcf53042021-05-26 04:42:42 +0000281 }
282 }
283 }
284 }
285
Jingwen Chenc4dc9b42021-06-11 12:51:48 +0000286 cppSrcs, cSrcs, asSrcs := groupSrcsByExtension(ctx, attrs.Srcs)
287 attrs.Srcs = cppSrcs
288 attrs.Srcs_c = cSrcs
289 attrs.Srcs_as = asSrcs
Jingwen Chen14a8bda2021-06-02 11:10:02 +0000290
Jingwen Chenbcf53042021-05-26 04:42:42 +0000291 return attrs
Jingwen Chen53681ef2021-04-29 08:15:13 +0000292}
293
Rupert Shuttleworthffd45822021-05-14 03:02:34 -0400294// Convenience struct to hold all attributes parsed from prebuilt properties.
295type prebuiltAttributes struct {
296 Src bazel.LabelAttribute
297}
298
299func Bp2BuildParsePrebuiltLibraryProps(ctx android.TopDownMutatorContext, module *Module) prebuiltAttributes {
300 prebuiltLibraryLinker := module.linker.(*prebuiltLibraryLinker)
301 prebuiltLinker := prebuiltLibraryLinker.prebuiltLinker
302
303 var srcLabelAttribute bazel.LabelAttribute
304
305 if len(prebuiltLinker.properties.Srcs) > 1 {
306 ctx.ModuleErrorf("Bp2BuildParsePrebuiltLibraryProps: Expected at most once source file\n")
307 }
308
309 if len(prebuiltLinker.properties.Srcs) == 1 {
Liz Kammer9abd62d2021-05-21 08:37:59 -0400310 srcLabelAttribute.SetValue(android.BazelLabelForModuleSrcSingle(ctx, prebuiltLinker.properties.Srcs[0]))
311 }
312 for axis, configToProps := range module.GetArchVariantProperties(ctx, &prebuiltLinkerProperties{}) {
313 for config, props := range configToProps {
Rupert Shuttleworthffd45822021-05-14 03:02:34 -0400314 if prebuiltLinkerProperties, ok := props.(*prebuiltLinkerProperties); ok {
315 if len(prebuiltLinkerProperties.Srcs) > 1 {
Liz Kammer9abd62d2021-05-21 08:37:59 -0400316 ctx.ModuleErrorf("Bp2BuildParsePrebuiltLibraryProps: Expected at most once source file for %s %s\n", axis, config)
317 continue
318 } else if len(prebuiltLinkerProperties.Srcs) == 0 {
319 continue
Rupert Shuttleworthffd45822021-05-14 03:02:34 -0400320 }
Liz Kammer9abd62d2021-05-21 08:37:59 -0400321 src := android.BazelLabelForModuleSrcSingle(ctx, prebuiltLinkerProperties.Srcs[0])
322 srcLabelAttribute.SetSelectValue(axis, config, src)
Rupert Shuttleworthffd45822021-05-14 03:02:34 -0400323 }
324 }
325 }
326
Rupert Shuttleworthffd45822021-05-14 03:02:34 -0400327 return prebuiltAttributes{
328 Src: srcLabelAttribute,
329 }
330}
331
Jingwen Chen107c0de2021-04-09 10:43:12 +0000332// Convenience struct to hold all attributes parsed from compiler properties.
333type compilerAttributes struct {
Chris Parsons990c4f42021-05-25 12:10:58 -0400334 // Options for all languages
335 copts bazel.StringListAttribute
336 // Assembly options and sources
337 asFlags bazel.StringListAttribute
338 asSrcs bazel.LabelListAttribute
339 // C options and sources
340 conlyFlags bazel.StringListAttribute
341 cSrcs bazel.LabelListAttribute
342 // C++ options and sources
343 cppFlags bazel.StringListAttribute
Jingwen Chened9c17d2021-04-13 07:14:55 +0000344 srcs bazel.LabelListAttribute
Jingwen Chen107c0de2021-04-09 10:43:12 +0000345}
346
Jingwen Chen63930982021-03-24 10:04:33 -0400347// bp2BuildParseCompilerProps returns copts, srcs and hdrs and other attributes.
Jingwen Chen107c0de2021-04-09 10:43:12 +0000348func bp2BuildParseCompilerProps(ctx android.TopDownMutatorContext, module *Module) compilerAttributes {
Jingwen Chen882bcc12021-04-27 05:54:20 +0000349 var srcs bazel.LabelListAttribute
Jingwen Chen107c0de2021-04-09 10:43:12 +0000350 var copts bazel.StringListAttribute
Chris Parsons990c4f42021-05-25 12:10:58 -0400351 var asFlags bazel.StringListAttribute
352 var conlyFlags bazel.StringListAttribute
353 var cppFlags bazel.StringListAttribute
Jingwen Chen63930982021-03-24 10:04:33 -0400354
Chris Parsons484e50a2021-05-13 15:13:04 -0400355 // Creates the -I flags for a directory, while making the directory relative
Jingwen Chened9c17d2021-04-13 07:14:55 +0000356 // to the exec root for Bazel to work.
Chris Parsons484e50a2021-05-13 15:13:04 -0400357 includeFlags := func(dir string) []string {
Jingwen Chened9c17d2021-04-13 07:14:55 +0000358 // filepath.Join canonicalizes the path, i.e. it takes care of . or .. elements.
Chris Parsons484e50a2021-05-13 15:13:04 -0400359 moduleDirRootedPath := filepath.Join(ctx.ModuleDir(), dir)
360 return []string{
361 "-I" + moduleDirRootedPath,
362 // Include the bindir-rooted path (using make variable substitution). This most
363 // closely matches Bazel's native include path handling, which allows for dependency
364 // on generated headers in these directories.
365 // TODO(b/188084383): Handle local include directories in Bazel.
366 "-I$(BINDIR)/" + moduleDirRootedPath,
367 }
Jingwen Chened9c17d2021-04-13 07:14:55 +0000368 }
369
Jingwen Chened9c17d2021-04-13 07:14:55 +0000370 // Parse the list of module-relative include directories (-I).
371 parseLocalIncludeDirs := func(baseCompilerProps *BaseCompilerProperties) []string {
372 // include_dirs are root-relative, not module-relative.
373 includeDirs := bp2BuildMakePathsRelativeToModule(ctx, baseCompilerProps.Include_dirs)
374 return append(includeDirs, baseCompilerProps.Local_include_dirs...)
375 }
376
Chris Parsons990c4f42021-05-25 12:10:58 -0400377 parseCommandLineFlags := func(soongFlags []string) []string {
378 var result []string
379 for _, flag := range soongFlags {
Colin Cross52aa4e12021-05-25 15:20:39 +0000380 // Soong's cflags can contain spaces, like `-include header.h`. For
381 // Bazel's copts, split them up to be compatible with the
382 // no_copts_tokenization feature.
Chris Parsons990c4f42021-05-25 12:10:58 -0400383 result = append(result, strings.Split(flag, " ")...)
Colin Cross52aa4e12021-05-25 15:20:39 +0000384 }
Chris Parsons990c4f42021-05-25 12:10:58 -0400385 return result
386 }
387
388 // Parse the list of copts.
389 parseCopts := func(baseCompilerProps *BaseCompilerProperties) []string {
390 var copts []string
391 copts = append(copts, parseCommandLineFlags(baseCompilerProps.Cflags)...)
Jingwen Chened9c17d2021-04-13 07:14:55 +0000392 for _, dir := range parseLocalIncludeDirs(baseCompilerProps) {
Chris Parsons484e50a2021-05-13 15:13:04 -0400393 copts = append(copts, includeFlags(dir)...)
Jingwen Chened9c17d2021-04-13 07:14:55 +0000394 }
395 return copts
Jingwen Chen63930982021-03-24 10:04:33 -0400396 }
397
Liz Kammer74deed42021-06-02 13:02:03 -0400398 // Parse srcs from an arch or OS's props value.
Jingwen Chene32e9e02021-04-23 09:17:24 +0000399 parseSrcs := func(baseCompilerProps *BaseCompilerProperties) bazel.LabelList {
Chris Parsons484e50a2021-05-13 15:13:04 -0400400 // Add srcs-like dependencies such as generated files.
401 // First create a LabelList containing these dependencies, then merge the values with srcs.
402 generatedHdrsAndSrcs := baseCompilerProps.Generated_headers
403 generatedHdrsAndSrcs = append(generatedHdrsAndSrcs, baseCompilerProps.Generated_sources...)
Chris Parsons484e50a2021-05-13 15:13:04 -0400404 generatedHdrsAndSrcsLabelList := android.BazelLabelForModuleDeps(ctx, generatedHdrsAndSrcs)
405
Liz Kammer74deed42021-06-02 13:02:03 -0400406 allSrcsLabelList := android.BazelLabelForModuleSrcExcludes(ctx, baseCompilerProps.Srcs, baseCompilerProps.Exclude_srcs)
Chris Parsons484e50a2021-05-13 15:13:04 -0400407 return bazel.AppendBazelLabelLists(allSrcsLabelList, generatedHdrsAndSrcsLabelList)
Jingwen Chene32e9e02021-04-23 09:17:24 +0000408 }
409
Jingwen Chenc1c26502021-04-05 10:35:13 +0000410 for _, props := range module.compiler.compilerProps() {
411 if baseCompilerProps, ok := props.(*BaseCompilerProperties); ok {
Liz Kammer9abd62d2021-05-21 08:37:59 -0400412 srcs.SetValue(parseSrcs(baseCompilerProps))
Jingwen Chened9c17d2021-04-13 07:14:55 +0000413 copts.Value = parseCopts(baseCompilerProps)
Chris Parsons990c4f42021-05-25 12:10:58 -0400414 asFlags.Value = parseCommandLineFlags(baseCompilerProps.Asflags)
415 conlyFlags.Value = parseCommandLineFlags(baseCompilerProps.Conlyflags)
416 cppFlags.Value = parseCommandLineFlags(baseCompilerProps.Cppflags)
Jingwen Chene32e9e02021-04-23 09:17:24 +0000417
Jingwen Chenc1c26502021-04-05 10:35:13 +0000418 break
419 }
420 }
421
Jingwen Chene32e9e02021-04-23 09:17:24 +0000422 // Handle include_build_directory prop. If the property is true, then the
423 // target has access to all headers recursively in the package, and has
424 // "-I<module-dir>" in its copts.
Jingwen Chened9c17d2021-04-13 07:14:55 +0000425 if c, ok := module.compiler.(*baseCompiler); ok && c.includeBuildDirectory() {
Chris Parsons484e50a2021-05-13 15:13:04 -0400426 copts.Value = append(copts.Value, includeFlags(".")...)
Jingwen Chened9c17d2021-04-13 07:14:55 +0000427 } else if c, ok := module.compiler.(*libraryDecorator); ok && c.includeBuildDirectory() {
Chris Parsons484e50a2021-05-13 15:13:04 -0400428 copts.Value = append(copts.Value, includeFlags(".")...)
Jingwen Chened9c17d2021-04-13 07:14:55 +0000429 }
430
Liz Kammer9abd62d2021-05-21 08:37:59 -0400431 archVariantCompilerProps := module.GetArchVariantProperties(ctx, &BaseCompilerProperties{})
Jingwen Chene32e9e02021-04-23 09:17:24 +0000432
Liz Kammer9abd62d2021-05-21 08:37:59 -0400433 for axis, configToProps := range archVariantCompilerProps {
434 for config, props := range configToProps {
435 if baseCompilerProps, ok := props.(*BaseCompilerProperties); ok {
436 // If there's arch specific srcs or exclude_srcs, generate a select entry for it.
437 // TODO(b/186153868): do this for OS specific srcs and exclude_srcs too.
438 if len(baseCompilerProps.Srcs) > 0 || len(baseCompilerProps.Exclude_srcs) > 0 {
439 srcsList := parseSrcs(baseCompilerProps)
440 srcs.SetSelectValue(axis, config, srcsList)
Liz Kammer9abd62d2021-05-21 08:37:59 -0400441 }
442
443 copts.SetSelectValue(axis, config, parseCopts(baseCompilerProps))
444 asFlags.SetSelectValue(axis, config, parseCommandLineFlags(baseCompilerProps.Asflags))
445 conlyFlags.SetSelectValue(axis, config, parseCommandLineFlags(baseCompilerProps.Conlyflags))
446 cppFlags.SetSelectValue(axis, config, parseCommandLineFlags(baseCompilerProps.Cppflags))
447 }
Jingwen Chenc1c26502021-04-05 10:35:13 +0000448 }
449 }
450
Liz Kammer74deed42021-06-02 13:02:03 -0400451 srcs.ResolveExcludes()
Jingwen Chenc1c26502021-04-05 10:35:13 +0000452
Liz Kammerba7a9c52021-05-26 08:45:30 -0400453 productVarPropNameToAttribute := map[string]*bazel.StringListAttribute{
454 "Cflags": &copts,
455 "Asflags": &asFlags,
456 "CppFlags": &cppFlags,
457 }
Liz Kammer6fd7b3f2021-05-06 13:54:29 -0400458 productVariableProps := android.ProductVariableProperties(ctx)
Liz Kammerba7a9c52021-05-26 08:45:30 -0400459 for propName, attr := range productVarPropNameToAttribute {
460 if props, exists := productVariableProps[propName]; exists {
461 for _, prop := range props {
462 flags, ok := prop.Property.([]string)
463 if !ok {
464 ctx.ModuleErrorf("Could not convert product variable %s property", proptools.PropertyNameForField(propName))
465 }
466 newFlags, _ := bazel.TryVariableSubstitutions(flags, prop.ProductConfigVariable)
Liz Kammer47535c52021-06-02 16:02:22 -0400467 attr.SetSelectValue(bazel.ProductVariableConfigurationAxis(prop.FullConfig), prop.FullConfig, newFlags)
Liz Kammer6fd7b3f2021-05-06 13:54:29 -0400468 }
Liz Kammer6fd7b3f2021-05-06 13:54:29 -0400469 }
470 }
471
Jingwen Chen14a8bda2021-06-02 11:10:02 +0000472 srcs, cSrcs, asSrcs := groupSrcsByExtension(ctx, srcs)
473
Jingwen Chen107c0de2021-04-09 10:43:12 +0000474 return compilerAttributes{
Chris Parsons990c4f42021-05-25 12:10:58 -0400475 copts: copts,
476 srcs: srcs,
477 asFlags: asFlags,
478 asSrcs: asSrcs,
479 cSrcs: cSrcs,
480 conlyFlags: conlyFlags,
481 cppFlags: cppFlags,
Jingwen Chen107c0de2021-04-09 10:43:12 +0000482 }
483}
484
485// Convenience struct to hold all attributes parsed from linker properties.
486type linkerAttributes struct {
Jingwen Chen3d383bb2021-06-09 07:18:37 +0000487 deps bazel.LabelListAttribute
488 dynamicDeps bazel.LabelListAttribute
489 wholeArchiveDeps bazel.LabelListAttribute
490 exportedDeps bazel.LabelListAttribute
491 useLibcrt bazel.BoolAttribute
492 linkopts bazel.StringListAttribute
493 versionScript bazel.LabelAttribute
494 stripKeepSymbols bazel.BoolAttribute
495 stripKeepSymbolsAndDebugFrame bazel.BoolAttribute
496 stripKeepSymbolsList bazel.StringListAttribute
497 stripAll bazel.BoolAttribute
498 stripNone bazel.BoolAttribute
Jingwen Chenc1c26502021-04-05 10:35:13 +0000499}
500
Rupert Shuttleworth143be942021-05-09 23:55:51 -0400501// FIXME(b/187655838): Use the existing linkerFlags() function instead of duplicating logic here
502func getBp2BuildLinkerFlags(linkerProperties *BaseLinkerProperties) []string {
503 flags := linkerProperties.Ldflags
504 if !BoolDefault(linkerProperties.Pack_relocations, true) {
505 flags = append(flags, "-Wl,--pack-dyn-relocs=none")
506 }
507 return flags
508}
509
Lukacs T. Berki1353e592021-04-30 15:35:09 +0200510// bp2BuildParseLinkerProps parses the linker properties of a module, including
Jingwen Chen91220d72021-03-24 02:18:33 -0400511// configurable attribute values.
Jingwen Chen107c0de2021-04-09 10:43:12 +0000512func bp2BuildParseLinkerProps(ctx android.TopDownMutatorContext, module *Module) linkerAttributes {
Liz Kammer47535c52021-06-02 16:02:22 -0400513 var headerDeps bazel.LabelListAttribute
514 var staticDeps bazel.LabelListAttribute
Chris Parsonsd6358772021-05-18 18:35:24 -0400515 var exportedDeps bazel.LabelListAttribute
Rupert Shuttleworthc50fa8d2021-05-06 02:40:33 -0400516 var dynamicDeps bazel.LabelListAttribute
Chris Parsons08648312021-05-06 16:23:19 -0400517 var wholeArchiveDeps bazel.LabelListAttribute
Jingwen Chen63930982021-03-24 10:04:33 -0400518 var linkopts bazel.StringListAttribute
Lukacs T. Berki1353e592021-04-30 15:35:09 +0200519 var versionScript bazel.LabelAttribute
Liz Kammerd366c902021-06-03 13:43:01 -0400520 var useLibcrt bazel.BoolAttribute
Jingwen Chen63930982021-03-24 10:04:33 -0400521
Jingwen Chen3d383bb2021-06-09 07:18:37 +0000522 var stripKeepSymbols bazel.BoolAttribute
523 var stripKeepSymbolsAndDebugFrame bazel.BoolAttribute
524 var stripKeepSymbolsList bazel.StringListAttribute
525 var stripAll bazel.BoolAttribute
526 var stripNone bazel.BoolAttribute
527
528 if libraryDecorator, ok := module.linker.(*libraryDecorator); ok {
529 stripProperties := libraryDecorator.stripper.StripProperties
530 stripKeepSymbols.Value = stripProperties.Strip.Keep_symbols
531 stripKeepSymbolsList.Value = stripProperties.Strip.Keep_symbols_list
532 stripKeepSymbolsAndDebugFrame.Value = stripProperties.Strip.Keep_symbols_and_debug_frame
533 stripAll.Value = stripProperties.Strip.All
534 stripNone.Value = stripProperties.Strip.None
535 }
536
537 for axis, configToProps := range module.GetArchVariantProperties(ctx, &StripProperties{}) {
538 for config, props := range configToProps {
539 if stripProperties, ok := props.(*StripProperties); ok {
540 stripKeepSymbols.SetSelectValue(axis, config, stripProperties.Strip.Keep_symbols)
541 stripKeepSymbolsList.SetSelectValue(axis, config, stripProperties.Strip.Keep_symbols_list)
542 stripKeepSymbolsAndDebugFrame.SetSelectValue(axis, config, stripProperties.Strip.Keep_symbols_and_debug_frame)
543 stripAll.SetSelectValue(axis, config, stripProperties.Strip.All)
544 stripNone.SetSelectValue(axis, config, stripProperties.Strip.None)
545 }
546 }
547 }
548
Jingwen Chen91220d72021-03-24 02:18:33 -0400549 for _, linkerProps := range module.linker.linkerProps() {
550 if baseLinkerProps, ok := linkerProps.(*BaseLinkerProperties); ok {
Liz Kammer47535c52021-06-02 16:02:22 -0400551 // Excludes to parallel Soong:
552 // https://cs.android.com/android/platform/superproject/+/master:build/soong/cc/linker.go;l=247-249;drc=088b53577dde6e40085ffd737a1ae96ad82fc4b0
553 staticLibs := android.FirstUniqueStrings(baseLinkerProps.Static_libs)
554 staticDeps.Value = android.BazelLabelForModuleDepsExcludes(ctx, staticLibs, baseLinkerProps.Exclude_static_libs)
555 wholeArchiveLibs := android.FirstUniqueStrings(baseLinkerProps.Whole_static_libs)
Liz Kammer2d7bbe32021-06-10 18:20:06 -0400556 wholeArchiveDeps = bazel.MakeLabelListAttribute(android.BazelLabelForModuleWholeDepsExcludes(ctx, wholeArchiveLibs, baseLinkerProps.Exclude_static_libs))
Liz Kammer47535c52021-06-02 16:02:22 -0400557 sharedLibs := android.FirstUniqueStrings(baseLinkerProps.Shared_libs)
558 dynamicDeps = bazel.MakeLabelListAttribute(android.BazelLabelForModuleDepsExcludes(ctx, sharedLibs, baseLinkerProps.Exclude_shared_libs))
Lukacs T. Berki1353e592021-04-30 15:35:09 +0200559
Liz Kammer47535c52021-06-02 16:02:22 -0400560 headerLibs := android.FirstUniqueStrings(baseLinkerProps.Header_libs)
561 headerDeps = bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, headerLibs))
562 // TODO(b/188796939): also handle export_static_lib_headers, export_shared_lib_headers,
563 // export_generated_headers
564 exportedLibs := android.FirstUniqueStrings(baseLinkerProps.Export_header_lib_headers)
565 exportedDeps = bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, exportedLibs))
566
567 linkopts.Value = getBp2BuildLinkerFlags(baseLinkerProps)
Lukacs T. Berki1353e592021-04-30 15:35:09 +0200568 if baseLinkerProps.Version_script != nil {
Liz Kammer9abd62d2021-05-21 08:37:59 -0400569 versionScript.SetValue(android.BazelLabelForModuleSrcSingle(ctx, *baseLinkerProps.Version_script))
Lukacs T. Berki1353e592021-04-30 15:35:09 +0200570 }
Liz Kammerd366c902021-06-03 13:43:01 -0400571 useLibcrt.Value = baseLinkerProps.libCrt()
Rupert Shuttleworthc50fa8d2021-05-06 02:40:33 -0400572
Jingwen Chen91220d72021-03-24 02:18:33 -0400573 break
574 }
575 }
576
Liz Kammer9abd62d2021-05-21 08:37:59 -0400577 for axis, configToProps := range module.GetArchVariantProperties(ctx, &BaseLinkerProperties{}) {
578 for config, props := range configToProps {
579 if baseLinkerProps, ok := props.(*BaseLinkerProperties); ok {
Liz Kammer47535c52021-06-02 16:02:22 -0400580 staticLibs := android.FirstUniqueStrings(baseLinkerProps.Static_libs)
581 staticDeps.SetSelectValue(axis, config, android.BazelLabelForModuleDepsExcludes(ctx, staticLibs, baseLinkerProps.Exclude_static_libs))
582 wholeArchiveLibs := android.FirstUniqueStrings(baseLinkerProps.Whole_static_libs)
Liz Kammer2d7bbe32021-06-10 18:20:06 -0400583 wholeArchiveDeps.SetSelectValue(axis, config, android.BazelLabelForModuleWholeDepsExcludes(ctx, wholeArchiveLibs, baseLinkerProps.Exclude_static_libs))
Liz Kammer47535c52021-06-02 16:02:22 -0400584 sharedLibs := android.FirstUniqueStrings(baseLinkerProps.Shared_libs)
585 dynamicDeps.SetSelectValue(axis, config, android.BazelLabelForModuleDepsExcludes(ctx, sharedLibs, baseLinkerProps.Exclude_shared_libs))
Rupert Shuttleworthc194ffb2021-05-19 06:49:02 -0400586
Liz Kammer47535c52021-06-02 16:02:22 -0400587 headerLibs := android.FirstUniqueStrings(baseLinkerProps.Header_libs)
588 headerDeps.SetSelectValue(axis, config, android.BazelLabelForModuleDeps(ctx, headerLibs))
589 exportedLibs := android.FirstUniqueStrings(baseLinkerProps.Export_header_lib_headers)
590 exportedDeps.SetSelectValue(axis, config, android.BazelLabelForModuleDeps(ctx, exportedLibs))
591
592 linkopts.SetSelectValue(axis, config, getBp2BuildLinkerFlags(baseLinkerProps))
Rupert Shuttleworth22cd2eb2021-05-27 02:15:54 -0400593 if baseLinkerProps.Version_script != nil {
Liz Kammer9abd62d2021-05-21 08:37:59 -0400594 versionScript.SetSelectValue(axis, config, android.BazelLabelForModuleSrcSingle(ctx, *baseLinkerProps.Version_script))
Rupert Shuttleworth22cd2eb2021-05-27 02:15:54 -0400595 }
Liz Kammerd366c902021-06-03 13:43:01 -0400596 useLibcrt.SetSelectValue(axis, config, baseLinkerProps.libCrt())
Rupert Shuttleworthc194ffb2021-05-19 06:49:02 -0400597 }
Jingwen Chen91220d72021-03-24 02:18:33 -0400598 }
599 }
600
Liz Kammer47535c52021-06-02 16:02:22 -0400601 type productVarDep struct {
602 // the name of the corresponding excludes field, if one exists
603 excludesField string
604 // reference to the bazel attribute that should be set for the given product variable config
605 attribute *bazel.LabelListAttribute
Liz Kammer2d7bbe32021-06-10 18:20:06 -0400606
607 depResolutionFunc func(ctx android.BazelConversionPathContext, modules, excludes []string) bazel.LabelList
Liz Kammer47535c52021-06-02 16:02:22 -0400608 }
609
610 productVarToDepFields := map[string]productVarDep{
611 // product variables do not support exclude_shared_libs
Liz Kammer2d7bbe32021-06-10 18:20:06 -0400612 "Shared_libs": productVarDep{attribute: &dynamicDeps, depResolutionFunc: android.BazelLabelForModuleDepsExcludes},
613 "Static_libs": productVarDep{"Exclude_static_libs", &staticDeps, android.BazelLabelForModuleDepsExcludes},
614 "Whole_static_libs": productVarDep{"Exclude_static_libs", &wholeArchiveDeps, android.BazelLabelForModuleWholeDepsExcludes},
Liz Kammer47535c52021-06-02 16:02:22 -0400615 }
616
617 productVariableProps := android.ProductVariableProperties(ctx)
618 for name, dep := range productVarToDepFields {
619 props, exists := productVariableProps[name]
620 excludeProps, excludesExists := productVariableProps[dep.excludesField]
621 // if neither an include or excludes property exists, then skip it
622 if !exists && !excludesExists {
623 continue
624 }
625 // collect all the configurations that an include or exclude property exists for.
626 // we want to iterate all configurations rather than either the include or exclude because for a
627 // particular configuration we may have only and include or only an exclude to handle
628 configs := make(map[string]bool, len(props)+len(excludeProps))
629 for config := range props {
630 configs[config] = true
631 }
632 for config := range excludeProps {
633 configs[config] = true
634 }
635
636 for config := range configs {
637 prop, includesExists := props[config]
638 excludesProp, excludesExists := excludeProps[config]
639 var includes, excludes []string
640 var ok bool
641 // if there was no includes/excludes property, casting fails and that's expected
642 if includes, ok = prop.Property.([]string); includesExists && !ok {
643 ctx.ModuleErrorf("Could not convert product variable %s property", name)
644 }
645 if excludes, ok = excludesProp.Property.([]string); excludesExists && !ok {
646 ctx.ModuleErrorf("Could not convert product variable %s property", dep.excludesField)
647 }
Liz Kammer2d7bbe32021-06-10 18:20:06 -0400648
649 dep.attribute.SetSelectValue(bazel.ProductVariableConfigurationAxis(config), config, dep.depResolutionFunc(ctx, android.FirstUniqueStrings(includes), excludes))
Liz Kammer47535c52021-06-02 16:02:22 -0400650 }
651 }
652
653 staticDeps.ResolveExcludes()
654 dynamicDeps.ResolveExcludes()
655 wholeArchiveDeps.ResolveExcludes()
656
657 headerDeps.Append(staticDeps)
658
Jingwen Chen107c0de2021-04-09 10:43:12 +0000659 return linkerAttributes{
Liz Kammer47535c52021-06-02 16:02:22 -0400660 deps: headerDeps,
Chris Parsonsd6358772021-05-18 18:35:24 -0400661 exportedDeps: exportedDeps,
Chris Parsons08648312021-05-06 16:23:19 -0400662 dynamicDeps: dynamicDeps,
663 wholeArchiveDeps: wholeArchiveDeps,
664 linkopts: linkopts,
Liz Kammerd366c902021-06-03 13:43:01 -0400665 useLibcrt: useLibcrt,
Chris Parsons08648312021-05-06 16:23:19 -0400666 versionScript: versionScript,
Jingwen Chen3d383bb2021-06-09 07:18:37 +0000667
668 // Strip properties
669 stripKeepSymbols: stripKeepSymbols,
670 stripKeepSymbolsAndDebugFrame: stripKeepSymbolsAndDebugFrame,
671 stripKeepSymbolsList: stripKeepSymbolsList,
672 stripAll: stripAll,
673 stripNone: stripNone,
Jingwen Chen107c0de2021-04-09 10:43:12 +0000674 }
Jingwen Chen91220d72021-03-24 02:18:33 -0400675}
676
Jingwen Chened9c17d2021-04-13 07:14:55 +0000677// Relativize a list of root-relative paths with respect to the module's
678// directory.
679//
680// include_dirs Soong prop are root-relative (b/183742505), but
681// local_include_dirs, export_include_dirs and export_system_include_dirs are
682// module dir relative. This function makes a list of paths entirely module dir
683// relative.
684//
685// For the `include` attribute, Bazel wants the paths to be relative to the
686// module.
687func bp2BuildMakePathsRelativeToModule(ctx android.BazelConversionPathContext, paths []string) []string {
Rupert Shuttleworthb8151682021-04-06 20:06:21 +0000688 var relativePaths []string
689 for _, path := range paths {
Jingwen Chened9c17d2021-04-13 07:14:55 +0000690 // Semantics of filepath.Rel: join(ModuleDir, rel(ModuleDir, path)) == path
691 relativePath, err := filepath.Rel(ctx.ModuleDir(), path)
692 if err != nil {
693 panic(err)
694 }
Rupert Shuttleworthb8151682021-04-06 20:06:21 +0000695 relativePaths = append(relativePaths, relativePath)
696 }
697 return relativePaths
698}
699
Jingwen Chen882bcc12021-04-27 05:54:20 +0000700func bp2BuildParseExportedIncludes(ctx android.TopDownMutatorContext, module *Module) bazel.StringListAttribute {
Jingwen Chen91220d72021-03-24 02:18:33 -0400701 libraryDecorator := module.linker.(*libraryDecorator)
Rupert Shuttleworthffd45822021-05-14 03:02:34 -0400702 return bp2BuildParseExportedIncludesHelper(ctx, module, libraryDecorator)
703}
Jingwen Chen91220d72021-03-24 02:18:33 -0400704
Rupert Shuttleworthffd45822021-05-14 03:02:34 -0400705func Bp2BuildParseExportedIncludesForPrebuiltLibrary(ctx android.TopDownMutatorContext, module *Module) bazel.StringListAttribute {
706 prebuiltLibraryLinker := module.linker.(*prebuiltLibraryLinker)
707 libraryDecorator := prebuiltLibraryLinker.libraryDecorator
708 return bp2BuildParseExportedIncludesHelper(ctx, module, libraryDecorator)
709}
710
711// bp2BuildParseExportedIncludes creates a string list attribute contains the
712// exported included directories of a module.
713func bp2BuildParseExportedIncludesHelper(ctx android.TopDownMutatorContext, module *Module, libraryDecorator *libraryDecorator) bazel.StringListAttribute {
Jingwen Chened9c17d2021-04-13 07:14:55 +0000714 // Export_system_include_dirs and export_include_dirs are already module dir
715 // relative, so they don't need to be relativized like include_dirs, which
716 // are root-relative.
Jingwen Chen91220d72021-03-24 02:18:33 -0400717 includeDirs := libraryDecorator.flagExporter.Properties.Export_system_include_dirs
718 includeDirs = append(includeDirs, libraryDecorator.flagExporter.Properties.Export_include_dirs...)
Rupert Shuttleworthb8151682021-04-06 20:06:21 +0000719 includeDirsAttribute := bazel.MakeStringListAttribute(includeDirs)
Jingwen Chen91220d72021-03-24 02:18:33 -0400720
Rupert Shuttleworthc194ffb2021-05-19 06:49:02 -0400721 getVariantIncludeDirs := func(includeDirs []string, flagExporterProperties *FlagExporterProperties) []string {
722 variantIncludeDirs := flagExporterProperties.Export_system_include_dirs
723 variantIncludeDirs = append(variantIncludeDirs, flagExporterProperties.Export_include_dirs...)
724
725 // To avoid duplicate includes when base includes + arch includes are combined
726 // TODO: This doesn't take conflicts between arch and os includes into account
727 variantIncludeDirs = bazel.SubtractStrings(variantIncludeDirs, includeDirs)
728 return variantIncludeDirs
729 }
730
Liz Kammer9abd62d2021-05-21 08:37:59 -0400731 for axis, configToProps := range module.GetArchVariantProperties(ctx, &FlagExporterProperties{}) {
732 for config, props := range configToProps {
733 if flagExporterProperties, ok := props.(*FlagExporterProperties); ok {
734 archVariantIncludeDirs := getVariantIncludeDirs(includeDirs, flagExporterProperties)
735 if len(archVariantIncludeDirs) > 0 {
736 includeDirsAttribute.SetSelectValue(axis, config, archVariantIncludeDirs)
Rupert Shuttleworthc194ffb2021-05-19 06:49:02 -0400737 }
Rupert Shuttleworth375451e2021-04-26 07:49:08 -0400738 }
Rupert Shuttleworth375451e2021-04-26 07:49:08 -0400739 }
740 }
741
Jingwen Chen882bcc12021-04-27 05:54:20 +0000742 return includeDirsAttribute
Jingwen Chen91220d72021-03-24 02:18:33 -0400743}