blob: dbb9560baf0dce187aab5536d68dc07deb2679a0 [file] [log] [blame]
Colin Cross581c1892015-04-07 16:50:10 -07001// Copyright 2015 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.
14
15package cc
16
Colin Cross581c1892015-04-07 16:50:10 -070017import (
Inseob Kim21f26902018-09-06 00:55:20 +090018 "path/filepath"
Dan Willemsen1945a4b2019-06-04 17:10:41 -070019 "strings"
Inseob Kim21f26902018-09-06 00:55:20 +090020
Vinh Tran367d89d2023-04-28 11:21:25 -040021 "android/soong/aidl_library"
Trevor Radcliffeef9c9002022-05-13 20:55:35 +000022 "android/soong/bazel"
Vinh Tran367d89d2023-04-28 11:21:25 -040023
Colin Cross581c1892015-04-07 16:50:10 -070024 "github.com/google/blueprint"
Colin Cross581c1892015-04-07 16:50:10 -070025
Colin Cross635c3b02016-05-18 15:37:25 -070026 "android/soong/android"
Colin Cross581c1892015-04-07 16:50:10 -070027)
28
29func init() {
David Sudd18efd2020-07-24 17:19:23 +000030 pctx.SourcePathVariable("lexCmd", "prebuilts/build-tools/${config.HostPrebuiltTag}/bin/flex")
Dan Willemsen613564e2020-07-23 21:37:35 +000031 pctx.SourcePathVariable("m4Cmd", "prebuilts/build-tools/${config.HostPrebuiltTag}/bin/m4")
32
Dan Willemsene1240db2016-11-03 14:28:51 -070033 pctx.HostBinToolVariable("aidlCmd", "aidl-cpp")
Inseob Kim21f26902018-09-06 00:55:20 +090034 pctx.HostBinToolVariable("syspropCmd", "sysprop_cpp")
Colin Cross581c1892015-04-07 16:50:10 -070035}
36
37var (
David Sudd18efd2020-07-24 17:19:23 +000038 lex = pctx.AndroidStaticRule("lex",
39 blueprint.RuleParams{
Matthias Maennich22fd4d12020-07-15 10:58:56 +020040 Command: "M4=$m4Cmd $lexCmd $flags -o$out $in",
David Sudd18efd2020-07-24 17:19:23 +000041 CommandDeps: []string{"$lexCmd", "$m4Cmd"},
Matthias Maennich22fd4d12020-07-15 10:58:56 +020042 }, "flags")
David Sudd18efd2020-07-24 17:19:23 +000043
Inseob Kim21f26902018-09-06 00:55:20 +090044 sysprop = pctx.AndroidStaticRule("sysprop",
45 blueprint.RuleParams{
Inseob Kim5cefbd22019-06-08 20:36:59 +090046 Command: "$syspropCmd --header-dir=$headerOutDir --public-header-dir=$publicOutDir " +
Inseob Kimc0907f12019-02-08 21:00:45 +090047 "--source-dir=$srcOutDir --include-name=$includeName $in",
Inseob Kim21f26902018-09-06 00:55:20 +090048 CommandDeps: []string{"$syspropCmd"},
49 },
Inseob Kim5cefbd22019-06-08 20:36:59 +090050 "headerOutDir", "publicOutDir", "srcOutDir", "includeName")
Colin Cross581c1892015-04-07 16:50:10 -070051)
52
Dan Willemsen4e0aa232019-04-10 22:59:54 -070053type YaccProperties struct {
54 // list of module-specific flags that will be used for .y and .yy compiles
55 Flags []string
Colin Cross581c1892015-04-07 16:50:10 -070056
Dan Willemsen4e0aa232019-04-10 22:59:54 -070057 // whether the yacc files will produce a location.hh file
58 Gen_location_hh *bool
Colin Cross581c1892015-04-07 16:50:10 -070059
Dan Willemsen4e0aa232019-04-10 22:59:54 -070060 // whether the yacc files will product a position.hh file
61 Gen_position_hh *bool
62}
63
64func genYacc(ctx android.ModuleContext, rule *android.RuleBuilder, yaccFile android.Path,
David Sudd18efd2020-07-24 17:19:23 +000065 outFile android.ModuleGenPath, props *YaccProperties) (headerFiles android.Paths) {
Dan Willemsen4e0aa232019-04-10 22:59:54 -070066
67 outDir := android.PathForModuleGen(ctx, "yacc")
68 headerFile := android.GenPathWithExt(ctx, "yacc", yaccFile, "h")
69 ret := android.Paths{headerFile}
70
71 cmd := rule.Command()
72
73 // Fix up #line markers to not use the sbox temporary directory
Colin Crossf1a035e2020-11-16 17:32:30 -080074 // android.sboxPathForOutput(outDir, outDir) returns the sbox placeholder for the out
Colin Cross3d680512020-11-13 16:23:53 -080075 // directory itself, without any filename appended.
Colin Crossf1a035e2020-11-16 17:32:30 -080076 sboxOutDir := cmd.PathForOutput(outDir)
Colin Cross3d680512020-11-13 16:23:53 -080077 sedCmd := "sed -i.bak 's#" + sboxOutDir + "#" + outDir.String() + "#'"
Dan Willemsen4e0aa232019-04-10 22:59:54 -070078 rule.Command().Text(sedCmd).Input(outFile)
79 rule.Command().Text(sedCmd).Input(headerFile)
80
81 var flags []string
82 if props != nil {
83 flags = props.Flags
84
85 if Bool(props.Gen_location_hh) {
86 locationHeader := outFile.InSameDir(ctx, "location.hh")
87 ret = append(ret, locationHeader)
88 cmd.ImplicitOutput(locationHeader)
89 rule.Command().Text(sedCmd).Input(locationHeader)
90 }
91 if Bool(props.Gen_position_hh) {
92 positionHeader := outFile.InSameDir(ctx, "position.hh")
93 ret = append(ret, positionHeader)
94 cmd.ImplicitOutput(positionHeader)
95 rule.Command().Text(sedCmd).Input(positionHeader)
96 }
97 }
98
David Sudd18efd2020-07-24 17:19:23 +000099 cmd.Text("BISON_PKGDATADIR=prebuilts/build-tools/common/bison").
100 FlagWithInput("M4=", ctx.Config().PrebuiltBuildTool(ctx, "m4")).
101 PrebuiltBuildTool(ctx, "bison").
Dan Willemsen4e0aa232019-04-10 22:59:54 -0700102 Flag("-d").
103 Flags(flags).
104 FlagWithOutput("--defines=", headerFile).
105 Flag("-o").Output(outFile).Input(yaccFile)
106
107 return ret
Colin Cross581c1892015-04-07 16:50:10 -0700108}
109
Jiyong Parkc7e592c2021-04-07 21:49:34 +0900110func genAidl(ctx android.ModuleContext, rule *android.RuleBuilder, aidlFile android.Path, aidlFlags string) (cppFile android.OutputPath, headerFiles android.Paths) {
Dan Willemsen1945a4b2019-06-04 17:10:41 -0700111 aidlPackage := strings.TrimSuffix(aidlFile.Rel(), aidlFile.Base())
112 baseName := strings.TrimSuffix(aidlFile.Base(), aidlFile.Ext())
Daniel Norman10b74352019-09-24 17:39:58 -0700113 shortName := baseName
114 // TODO(b/111362593): aidl_to_cpp_common.cpp uses heuristics to figure out if
115 // an interface name has a leading I. Those same heuristics have been
116 // moved here.
117 if len(baseName) >= 2 && baseName[0] == 'I' &&
118 strings.ToUpper(baseName)[1] == baseName[1] {
119 shortName = strings.TrimPrefix(baseName, "I")
120 }
Dan Willemsen1945a4b2019-06-04 17:10:41 -0700121
122 outDir := android.PathForModuleGen(ctx, "aidl")
Jiyong Parkc7e592c2021-04-07 21:49:34 +0900123 cppFile = outDir.Join(ctx, aidlPackage, baseName+".cpp")
124 depFile := outDir.Join(ctx, aidlPackage, baseName+".cpp.d")
Dan Willemsen1945a4b2019-06-04 17:10:41 -0700125 headerI := outDir.Join(ctx, aidlPackage, baseName+".h")
126 headerBn := outDir.Join(ctx, aidlPackage, "Bn"+shortName+".h")
127 headerBp := outDir.Join(ctx, aidlPackage, "Bp"+shortName+".h")
128
129 cmd := rule.Command()
Colin Crossf1a035e2020-11-16 17:32:30 -0800130 cmd.BuiltTool("aidl-cpp").
Dan Willemsen1945a4b2019-06-04 17:10:41 -0700131 FlagWithDepFile("-d", depFile).
132 Flag("--ninja").
133 Flag(aidlFlags).
134 Input(aidlFile).
135 OutputDir().
Jiyong Parkc7e592c2021-04-07 21:49:34 +0900136 Output(cppFile).
Dan Willemsen1945a4b2019-06-04 17:10:41 -0700137 ImplicitOutputs(android.WritablePaths{
138 headerI,
139 headerBn,
140 headerBp,
141 })
142
Jiyong Parkc7e592c2021-04-07 21:49:34 +0900143 return cppFile, android.Paths{
Dan Willemsen1945a4b2019-06-04 17:10:41 -0700144 headerI,
145 headerBn,
146 headerBp,
147 }
Dan Willemsene1240db2016-11-03 14:28:51 -0700148}
149
Matthias Maennich22fd4d12020-07-15 10:58:56 +0200150type LexProperties struct {
151 // list of module-specific flags that will be used for .l and .ll compiles
152 Flags []string
153}
154
155func genLex(ctx android.ModuleContext, lexFile android.Path, outFile android.ModuleGenPath, props *LexProperties) {
156 var flags []string
157 if props != nil {
158 flags = props.Flags
159 }
160 flagsString := strings.Join(flags[:], " ")
David Sudd18efd2020-07-24 17:19:23 +0000161 ctx.Build(pctx, android.BuildParams{
162 Rule: lex,
163 Description: "lex " + lexFile.Rel(),
164 Output: outFile,
165 Input: lexFile,
Matthias Maennich22fd4d12020-07-15 10:58:56 +0200166 Args: map[string]string{"flags": flagsString},
David Sudd18efd2020-07-24 17:19:23 +0000167 })
Colin Cross581c1892015-04-07 16:50:10 -0700168}
169
Trevor Radcliffeef9c9002022-05-13 20:55:35 +0000170type LexAttrs struct {
171 Srcs bazel.LabelListAttribute
172 Lexopts bazel.StringListAttribute
173}
174
175type LexNames struct {
176 cSrcName bazel.LabelAttribute
177 srcName bazel.LabelAttribute
178}
179
180func bp2BuildLex(ctx android.Bp2buildMutatorContext, moduleName string, ca compilerAttributes) LexNames {
181 names := LexNames{}
182 if !ca.lSrcs.IsEmpty() {
183 names.cSrcName = createLexTargetModule(ctx, moduleName+"_genlex_l", ca.lSrcs, ca.lexopts)
184 }
185 if !ca.llSrcs.IsEmpty() {
186 names.srcName = createLexTargetModule(ctx, moduleName+"_genlex_ll", ca.llSrcs, ca.lexopts)
187 }
188 return names
189}
190
191func createLexTargetModule(ctx android.Bp2buildMutatorContext, name string, srcs bazel.LabelListAttribute, opts bazel.StringListAttribute) bazel.LabelAttribute {
192 ctx.CreateBazelTargetModule(
193 bazel.BazelTargetModuleProperties{
194 Rule_class: "genlex",
195 Bzl_load_location: "//build/bazel/rules/cc:flex.bzl",
196 },
197 android.CommonAttributes{Name: name},
198 &LexAttrs{
199 Srcs: srcs,
200 Lexopts: opts,
201 })
202 return bazel.LabelAttribute{Value: &bazel.Label{Label: ":" + name}}
203}
204
Inseob Kimed2641f2020-02-19 10:42:41 +0900205func genSysprop(ctx android.ModuleContext, syspropFile android.Path) (android.Path, android.Paths) {
Inseob Kim21f26902018-09-06 00:55:20 +0900206 headerFile := android.PathForModuleGen(ctx, "sysprop", "include", syspropFile.Rel()+".h")
Inseob Kim5cefbd22019-06-08 20:36:59 +0900207 publicHeaderFile := android.PathForModuleGen(ctx, "sysprop/public", "include", syspropFile.Rel()+".h")
Inseob Kim21f26902018-09-06 00:55:20 +0900208 cppFile := android.PathForModuleGen(ctx, "sysprop", syspropFile.Rel()+".cpp")
209
Inseob Kimed2641f2020-02-19 10:42:41 +0900210 headers := android.WritablePaths{headerFile, publicHeaderFile}
211
Inseob Kim21f26902018-09-06 00:55:20 +0900212 ctx.Build(pctx, android.BuildParams{
Inseob Kimed2641f2020-02-19 10:42:41 +0900213 Rule: sysprop,
214 Description: "sysprop " + syspropFile.Rel(),
215 Output: cppFile,
216 ImplicitOutputs: headers,
217 Input: syspropFile,
Inseob Kim21f26902018-09-06 00:55:20 +0900218 Args: map[string]string{
219 "headerOutDir": filepath.Dir(headerFile.String()),
Inseob Kim5cefbd22019-06-08 20:36:59 +0900220 "publicOutDir": filepath.Dir(publicHeaderFile.String()),
Inseob Kim21f26902018-09-06 00:55:20 +0900221 "srcOutDir": filepath.Dir(cppFile.String()),
222 "includeName": syspropFile.Rel() + ".h",
223 },
224 })
225
Inseob Kimed2641f2020-02-19 10:42:41 +0900226 return cppFile, headers.Paths()
Inseob Kim21f26902018-09-06 00:55:20 +0900227}
228
Trevor Radcliffecee4e052022-09-06 19:31:25 +0000229func bp2buildCcSysprop(ctx android.Bp2buildMutatorContext, moduleName string, minSdkVersion *string, srcs bazel.LabelListAttribute) *bazel.LabelAttribute {
230 labels := SyspropLibraryLabels{
231 SyspropLibraryLabel: moduleName + "_sysprop_library",
232 StaticLibraryLabel: moduleName + "_cc_sysprop_library_static",
233 }
234 Bp2buildSysprop(ctx, labels, srcs, minSdkVersion)
235 return createLabelAttributeCorrespondingToSrcs(":"+labels.StaticLibraryLabel, srcs)
236}
237
238// Creates a LabelAttribute for a given label where the value is only set for
239// the same config values that have values in a given LabelListAttribute
240func createLabelAttributeCorrespondingToSrcs(baseLabelName string, srcs bazel.LabelListAttribute) *bazel.LabelAttribute {
241 baseLabel := bazel.Label{Label: baseLabelName}
242 label := bazel.LabelAttribute{}
243 if !srcs.Value.IsNil() && !srcs.Value.IsEmpty() {
244 label.Value = &baseLabel
245 return &label
246 }
247 for axis, configToSrcs := range srcs.ConfigurableValues {
248 for config, val := range configToSrcs {
249 if !val.IsNil() && !val.IsEmpty() {
250 label.SetSelectValue(axis, config, baseLabel)
251 }
252 }
253 }
254 return &label
255}
256
Paul Duffin33056e82021-02-19 13:49:08 +0000257// Used to communicate information from the genSources method back to the library code that uses
258// it.
259type generatedSourceInfo struct {
260 // The headers created from .proto files
261 protoHeaders android.Paths
262
263 // The files that can be used as order only dependencies in order to ensure that the proto header
264 // files are up to date.
265 protoOrderOnlyDeps android.Paths
266
267 // The headers created from .aidl files
268 aidlHeaders android.Paths
269
270 // The files that can be used as order only dependencies in order to ensure that the aidl header
271 // files are up to date.
272 aidlOrderOnlyDeps android.Paths
273
274 // The headers created from .sysprop files
275 syspropHeaders android.Paths
276
277 // The files that can be used as order only dependencies in order to ensure that the sysprop
278 // header files are up to date.
279 syspropOrderOnlyDeps android.Paths
280}
281
Vinh Tran367d89d2023-04-28 11:21:25 -0400282func genSources(
283 ctx android.ModuleContext,
284 aidlLibraryInfos []aidl_library.AidlLibraryInfo,
285 srcFiles android.Paths,
Paul Duffin33056e82021-02-19 13:49:08 +0000286 buildFlags builderFlags) (android.Paths, android.Paths, generatedSourceInfo) {
287
288 var info generatedSourceInfo
Colin Cross581c1892015-04-07 16:50:10 -0700289
Colin Cross635c3b02016-05-18 15:37:25 -0700290 var deps android.Paths
Colin Cross2a252be2017-05-01 17:37:24 -0700291 var rsFiles android.Paths
292
Dan Willemsen1945a4b2019-06-04 17:10:41 -0700293 var aidlRule *android.RuleBuilder
294
Dan Willemsen4e0aa232019-04-10 22:59:54 -0700295 var yaccRule_ *android.RuleBuilder
296 yaccRule := func() *android.RuleBuilder {
297 if yaccRule_ == nil {
Colin Crossf1a035e2020-11-16 17:32:30 -0800298 yaccRule_ = android.NewRuleBuilder(pctx, ctx).Sbox(android.PathForModuleGen(ctx, "yacc"),
Colin Crosse16ce362020-11-12 08:29:30 -0800299 android.PathForModuleGen(ctx, "yacc.sbox.textproto"))
Dan Willemsen4e0aa232019-04-10 22:59:54 -0700300 }
301 return yaccRule_
302 }
303
Colin Cross581c1892015-04-07 16:50:10 -0700304 for i, srcFile := range srcFiles {
Dan Willemsen34cc69e2015-09-23 15:26:20 -0700305 switch srcFile.Ext() {
Dan Willemsenf0c73e02016-03-01 15:15:26 -0800306 case ".y":
Dan Willemsen21ec4902016-11-02 20:43:13 -0700307 cFile := android.GenPathWithExt(ctx, "yacc", srcFile, "c")
Dan Willemsenf0c73e02016-03-01 15:15:26 -0800308 srcFiles[i] = cFile
David Sudd18efd2020-07-24 17:19:23 +0000309 deps = append(deps, genYacc(ctx, yaccRule(), srcFile, cFile, buildFlags.yacc)...)
Dan Willemsenf0c73e02016-03-01 15:15:26 -0800310 case ".yy":
Dan Willemsen21ec4902016-11-02 20:43:13 -0700311 cppFile := android.GenPathWithExt(ctx, "yacc", srcFile, "cpp")
Colin Cross581c1892015-04-07 16:50:10 -0700312 srcFiles[i] = cppFile
David Sudd18efd2020-07-24 17:19:23 +0000313 deps = append(deps, genYacc(ctx, yaccRule(), srcFile, cppFile, buildFlags.yacc)...)
Dan Willemsenf0c73e02016-03-01 15:15:26 -0800314 case ".l":
Dan Willemsen21ec4902016-11-02 20:43:13 -0700315 cFile := android.GenPathWithExt(ctx, "lex", srcFile, "c")
Dan Willemsenf0c73e02016-03-01 15:15:26 -0800316 srcFiles[i] = cFile
Matthias Maennich22fd4d12020-07-15 10:58:56 +0200317 genLex(ctx, srcFile, cFile, buildFlags.lex)
Dan Willemsenf0c73e02016-03-01 15:15:26 -0800318 case ".ll":
Dan Willemsen21ec4902016-11-02 20:43:13 -0700319 cppFile := android.GenPathWithExt(ctx, "lex", srcFile, "cpp")
Colin Cross581c1892015-04-07 16:50:10 -0700320 srcFiles[i] = cppFile
Matthias Maennich22fd4d12020-07-15 10:58:56 +0200321 genLex(ctx, srcFile, cppFile, buildFlags.lex)
Colin Cross0c461f12016-10-20 16:11:43 -0700322 case ".proto":
Dan Willemsen60e62f02018-11-16 21:05:32 -0800323 ccFile, headerFile := genProto(ctx, srcFile, buildFlags)
Colin Cross6af17aa2017-09-20 12:59:05 -0700324 srcFiles[i] = ccFile
Paul Duffin33056e82021-02-19 13:49:08 +0000325 info.protoHeaders = append(info.protoHeaders, headerFile)
326 // Use the generated header as an order only dep to ensure that it is up to date when needed.
327 info.protoOrderOnlyDeps = append(info.protoOrderOnlyDeps, headerFile)
Dan Willemsene1240db2016-11-03 14:28:51 -0700328 case ".aidl":
Dan Willemsen1945a4b2019-06-04 17:10:41 -0700329 if aidlRule == nil {
Colin Crossf1a035e2020-11-16 17:32:30 -0800330 aidlRule = android.NewRuleBuilder(pctx, ctx).Sbox(android.PathForModuleGen(ctx, "aidl"),
Colin Crosse16ce362020-11-12 08:29:30 -0800331 android.PathForModuleGen(ctx, "aidl.sbox.textproto"))
Dan Willemsen1945a4b2019-06-04 17:10:41 -0700332 }
Vinh Tran367d89d2023-04-28 11:21:25 -0400333 baseDir := strings.TrimSuffix(srcFile.String(), srcFile.Rel())
334 cppFile, aidlHeaders := genAidl(ctx, aidlRule, srcFile, buildFlags.aidlFlags+" -I"+baseDir)
Dan Willemsene1240db2016-11-03 14:28:51 -0700335 srcFiles[i] = cppFile
Jiyong Parkc7e592c2021-04-07 21:49:34 +0900336
Paul Duffin33056e82021-02-19 13:49:08 +0000337 info.aidlHeaders = append(info.aidlHeaders, aidlHeaders...)
338 // Use the generated headers as order only deps to ensure that they are up to date when
339 // needed.
340 // TODO: Reduce the size of the ninja file by using one order only dep for the whole rule
341 info.aidlOrderOnlyDeps = append(info.aidlOrderOnlyDeps, aidlHeaders...)
Jeff Vander Stoepd6126272019-07-15 19:08:37 -0700342 case ".rscript", ".fs":
Colin Cross2a252be2017-05-01 17:37:24 -0700343 cppFile := rsGeneratedCppFile(ctx, srcFile)
344 rsFiles = append(rsFiles, srcFiles[i])
345 srcFiles[i] = cppFile
Inseob Kim21f26902018-09-06 00:55:20 +0900346 case ".sysprop":
Inseob Kimed2641f2020-02-19 10:42:41 +0900347 cppFile, headerFiles := genSysprop(ctx, srcFile)
Inseob Kim21f26902018-09-06 00:55:20 +0900348 srcFiles[i] = cppFile
Paul Duffin33056e82021-02-19 13:49:08 +0000349 info.syspropHeaders = append(info.syspropHeaders, headerFiles...)
350 // Use the generated headers as order only deps to ensure that they are up to date when
351 // needed.
352 info.syspropOrderOnlyDeps = append(info.syspropOrderOnlyDeps, headerFiles...)
Colin Cross581c1892015-04-07 16:50:10 -0700353 }
354 }
355
Vinh Tran367d89d2023-04-28 11:21:25 -0400356 for _, aidlLibraryInfo := range aidlLibraryInfos {
357 for _, aidlSrc := range aidlLibraryInfo.Srcs {
358 if aidlRule == nil {
359 // TODO(b/279960133): Sandbox inputs to ensure aidl headers are explicitly specified
360 aidlRule = android.NewRuleBuilder(pctx, ctx).Sbox(android.PathForModuleGen(ctx, "aidl"),
361 android.PathForModuleGen(ctx, "aidl.sbox.textproto"))
362 }
363 cppFile, aidlHeaders := genAidl(ctx, aidlRule, aidlSrc, buildFlags.aidlFlags)
364
365 srcFiles = append(srcFiles, cppFile)
366 info.aidlHeaders = append(info.aidlHeaders, aidlHeaders...)
367 // Use the generated headers as order only deps to ensure that they are up to date when
368 // needed.
369 // TODO: Reduce the size of the ninja file by using one order only dep for the whole rule
370 info.aidlOrderOnlyDeps = append(info.aidlOrderOnlyDeps, aidlHeaders...)
371 }
372 }
373
Dan Willemsen1945a4b2019-06-04 17:10:41 -0700374 if aidlRule != nil {
Colin Crossf1a035e2020-11-16 17:32:30 -0800375 aidlRule.Build("aidl", "gen aidl")
Dan Willemsen1945a4b2019-06-04 17:10:41 -0700376 }
377
Dan Willemsen4e0aa232019-04-10 22:59:54 -0700378 if yaccRule_ != nil {
Colin Crossf1a035e2020-11-16 17:32:30 -0800379 yaccRule_.Build("yacc", "gen yacc")
Dan Willemsen4e0aa232019-04-10 22:59:54 -0700380 }
381
Paul Duffin33056e82021-02-19 13:49:08 +0000382 deps = append(deps, info.protoOrderOnlyDeps...)
383 deps = append(deps, info.aidlOrderOnlyDeps...)
384 deps = append(deps, info.syspropOrderOnlyDeps...)
385
Colin Cross2a252be2017-05-01 17:37:24 -0700386 if len(rsFiles) > 0 {
387 deps = append(deps, rsGenerateCpp(ctx, rsFiles, buildFlags.rsFlags)...)
388 }
389
Paul Duffin33056e82021-02-19 13:49:08 +0000390 return srcFiles, deps, info
Colin Cross581c1892015-04-07 16:50:10 -0700391}