Colin Cross | 581c189 | 2015-04-07 16:50:10 -0700 | [diff] [blame] | 1 | // 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 | |
| 15 | package cc |
| 16 | |
Colin Cross | 581c189 | 2015-04-07 16:50:10 -0700 | [diff] [blame] | 17 | import ( |
Inseob Kim | 21f2690 | 2018-09-06 00:55:20 +0900 | [diff] [blame] | 18 | "path/filepath" |
Dan Willemsen | 1945a4b | 2019-06-04 17:10:41 -0700 | [diff] [blame] | 19 | "strings" |
Inseob Kim | 21f2690 | 2018-09-06 00:55:20 +0900 | [diff] [blame] | 20 | |
Colin Cross | 581c189 | 2015-04-07 16:50:10 -0700 | [diff] [blame] | 21 | "github.com/google/blueprint" |
Colin Cross | 581c189 | 2015-04-07 16:50:10 -0700 | [diff] [blame] | 22 | |
Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 23 | "android/soong/android" |
Colin Cross | 581c189 | 2015-04-07 16:50:10 -0700 | [diff] [blame] | 24 | ) |
| 25 | |
| 26 | func init() { |
David Su | dd18efd | 2020-07-24 17:19:23 +0000 | [diff] [blame] | 27 | pctx.SourcePathVariable("lexCmd", "prebuilts/build-tools/${config.HostPrebuiltTag}/bin/flex") |
Dan Willemsen | 613564e | 2020-07-23 21:37:35 +0000 | [diff] [blame] | 28 | pctx.SourcePathVariable("m4Cmd", "prebuilts/build-tools/${config.HostPrebuiltTag}/bin/m4") |
| 29 | |
Dan Willemsen | e1240db | 2016-11-03 14:28:51 -0700 | [diff] [blame] | 30 | pctx.HostBinToolVariable("aidlCmd", "aidl-cpp") |
Inseob Kim | 21f2690 | 2018-09-06 00:55:20 +0900 | [diff] [blame] | 31 | pctx.HostBinToolVariable("syspropCmd", "sysprop_cpp") |
Colin Cross | 581c189 | 2015-04-07 16:50:10 -0700 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | var ( |
David Su | dd18efd | 2020-07-24 17:19:23 +0000 | [diff] [blame] | 35 | lex = pctx.AndroidStaticRule("lex", |
| 36 | blueprint.RuleParams{ |
Matthias Maennich | 22fd4d1 | 2020-07-15 10:58:56 +0200 | [diff] [blame] | 37 | Command: "M4=$m4Cmd $lexCmd $flags -o$out $in", |
David Su | dd18efd | 2020-07-24 17:19:23 +0000 | [diff] [blame] | 38 | CommandDeps: []string{"$lexCmd", "$m4Cmd"}, |
Matthias Maennich | 22fd4d1 | 2020-07-15 10:58:56 +0200 | [diff] [blame] | 39 | }, "flags") |
David Su | dd18efd | 2020-07-24 17:19:23 +0000 | [diff] [blame] | 40 | |
Inseob Kim | 21f2690 | 2018-09-06 00:55:20 +0900 | [diff] [blame] | 41 | sysprop = pctx.AndroidStaticRule("sysprop", |
| 42 | blueprint.RuleParams{ |
Inseob Kim | 5cefbd2 | 2019-06-08 20:36:59 +0900 | [diff] [blame] | 43 | Command: "$syspropCmd --header-dir=$headerOutDir --public-header-dir=$publicOutDir " + |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 44 | "--source-dir=$srcOutDir --include-name=$includeName $in", |
Inseob Kim | 21f2690 | 2018-09-06 00:55:20 +0900 | [diff] [blame] | 45 | CommandDeps: []string{"$syspropCmd"}, |
| 46 | }, |
Inseob Kim | 5cefbd2 | 2019-06-08 20:36:59 +0900 | [diff] [blame] | 47 | "headerOutDir", "publicOutDir", "srcOutDir", "includeName") |
Inseob Kim | 21f2690 | 2018-09-06 00:55:20 +0900 | [diff] [blame] | 48 | |
Dan Willemsen | 4f1c3d4 | 2017-09-09 01:15:26 -0700 | [diff] [blame] | 49 | windmc = pctx.AndroidStaticRule("windmc", |
| 50 | blueprint.RuleParams{ |
| 51 | Command: "$windmcCmd -r$$(dirname $out) -h$$(dirname $out) $in", |
| 52 | CommandDeps: []string{"$windmcCmd"}, |
| 53 | }, |
| 54 | "windmcCmd") |
Colin Cross | 581c189 | 2015-04-07 16:50:10 -0700 | [diff] [blame] | 55 | ) |
| 56 | |
Dan Willemsen | 4e0aa23 | 2019-04-10 22:59:54 -0700 | [diff] [blame] | 57 | type YaccProperties struct { |
| 58 | // list of module-specific flags that will be used for .y and .yy compiles |
| 59 | Flags []string |
Colin Cross | 581c189 | 2015-04-07 16:50:10 -0700 | [diff] [blame] | 60 | |
Dan Willemsen | 4e0aa23 | 2019-04-10 22:59:54 -0700 | [diff] [blame] | 61 | // whether the yacc files will produce a location.hh file |
| 62 | Gen_location_hh *bool |
Colin Cross | 581c189 | 2015-04-07 16:50:10 -0700 | [diff] [blame] | 63 | |
Dan Willemsen | 4e0aa23 | 2019-04-10 22:59:54 -0700 | [diff] [blame] | 64 | // whether the yacc files will product a position.hh file |
| 65 | Gen_position_hh *bool |
| 66 | } |
| 67 | |
| 68 | func genYacc(ctx android.ModuleContext, rule *android.RuleBuilder, yaccFile android.Path, |
David Su | dd18efd | 2020-07-24 17:19:23 +0000 | [diff] [blame] | 69 | outFile android.ModuleGenPath, props *YaccProperties) (headerFiles android.Paths) { |
Dan Willemsen | 4e0aa23 | 2019-04-10 22:59:54 -0700 | [diff] [blame] | 70 | |
| 71 | outDir := android.PathForModuleGen(ctx, "yacc") |
| 72 | headerFile := android.GenPathWithExt(ctx, "yacc", yaccFile, "h") |
| 73 | ret := android.Paths{headerFile} |
| 74 | |
| 75 | cmd := rule.Command() |
| 76 | |
| 77 | // Fix up #line markers to not use the sbox temporary directory |
Colin Cross | 3d68051 | 2020-11-13 16:23:53 -0800 | [diff] [blame] | 78 | // android.SboxPathForOutput(outDir, outDir) returns the sbox placeholder for the out |
| 79 | // directory itself, without any filename appended. |
| 80 | // TODO(ccross): make this cmd.PathForOutput(outDir) instead. |
| 81 | sboxOutDir := android.SboxPathForOutput(outDir, outDir) |
| 82 | sedCmd := "sed -i.bak 's#" + sboxOutDir + "#" + outDir.String() + "#'" |
Dan Willemsen | 4e0aa23 | 2019-04-10 22:59:54 -0700 | [diff] [blame] | 83 | rule.Command().Text(sedCmd).Input(outFile) |
| 84 | rule.Command().Text(sedCmd).Input(headerFile) |
| 85 | |
| 86 | var flags []string |
| 87 | if props != nil { |
| 88 | flags = props.Flags |
| 89 | |
| 90 | if Bool(props.Gen_location_hh) { |
| 91 | locationHeader := outFile.InSameDir(ctx, "location.hh") |
| 92 | ret = append(ret, locationHeader) |
| 93 | cmd.ImplicitOutput(locationHeader) |
| 94 | rule.Command().Text(sedCmd).Input(locationHeader) |
| 95 | } |
| 96 | if Bool(props.Gen_position_hh) { |
| 97 | positionHeader := outFile.InSameDir(ctx, "position.hh") |
| 98 | ret = append(ret, positionHeader) |
| 99 | cmd.ImplicitOutput(positionHeader) |
| 100 | rule.Command().Text(sedCmd).Input(positionHeader) |
| 101 | } |
| 102 | } |
| 103 | |
David Su | dd18efd | 2020-07-24 17:19:23 +0000 | [diff] [blame] | 104 | cmd.Text("BISON_PKGDATADIR=prebuilts/build-tools/common/bison"). |
| 105 | FlagWithInput("M4=", ctx.Config().PrebuiltBuildTool(ctx, "m4")). |
| 106 | PrebuiltBuildTool(ctx, "bison"). |
Dan Willemsen | 4e0aa23 | 2019-04-10 22:59:54 -0700 | [diff] [blame] | 107 | Flag("-d"). |
| 108 | Flags(flags). |
| 109 | FlagWithOutput("--defines=", headerFile). |
| 110 | Flag("-o").Output(outFile).Input(yaccFile) |
| 111 | |
| 112 | return ret |
Colin Cross | 581c189 | 2015-04-07 16:50:10 -0700 | [diff] [blame] | 113 | } |
| 114 | |
Dan Willemsen | 1945a4b | 2019-06-04 17:10:41 -0700 | [diff] [blame] | 115 | func genAidl(ctx android.ModuleContext, rule *android.RuleBuilder, aidlFile android.Path, |
| 116 | outFile, depFile android.ModuleGenPath, aidlFlags string) android.Paths { |
Dan Willemsen | e1240db | 2016-11-03 14:28:51 -0700 | [diff] [blame] | 117 | |
Dan Willemsen | 1945a4b | 2019-06-04 17:10:41 -0700 | [diff] [blame] | 118 | aidlPackage := strings.TrimSuffix(aidlFile.Rel(), aidlFile.Base()) |
| 119 | baseName := strings.TrimSuffix(aidlFile.Base(), aidlFile.Ext()) |
Daniel Norman | 10b7435 | 2019-09-24 17:39:58 -0700 | [diff] [blame] | 120 | shortName := baseName |
| 121 | // TODO(b/111362593): aidl_to_cpp_common.cpp uses heuristics to figure out if |
| 122 | // an interface name has a leading I. Those same heuristics have been |
| 123 | // moved here. |
| 124 | if len(baseName) >= 2 && baseName[0] == 'I' && |
| 125 | strings.ToUpper(baseName)[1] == baseName[1] { |
| 126 | shortName = strings.TrimPrefix(baseName, "I") |
| 127 | } |
Dan Willemsen | 1945a4b | 2019-06-04 17:10:41 -0700 | [diff] [blame] | 128 | |
| 129 | outDir := android.PathForModuleGen(ctx, "aidl") |
| 130 | headerI := outDir.Join(ctx, aidlPackage, baseName+".h") |
| 131 | headerBn := outDir.Join(ctx, aidlPackage, "Bn"+shortName+".h") |
| 132 | headerBp := outDir.Join(ctx, aidlPackage, "Bp"+shortName+".h") |
| 133 | |
Jiyong Park | 2907459 | 2019-07-07 16:27:47 +0900 | [diff] [blame] | 134 | baseDir := strings.TrimSuffix(aidlFile.String(), aidlFile.Rel()) |
| 135 | if baseDir != "" { |
| 136 | aidlFlags += " -I" + baseDir |
| 137 | } |
| 138 | |
Dan Willemsen | 1945a4b | 2019-06-04 17:10:41 -0700 | [diff] [blame] | 139 | cmd := rule.Command() |
Colin Cross | ee94d6a | 2019-07-08 17:08:34 -0700 | [diff] [blame] | 140 | cmd.BuiltTool(ctx, "aidl-cpp"). |
Dan Willemsen | 1945a4b | 2019-06-04 17:10:41 -0700 | [diff] [blame] | 141 | FlagWithDepFile("-d", depFile). |
| 142 | Flag("--ninja"). |
| 143 | Flag(aidlFlags). |
| 144 | Input(aidlFile). |
| 145 | OutputDir(). |
| 146 | Output(outFile). |
| 147 | ImplicitOutputs(android.WritablePaths{ |
| 148 | headerI, |
| 149 | headerBn, |
| 150 | headerBp, |
| 151 | }) |
| 152 | |
| 153 | return android.Paths{ |
| 154 | headerI, |
| 155 | headerBn, |
| 156 | headerBp, |
| 157 | } |
Dan Willemsen | e1240db | 2016-11-03 14:28:51 -0700 | [diff] [blame] | 158 | } |
| 159 | |
Matthias Maennich | 22fd4d1 | 2020-07-15 10:58:56 +0200 | [diff] [blame] | 160 | type LexProperties struct { |
| 161 | // list of module-specific flags that will be used for .l and .ll compiles |
| 162 | Flags []string |
| 163 | } |
| 164 | |
| 165 | func genLex(ctx android.ModuleContext, lexFile android.Path, outFile android.ModuleGenPath, props *LexProperties) { |
| 166 | var flags []string |
| 167 | if props != nil { |
| 168 | flags = props.Flags |
| 169 | } |
| 170 | flagsString := strings.Join(flags[:], " ") |
David Su | dd18efd | 2020-07-24 17:19:23 +0000 | [diff] [blame] | 171 | ctx.Build(pctx, android.BuildParams{ |
| 172 | Rule: lex, |
| 173 | Description: "lex " + lexFile.Rel(), |
| 174 | Output: outFile, |
| 175 | Input: lexFile, |
Matthias Maennich | 22fd4d1 | 2020-07-15 10:58:56 +0200 | [diff] [blame] | 176 | Args: map[string]string{"flags": flagsString}, |
David Su | dd18efd | 2020-07-24 17:19:23 +0000 | [diff] [blame] | 177 | }) |
Colin Cross | 581c189 | 2015-04-07 16:50:10 -0700 | [diff] [blame] | 178 | } |
| 179 | |
Inseob Kim | ed2641f | 2020-02-19 10:42:41 +0900 | [diff] [blame] | 180 | func genSysprop(ctx android.ModuleContext, syspropFile android.Path) (android.Path, android.Paths) { |
Inseob Kim | 21f2690 | 2018-09-06 00:55:20 +0900 | [diff] [blame] | 181 | headerFile := android.PathForModuleGen(ctx, "sysprop", "include", syspropFile.Rel()+".h") |
Inseob Kim | 5cefbd2 | 2019-06-08 20:36:59 +0900 | [diff] [blame] | 182 | publicHeaderFile := android.PathForModuleGen(ctx, "sysprop/public", "include", syspropFile.Rel()+".h") |
Inseob Kim | 21f2690 | 2018-09-06 00:55:20 +0900 | [diff] [blame] | 183 | cppFile := android.PathForModuleGen(ctx, "sysprop", syspropFile.Rel()+".cpp") |
| 184 | |
Inseob Kim | ed2641f | 2020-02-19 10:42:41 +0900 | [diff] [blame] | 185 | headers := android.WritablePaths{headerFile, publicHeaderFile} |
| 186 | |
Inseob Kim | 21f2690 | 2018-09-06 00:55:20 +0900 | [diff] [blame] | 187 | ctx.Build(pctx, android.BuildParams{ |
Inseob Kim | ed2641f | 2020-02-19 10:42:41 +0900 | [diff] [blame] | 188 | Rule: sysprop, |
| 189 | Description: "sysprop " + syspropFile.Rel(), |
| 190 | Output: cppFile, |
| 191 | ImplicitOutputs: headers, |
| 192 | Input: syspropFile, |
Inseob Kim | 21f2690 | 2018-09-06 00:55:20 +0900 | [diff] [blame] | 193 | Args: map[string]string{ |
| 194 | "headerOutDir": filepath.Dir(headerFile.String()), |
Inseob Kim | 5cefbd2 | 2019-06-08 20:36:59 +0900 | [diff] [blame] | 195 | "publicOutDir": filepath.Dir(publicHeaderFile.String()), |
Inseob Kim | 21f2690 | 2018-09-06 00:55:20 +0900 | [diff] [blame] | 196 | "srcOutDir": filepath.Dir(cppFile.String()), |
| 197 | "includeName": syspropFile.Rel() + ".h", |
| 198 | }, |
| 199 | }) |
| 200 | |
Inseob Kim | ed2641f | 2020-02-19 10:42:41 +0900 | [diff] [blame] | 201 | return cppFile, headers.Paths() |
Inseob Kim | 21f2690 | 2018-09-06 00:55:20 +0900 | [diff] [blame] | 202 | } |
| 203 | |
Dan Willemsen | 4f1c3d4 | 2017-09-09 01:15:26 -0700 | [diff] [blame] | 204 | func genWinMsg(ctx android.ModuleContext, srcFile android.Path, flags builderFlags) (android.Path, android.Path) { |
| 205 | headerFile := android.GenPathWithExt(ctx, "windmc", srcFile, "h") |
| 206 | rcFile := android.GenPathWithExt(ctx, "windmc", srcFile, "rc") |
| 207 | |
| 208 | windmcCmd := gccCmd(flags.toolchain, "windmc") |
| 209 | |
Colin Cross | ae88703 | 2017-10-23 17:16:14 -0700 | [diff] [blame] | 210 | ctx.Build(pctx, android.BuildParams{ |
Dan Willemsen | 4f1c3d4 | 2017-09-09 01:15:26 -0700 | [diff] [blame] | 211 | Rule: windmc, |
| 212 | Description: "windmc " + srcFile.Rel(), |
| 213 | Output: rcFile, |
| 214 | ImplicitOutput: headerFile, |
| 215 | Input: srcFile, |
| 216 | Args: map[string]string{ |
| 217 | "windmcCmd": windmcCmd, |
| 218 | }, |
| 219 | }) |
| 220 | |
| 221 | return rcFile, headerFile |
| 222 | } |
| 223 | |
David Su | dd18efd | 2020-07-24 17:19:23 +0000 | [diff] [blame] | 224 | func genSources(ctx android.ModuleContext, srcFiles android.Paths, |
| 225 | buildFlags builderFlags) (android.Paths, android.Paths) { |
Colin Cross | 581c189 | 2015-04-07 16:50:10 -0700 | [diff] [blame] | 226 | |
Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 227 | var deps android.Paths |
Colin Cross | 2a252be | 2017-05-01 17:37:24 -0700 | [diff] [blame] | 228 | var rsFiles android.Paths |
| 229 | |
Dan Willemsen | 1945a4b | 2019-06-04 17:10:41 -0700 | [diff] [blame] | 230 | var aidlRule *android.RuleBuilder |
| 231 | |
Dan Willemsen | 4e0aa23 | 2019-04-10 22:59:54 -0700 | [diff] [blame] | 232 | var yaccRule_ *android.RuleBuilder |
| 233 | yaccRule := func() *android.RuleBuilder { |
| 234 | if yaccRule_ == nil { |
Colin Cross | e16ce36 | 2020-11-12 08:29:30 -0800 | [diff] [blame^] | 235 | yaccRule_ = android.NewRuleBuilder().Sbox(android.PathForModuleGen(ctx, "yacc"), |
| 236 | android.PathForModuleGen(ctx, "yacc.sbox.textproto")) |
Dan Willemsen | 4e0aa23 | 2019-04-10 22:59:54 -0700 | [diff] [blame] | 237 | } |
| 238 | return yaccRule_ |
| 239 | } |
| 240 | |
Colin Cross | 581c189 | 2015-04-07 16:50:10 -0700 | [diff] [blame] | 241 | for i, srcFile := range srcFiles { |
Dan Willemsen | 34cc69e | 2015-09-23 15:26:20 -0700 | [diff] [blame] | 242 | switch srcFile.Ext() { |
Dan Willemsen | f0c73e0 | 2016-03-01 15:15:26 -0800 | [diff] [blame] | 243 | case ".y": |
Dan Willemsen | 21ec490 | 2016-11-02 20:43:13 -0700 | [diff] [blame] | 244 | cFile := android.GenPathWithExt(ctx, "yacc", srcFile, "c") |
Dan Willemsen | f0c73e0 | 2016-03-01 15:15:26 -0800 | [diff] [blame] | 245 | srcFiles[i] = cFile |
David Su | dd18efd | 2020-07-24 17:19:23 +0000 | [diff] [blame] | 246 | deps = append(deps, genYacc(ctx, yaccRule(), srcFile, cFile, buildFlags.yacc)...) |
Dan Willemsen | f0c73e0 | 2016-03-01 15:15:26 -0800 | [diff] [blame] | 247 | case ".yy": |
Dan Willemsen | 21ec490 | 2016-11-02 20:43:13 -0700 | [diff] [blame] | 248 | cppFile := android.GenPathWithExt(ctx, "yacc", srcFile, "cpp") |
Colin Cross | 581c189 | 2015-04-07 16:50:10 -0700 | [diff] [blame] | 249 | srcFiles[i] = cppFile |
David Su | dd18efd | 2020-07-24 17:19:23 +0000 | [diff] [blame] | 250 | deps = append(deps, genYacc(ctx, yaccRule(), srcFile, cppFile, buildFlags.yacc)...) |
Dan Willemsen | f0c73e0 | 2016-03-01 15:15:26 -0800 | [diff] [blame] | 251 | case ".l": |
Dan Willemsen | 21ec490 | 2016-11-02 20:43:13 -0700 | [diff] [blame] | 252 | cFile := android.GenPathWithExt(ctx, "lex", srcFile, "c") |
Dan Willemsen | f0c73e0 | 2016-03-01 15:15:26 -0800 | [diff] [blame] | 253 | srcFiles[i] = cFile |
Matthias Maennich | 22fd4d1 | 2020-07-15 10:58:56 +0200 | [diff] [blame] | 254 | genLex(ctx, srcFile, cFile, buildFlags.lex) |
Dan Willemsen | f0c73e0 | 2016-03-01 15:15:26 -0800 | [diff] [blame] | 255 | case ".ll": |
Dan Willemsen | 21ec490 | 2016-11-02 20:43:13 -0700 | [diff] [blame] | 256 | cppFile := android.GenPathWithExt(ctx, "lex", srcFile, "cpp") |
Colin Cross | 581c189 | 2015-04-07 16:50:10 -0700 | [diff] [blame] | 257 | srcFiles[i] = cppFile |
Matthias Maennich | 22fd4d1 | 2020-07-15 10:58:56 +0200 | [diff] [blame] | 258 | genLex(ctx, srcFile, cppFile, buildFlags.lex) |
Colin Cross | 0c461f1 | 2016-10-20 16:11:43 -0700 | [diff] [blame] | 259 | case ".proto": |
Dan Willemsen | 60e62f0 | 2018-11-16 21:05:32 -0800 | [diff] [blame] | 260 | ccFile, headerFile := genProto(ctx, srcFile, buildFlags) |
Colin Cross | 6af17aa | 2017-09-20 12:59:05 -0700 | [diff] [blame] | 261 | srcFiles[i] = ccFile |
| 262 | deps = append(deps, headerFile) |
Dan Willemsen | e1240db | 2016-11-03 14:28:51 -0700 | [diff] [blame] | 263 | case ".aidl": |
Dan Willemsen | 1945a4b | 2019-06-04 17:10:41 -0700 | [diff] [blame] | 264 | if aidlRule == nil { |
Colin Cross | e16ce36 | 2020-11-12 08:29:30 -0800 | [diff] [blame^] | 265 | aidlRule = android.NewRuleBuilder().Sbox(android.PathForModuleGen(ctx, "aidl"), |
| 266 | android.PathForModuleGen(ctx, "aidl.sbox.textproto")) |
Dan Willemsen | 1945a4b | 2019-06-04 17:10:41 -0700 | [diff] [blame] | 267 | } |
Dan Willemsen | e1240db | 2016-11-03 14:28:51 -0700 | [diff] [blame] | 268 | cppFile := android.GenPathWithExt(ctx, "aidl", srcFile, "cpp") |
Dan Willemsen | 1945a4b | 2019-06-04 17:10:41 -0700 | [diff] [blame] | 269 | depFile := android.GenPathWithExt(ctx, "aidl", srcFile, "cpp.d") |
Dan Willemsen | e1240db | 2016-11-03 14:28:51 -0700 | [diff] [blame] | 270 | srcFiles[i] = cppFile |
Dan Willemsen | 1945a4b | 2019-06-04 17:10:41 -0700 | [diff] [blame] | 271 | deps = append(deps, genAidl(ctx, aidlRule, srcFile, cppFile, depFile, buildFlags.aidlFlags)...) |
Jeff Vander Stoep | d612627 | 2019-07-15 19:08:37 -0700 | [diff] [blame] | 272 | case ".rscript", ".fs": |
Colin Cross | 2a252be | 2017-05-01 17:37:24 -0700 | [diff] [blame] | 273 | cppFile := rsGeneratedCppFile(ctx, srcFile) |
| 274 | rsFiles = append(rsFiles, srcFiles[i]) |
| 275 | srcFiles[i] = cppFile |
Dan Willemsen | 4f1c3d4 | 2017-09-09 01:15:26 -0700 | [diff] [blame] | 276 | case ".mc": |
| 277 | rcFile, headerFile := genWinMsg(ctx, srcFile, buildFlags) |
| 278 | srcFiles[i] = rcFile |
| 279 | deps = append(deps, headerFile) |
Inseob Kim | 21f2690 | 2018-09-06 00:55:20 +0900 | [diff] [blame] | 280 | case ".sysprop": |
Inseob Kim | ed2641f | 2020-02-19 10:42:41 +0900 | [diff] [blame] | 281 | cppFile, headerFiles := genSysprop(ctx, srcFile) |
Inseob Kim | 21f2690 | 2018-09-06 00:55:20 +0900 | [diff] [blame] | 282 | srcFiles[i] = cppFile |
Inseob Kim | ed2641f | 2020-02-19 10:42:41 +0900 | [diff] [blame] | 283 | deps = append(deps, headerFiles...) |
Colin Cross | 581c189 | 2015-04-07 16:50:10 -0700 | [diff] [blame] | 284 | } |
| 285 | } |
| 286 | |
Dan Willemsen | 1945a4b | 2019-06-04 17:10:41 -0700 | [diff] [blame] | 287 | if aidlRule != nil { |
| 288 | aidlRule.Build(pctx, ctx, "aidl", "gen aidl") |
| 289 | } |
| 290 | |
Dan Willemsen | 4e0aa23 | 2019-04-10 22:59:54 -0700 | [diff] [blame] | 291 | if yaccRule_ != nil { |
| 292 | yaccRule_.Build(pctx, ctx, "yacc", "gen yacc") |
| 293 | } |
| 294 | |
Colin Cross | 2a252be | 2017-05-01 17:37:24 -0700 | [diff] [blame] | 295 | if len(rsFiles) > 0 { |
| 296 | deps = append(deps, rsGenerateCpp(ctx, rsFiles, buildFlags.rsFlags)...) |
| 297 | } |
| 298 | |
Colin Cross | 581c189 | 2015-04-07 16:50:10 -0700 | [diff] [blame] | 299 | return srcFiles, deps |
| 300 | } |