blob: 6af18eebab21ca23fd121d9cadefa55d98131112 [file] [log] [blame]
Colin Cross5049f022015-03-18 13:28:46 -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 genrule
16
17import (
Colin Cross6f080df2016-11-04 15:32:58 -070018 "fmt"
19 "strings"
Dan Willemsen3f4539b2016-09-28 16:19:10 -070020
Colin Cross70b40592015-03-23 12:57:34 -070021 "github.com/google/blueprint"
Dan Willemsen8eded0a2017-09-13 16:07:44 -070022 "github.com/google/blueprint/bootstrap"
Colin Cross5049f022015-03-18 13:28:46 -070023
Colin Cross635c3b02016-05-18 15:37:25 -070024 "android/soong/android"
Jeff Gastonefc1b412017-03-29 17:29:06 -070025 "android/soong/shared"
26 "path/filepath"
Colin Cross5049f022015-03-18 13:28:46 -070027)
28
Colin Cross463a90e2015-06-17 14:20:06 -070029func init() {
Colin Cross54190b32017-10-09 15:34:10 -070030 android.RegisterModuleType("gensrcs", GenSrcsFactory)
31 android.RegisterModuleType("genrule", GenRuleFactory)
Colin Cross463a90e2015-06-17 14:20:06 -070032}
33
Colin Cross5049f022015-03-18 13:28:46 -070034var (
Colin Cross635c3b02016-05-18 15:37:25 -070035 pctx = android.NewPackageContext("android/soong/genrule")
Colin Cross5049f022015-03-18 13:28:46 -070036)
37
Jeff Gastonefc1b412017-03-29 17:29:06 -070038func init() {
39 pctx.HostBinToolVariable("sboxCmd", "sbox")
40}
41
Colin Cross5049f022015-03-18 13:28:46 -070042type SourceFileGenerator interface {
Colin Cross635c3b02016-05-18 15:37:25 -070043 GeneratedSourceFiles() android.Paths
Colin Cross5ed99c62016-11-22 12:55:55 -080044 GeneratedHeaderDirs() android.Paths
Colin Cross5049f022015-03-18 13:28:46 -070045}
46
Colin Crossd350ecd2015-04-28 13:25:36 -070047type HostToolProvider interface {
Colin Cross635c3b02016-05-18 15:37:25 -070048 HostToolPath() android.OptionalPath
Colin Crossd350ecd2015-04-28 13:25:36 -070049}
Colin Cross5049f022015-03-18 13:28:46 -070050
Dan Willemsend6ba0d52017-09-13 15:46:47 -070051type hostToolDependencyTag struct {
52 blueprint.BaseDependencyTag
53}
54
55var hostToolDepTag hostToolDependencyTag
56
Colin Cross7d5136f2015-05-11 13:39:40 -070057type generatorProperties struct {
Jeff Gastonefc1b412017-03-29 17:29:06 -070058 // The command to run on one or more input files. Cmd supports substitution of a few variables
59 // (the actual substitution is implemented in GenerateAndroidBuildActions below)
60 //
61 // Available variables for substitution:
62 //
Colin Cross2296f5b2017-10-17 21:38:14 -070063 // $(location): the path to the first entry in tools or tool_files
64 // $(location <label>): the path to the tool or tool_file with name <label>
65 // $(in): one or more input files
66 // $(out): a single output file
67 // $(depfile): a file to which dependencies will be written, if the depfile property is set to true
68 // $(genDir): the sandbox directory for this tool; contains $(out)
69 // $$: a literal $
Colin Cross6f080df2016-11-04 15:32:58 -070070 //
Jeff Gastonefc1b412017-03-29 17:29:06 -070071 // All files used must be declared as inputs (to ensure proper up-to-date checks).
72 // Use "$(in)" directly in Cmd to ensure that all inputs used are declared.
Colin Cross7d5136f2015-05-11 13:39:40 -070073 Cmd string
74
Colin Cross33bfb0a2016-11-21 17:23:08 -080075 // Enable reading a file containing dependencies in gcc format after the command completes
76 Depfile bool
77
Colin Cross6f080df2016-11-04 15:32:58 -070078 // name of the modules (if any) that produces the host executable. Leave empty for
Colin Cross7d5136f2015-05-11 13:39:40 -070079 // prebuilts or scripts that do not need a module to build them.
Colin Cross6f080df2016-11-04 15:32:58 -070080 Tools []string
Dan Willemsenf7f3d692016-04-20 14:54:32 -070081
82 // Local file that is used as the tool
Colin Cross6f080df2016-11-04 15:32:58 -070083 Tool_files []string
Colin Cross5ed99c62016-11-22 12:55:55 -080084
85 // List of directories to export generated headers from
86 Export_include_dirs []string
Colin Cross708c4242017-01-13 18:05:49 -080087
88 // list of input files
89 Srcs []string
Colin Cross7d5136f2015-05-11 13:39:40 -070090}
91
Dan Willemsen3e5bdf22017-09-13 18:37:08 -070092type Module struct {
Colin Cross635c3b02016-05-18 15:37:25 -070093 android.ModuleBase
Colin Crossd350ecd2015-04-28 13:25:36 -070094
Dan Willemsen3e5bdf22017-09-13 18:37:08 -070095 // For other packages to make their own genrules with extra
96 // properties
97 Extra interface{}
98
Colin Cross7d5136f2015-05-11 13:39:40 -070099 properties generatorProperties
Colin Crossd350ecd2015-04-28 13:25:36 -0700100
101 tasks taskFunc
102
Colin Cross635c3b02016-05-18 15:37:25 -0700103 deps android.Paths
Colin Crossd350ecd2015-04-28 13:25:36 -0700104 rule blueprint.Rule
105
Colin Cross5ed99c62016-11-22 12:55:55 -0800106 exportedIncludeDirs android.Paths
Dan Willemsenb40aab62016-04-20 14:21:14 -0700107
Colin Cross635c3b02016-05-18 15:37:25 -0700108 outputFiles android.Paths
Colin Crossd350ecd2015-04-28 13:25:36 -0700109}
110
Colin Cross708c4242017-01-13 18:05:49 -0800111type taskFunc func(ctx android.ModuleContext, srcFiles android.Paths) []generateTask
Colin Crossd350ecd2015-04-28 13:25:36 -0700112
113type generateTask struct {
Colin Cross635c3b02016-05-18 15:37:25 -0700114 in android.Paths
Dan Willemsen9c8681f2016-09-28 16:21:00 -0700115 out android.WritablePaths
Colin Crossd350ecd2015-04-28 13:25:36 -0700116}
117
Dan Willemsen3e5bdf22017-09-13 18:37:08 -0700118func (g *Module) GeneratedSourceFiles() android.Paths {
Colin Crossd350ecd2015-04-28 13:25:36 -0700119 return g.outputFiles
120}
121
Dan Willemsen3e5bdf22017-09-13 18:37:08 -0700122func (g *Module) Srcs() android.Paths {
Colin Cross068e0fe2016-12-13 15:23:47 -0800123 return g.outputFiles
124}
125
Dan Willemsen3e5bdf22017-09-13 18:37:08 -0700126func (g *Module) GeneratedHeaderDirs() android.Paths {
Colin Cross5ed99c62016-11-22 12:55:55 -0800127 return g.exportedIncludeDirs
Dan Willemsenb40aab62016-04-20 14:21:14 -0700128}
129
Dan Willemsen3e5bdf22017-09-13 18:37:08 -0700130func (g *Module) DepsMutator(ctx android.BottomUpMutatorContext) {
Colin Cross708c4242017-01-13 18:05:49 -0800131 android.ExtractSourcesDeps(ctx, g.properties.Srcs)
Dan Willemsen3e5bdf22017-09-13 18:37:08 -0700132 if g, ok := ctx.Module().(*Module); ok {
Colin Cross6f080df2016-11-04 15:32:58 -0700133 if len(g.properties.Tools) > 0 {
Dan Willemsen490fd492015-11-24 17:53:15 -0800134 ctx.AddFarVariationDependencies([]blueprint.Variation{
Colin Crossa1ad8d12016-06-01 17:09:44 -0700135 {"arch", ctx.AConfig().BuildOsVariant},
Dan Willemsend6ba0d52017-09-13 15:46:47 -0700136 }, hostToolDepTag, g.properties.Tools...)
Colin Cross6362e272015-10-29 15:25:03 -0700137 }
Colin Crossd350ecd2015-04-28 13:25:36 -0700138 }
Colin Crossd350ecd2015-04-28 13:25:36 -0700139}
140
Jeff Gaston02a684b2017-10-27 14:59:27 -0700141// Given an output file, returns an expression for the corresponding file path within the sandbox
142func sandboxPathForOutput(ctx android.ModuleContext, outputFile string) (relative string, err error) {
143 var relativePath string
144 basedir := ctx.AConfig().BuildDir()
145 relativePath, err = filepath.Rel(basedir, outputFile)
146 if err != nil {
147 return "", err
148 }
149 return filepath.Join("__SBOX_OUT_DIR__", relativePath), nil
150}
151
Dan Willemsen3e5bdf22017-09-13 18:37:08 -0700152func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
Colin Cross6f080df2016-11-04 15:32:58 -0700153 if len(g.properties.Tools) == 0 && len(g.properties.Tool_files) == 0 {
154 ctx.ModuleErrorf("at least one `tools` or `tool_files` is required")
Dan Willemsenf7f3d692016-04-20 14:54:32 -0700155 return
156 }
157
Colin Cross5ed99c62016-11-22 12:55:55 -0800158 if len(g.properties.Export_include_dirs) > 0 {
159 for _, dir := range g.properties.Export_include_dirs {
160 g.exportedIncludeDirs = append(g.exportedIncludeDirs,
161 android.PathForModuleGen(ctx, ctx.ModuleDir(), dir))
162 }
163 } else {
164 g.exportedIncludeDirs = append(g.exportedIncludeDirs, android.PathForModuleGen(ctx, ""))
165 }
Dan Willemsen3f4539b2016-09-28 16:19:10 -0700166
Colin Cross6f080df2016-11-04 15:32:58 -0700167 tools := map[string]android.Path{}
Dan Willemsen3f4539b2016-09-28 16:19:10 -0700168
Colin Cross6f080df2016-11-04 15:32:58 -0700169 if len(g.properties.Tools) > 0 {
Colin Crossd11fcda2017-10-23 17:59:01 -0700170 ctx.VisitDirectDeps(func(module android.Module) {
Dan Willemsend6ba0d52017-09-13 15:46:47 -0700171 switch ctx.OtherModuleDependencyTag(module) {
172 case android.SourceDepTag:
173 // Nothing to do
174 case hostToolDepTag:
175 tool := ctx.OtherModuleName(module)
Dan Willemsen8eded0a2017-09-13 16:07:44 -0700176 var path android.OptionalPath
Dan Willemsend6ba0d52017-09-13 15:46:47 -0700177
178 if t, ok := module.(HostToolProvider); ok {
Dan Willemsen8eded0a2017-09-13 16:07:44 -0700179 path = t.HostToolPath()
180 } else if t, ok := module.(bootstrap.GoBinaryTool); ok {
181 if s, err := filepath.Rel(android.PathForOutput(ctx).String(), t.InstallPath()); err == nil {
182 path = android.OptionalPathForPath(android.PathForOutput(ctx, s))
Colin Cross6f080df2016-11-04 15:32:58 -0700183 } else {
Dan Willemsen8eded0a2017-09-13 16:07:44 -0700184 ctx.ModuleErrorf("cannot find path for %q: %v", tool, err)
185 break
Colin Cross6f080df2016-11-04 15:32:58 -0700186 }
Dan Willemsenf7f3d692016-04-20 14:54:32 -0700187 } else {
Dan Willemsend6ba0d52017-09-13 15:46:47 -0700188 ctx.ModuleErrorf("%q is not a host tool provider", tool)
Dan Willemsen8eded0a2017-09-13 16:07:44 -0700189 break
190 }
191
192 if path.Valid() {
193 g.deps = append(g.deps, path.Path())
194 if _, exists := tools[tool]; !exists {
195 tools[tool] = path.Path()
196 } else {
197 ctx.ModuleErrorf("multiple tools for %q, %q and %q", tool, tools[tool], path.Path().String())
198 }
199 } else {
200 ctx.ModuleErrorf("host tool %q missing output file", tool)
Dan Willemsenf7f3d692016-04-20 14:54:32 -0700201 }
Dan Willemsend6ba0d52017-09-13 15:46:47 -0700202 default:
203 ctx.ModuleErrorf("unknown dependency on %q", ctx.OtherModuleName(module))
Colin Crossd350ecd2015-04-28 13:25:36 -0700204 }
Dan Willemsenf7f3d692016-04-20 14:54:32 -0700205 })
206 }
Colin Crossd350ecd2015-04-28 13:25:36 -0700207
Dan Willemsend6ba0d52017-09-13 15:46:47 -0700208 if ctx.Failed() {
209 return
210 }
211
Colin Cross6f080df2016-11-04 15:32:58 -0700212 for _, tool := range g.properties.Tool_files {
213 toolPath := android.PathForModuleSrc(ctx, tool)
214 g.deps = append(g.deps, toolPath)
215 if _, exists := tools[tool]; !exists {
216 tools[tool] = toolPath
217 } else {
218 ctx.ModuleErrorf("multiple tools for %q, %q and %q", tool, tools[tool], toolPath.String())
219 }
220 }
221
Jeff Gaston02a684b2017-10-27 14:59:27 -0700222 referencedDepfile := false
223
Jeff Gastonefc1b412017-03-29 17:29:06 -0700224 rawCommand, err := android.Expand(g.properties.Cmd, func(name string) (string, error) {
Colin Cross6f080df2016-11-04 15:32:58 -0700225 switch name {
226 case "location":
227 if len(g.properties.Tools) > 0 {
228 return tools[g.properties.Tools[0]].String(), nil
229 } else {
230 return tools[g.properties.Tool_files[0]].String(), nil
231 }
232 case "in":
233 return "${in}", nil
234 case "out":
Jeff Gastonefc1b412017-03-29 17:29:06 -0700235 return "__SBOX_OUT_FILES__", nil
Colin Cross33bfb0a2016-11-21 17:23:08 -0800236 case "depfile":
Jeff Gaston02a684b2017-10-27 14:59:27 -0700237 referencedDepfile = true
Colin Cross33bfb0a2016-11-21 17:23:08 -0800238 if !g.properties.Depfile {
239 return "", fmt.Errorf("$(depfile) used without depfile property")
240 }
Jeff Gaston02a684b2017-10-27 14:59:27 -0700241 return "__SBOX_DEPFILE__", nil
Colin Cross6f080df2016-11-04 15:32:58 -0700242 case "genDir":
Jeff Gaston02a684b2017-10-27 14:59:27 -0700243 path, err := sandboxPathForOutput(ctx, android.PathForModuleGen(ctx, "").String())
Jeff Gaston193f2fb2017-06-12 15:00:12 -0700244 if err != nil {
Jeff Gaston02a684b2017-10-27 14:59:27 -0700245 return "", err
Jeff Gastonefc1b412017-03-29 17:29:06 -0700246 }
Jeff Gaston02a684b2017-10-27 14:59:27 -0700247 return path, nil
Colin Cross6f080df2016-11-04 15:32:58 -0700248 default:
249 if strings.HasPrefix(name, "location ") {
250 label := strings.TrimSpace(strings.TrimPrefix(name, "location "))
251 if tool, ok := tools[label]; ok {
252 return tool.String(), nil
253 } else {
254 return "", fmt.Errorf("unknown location label %q", label)
255 }
256 }
257 return "", fmt.Errorf("unknown variable '$(%s)'", name)
258 }
259 })
260
Jeff Gaston02a684b2017-10-27 14:59:27 -0700261 if g.properties.Depfile && !referencedDepfile {
262 ctx.PropertyErrorf("cmd", "specified depfile=true but did not include a reference to '${depfile}' in cmd")
263 }
264
Colin Cross6f080df2016-11-04 15:32:58 -0700265 if err != nil {
266 ctx.PropertyErrorf("cmd", "%s", err.Error())
Colin Cross54c5dd52017-04-19 14:23:26 -0700267 return
Colin Cross6f080df2016-11-04 15:32:58 -0700268 }
269
Jeff Gastonefc1b412017-03-29 17:29:06 -0700270 // tell the sbox command which directory to use as its sandbox root
Jeff Gaston193f2fb2017-06-12 15:00:12 -0700271 buildDir := android.PathForOutput(ctx).String()
272 sandboxPath := shared.TempDirForOutDir(buildDir)
Jeff Gastonefc1b412017-03-29 17:29:06 -0700273
274 // recall that Sprintf replaces percent sign expressions, whereas dollar signs expressions remain as written,
275 // to be replaced later by ninja_strings.go
Jeff Gaston02a684b2017-10-27 14:59:27 -0700276 depfilePlaceholder := ""
277 if g.properties.Depfile {
278 depfilePlaceholder = "$depfileArgs"
279 }
280 sandboxCommand := fmt.Sprintf("$sboxCmd --sandbox-path %s --output-root %s -c %q %s $allouts", sandboxPath, buildDir, rawCommand, depfilePlaceholder)
Jeff Gastonefc1b412017-03-29 17:29:06 -0700281
Colin Cross33bfb0a2016-11-21 17:23:08 -0800282 ruleParams := blueprint.RuleParams{
Jeff Gastonefc1b412017-03-29 17:29:06 -0700283 Command: sandboxCommand,
284 CommandDeps: []string{"$sboxCmd"},
Colin Cross33bfb0a2016-11-21 17:23:08 -0800285 }
Colin Cross15e86d92017-10-20 15:07:08 -0700286 args := []string{"allouts"}
Colin Cross33bfb0a2016-11-21 17:23:08 -0800287 if g.properties.Depfile {
288 ruleParams.Deps = blueprint.DepsGCC
Jeff Gaston02a684b2017-10-27 14:59:27 -0700289 args = append(args, "depfileArgs")
Colin Cross33bfb0a2016-11-21 17:23:08 -0800290 }
291 g.rule = ctx.Rule(pctx, "generator", ruleParams, args...)
Colin Cross6f080df2016-11-04 15:32:58 -0700292
Colin Cross708c4242017-01-13 18:05:49 -0800293 srcFiles := ctx.ExpandSources(g.properties.Srcs, nil)
294 for _, task := range g.tasks(ctx, srcFiles) {
Colin Cross6f080df2016-11-04 15:32:58 -0700295 g.generateSourceFile(ctx, task)
Colin Crossd350ecd2015-04-28 13:25:36 -0700296 }
297}
298
Dan Willemsen3e5bdf22017-09-13 18:37:08 -0700299func (g *Module) generateSourceFile(ctx android.ModuleContext, task generateTask) {
Colin Cross67a5c132017-05-09 13:45:28 -0700300 desc := "generate"
Colin Cross15e86d92017-10-20 15:07:08 -0700301 if len(task.out) == 0 {
302 ctx.ModuleErrorf("must have at least one output file")
303 return
304 }
Colin Cross67a5c132017-05-09 13:45:28 -0700305 if len(task.out) == 1 {
306 desc += " " + task.out[0].Base()
307 }
308
Jeff Gaston02a684b2017-10-27 14:59:27 -0700309 var depFile android.ModuleGenPath
310 if g.properties.Depfile {
311 depFile = android.PathForModuleGen(ctx, task.out[0].Rel()+".d")
312 }
313
Colin Crossae887032017-10-23 17:16:14 -0700314 params := android.BuildParams{
Colin Cross15e86d92017-10-20 15:07:08 -0700315 Rule: g.rule,
316 Description: "generate",
317 Output: task.out[0],
318 ImplicitOutputs: task.out[1:],
319 Inputs: task.in,
320 Implicits: g.deps,
321 Args: map[string]string{
322 "allouts": strings.Join(task.out.Strings(), " "),
323 },
Colin Cross33bfb0a2016-11-21 17:23:08 -0800324 }
325 if g.properties.Depfile {
Jeff Gaston02a684b2017-10-27 14:59:27 -0700326 params.Depfile = android.PathForModuleGen(ctx, task.out[0].Rel()+".d")
327 params.Args["depfileArgs"] = "--depfile-out " + depFile.String()
Colin Cross33bfb0a2016-11-21 17:23:08 -0800328 }
Jeff Gaston02a684b2017-10-27 14:59:27 -0700329
Colin Crossae887032017-10-23 17:16:14 -0700330 ctx.Build(pctx, params)
Colin Crossd350ecd2015-04-28 13:25:36 -0700331
Dan Willemsen9c8681f2016-09-28 16:21:00 -0700332 for _, outputFile := range task.out {
333 g.outputFiles = append(g.outputFiles, outputFile)
334 }
Colin Crossd350ecd2015-04-28 13:25:36 -0700335}
336
Dan Willemsen3e5bdf22017-09-13 18:37:08 -0700337func generatorFactory(tasks taskFunc, props ...interface{}) *Module {
338 module := &Module{
Colin Crossd350ecd2015-04-28 13:25:36 -0700339 tasks: tasks,
340 }
341
Colin Cross36242852017-06-23 15:06:31 -0700342 module.AddProperties(props...)
343 module.AddProperties(&module.properties)
Colin Crossd350ecd2015-04-28 13:25:36 -0700344
Colin Cross36242852017-06-23 15:06:31 -0700345 return module
Colin Crossd350ecd2015-04-28 13:25:36 -0700346}
347
Dan Willemsen3e5bdf22017-09-13 18:37:08 -0700348func NewGenSrcs() *Module {
Colin Crossd350ecd2015-04-28 13:25:36 -0700349 properties := &genSrcsProperties{}
350
Colin Cross708c4242017-01-13 18:05:49 -0800351 tasks := func(ctx android.ModuleContext, srcFiles android.Paths) []generateTask {
Colin Crossd350ecd2015-04-28 13:25:36 -0700352 tasks := make([]generateTask, 0, len(srcFiles))
353 for _, in := range srcFiles {
Dan Willemsen34cc69e2015-09-23 15:26:20 -0700354 tasks = append(tasks, generateTask{
Colin Cross635c3b02016-05-18 15:37:25 -0700355 in: android.Paths{in},
Dan Willemsen21ec4902016-11-02 20:43:13 -0700356 out: android.WritablePaths{android.GenPathWithExt(ctx, "", in, properties.Output_extension)},
Dan Willemsen34cc69e2015-09-23 15:26:20 -0700357 })
Colin Crossd350ecd2015-04-28 13:25:36 -0700358 }
359 return tasks
360 }
361
362 return generatorFactory(tasks, properties)
363}
364
Colin Cross54190b32017-10-09 15:34:10 -0700365func GenSrcsFactory() android.Module {
Dan Willemsen3e5bdf22017-09-13 18:37:08 -0700366 m := NewGenSrcs()
367 android.InitAndroidModule(m)
368 return m
369}
370
Colin Crossd350ecd2015-04-28 13:25:36 -0700371type genSrcsProperties struct {
Colin Cross7d5136f2015-05-11 13:39:40 -0700372 // extension that will be substituted for each output file
Colin Cross5049f022015-03-18 13:28:46 -0700373 Output_extension string
374}
375
Dan Willemsen3e5bdf22017-09-13 18:37:08 -0700376func NewGenRule() *Module {
Colin Crossd350ecd2015-04-28 13:25:36 -0700377 properties := &genRuleProperties{}
Colin Cross5049f022015-03-18 13:28:46 -0700378
Colin Cross708c4242017-01-13 18:05:49 -0800379 tasks := func(ctx android.ModuleContext, srcFiles android.Paths) []generateTask {
Dan Willemsen9c8681f2016-09-28 16:21:00 -0700380 outs := make(android.WritablePaths, len(properties.Out))
381 for i, out := range properties.Out {
382 outs[i] = android.PathForModuleGen(ctx, out)
383 }
Colin Crossd350ecd2015-04-28 13:25:36 -0700384 return []generateTask{
385 {
Colin Cross708c4242017-01-13 18:05:49 -0800386 in: srcFiles,
Dan Willemsen9c8681f2016-09-28 16:21:00 -0700387 out: outs,
Colin Crossd350ecd2015-04-28 13:25:36 -0700388 },
389 }
Colin Cross5049f022015-03-18 13:28:46 -0700390 }
Colin Crossd350ecd2015-04-28 13:25:36 -0700391
392 return generatorFactory(tasks, properties)
Colin Cross5049f022015-03-18 13:28:46 -0700393}
394
Colin Cross54190b32017-10-09 15:34:10 -0700395func GenRuleFactory() android.Module {
Dan Willemsen3e5bdf22017-09-13 18:37:08 -0700396 m := NewGenRule()
397 android.InitAndroidModule(m)
398 return m
399}
400
Colin Crossd350ecd2015-04-28 13:25:36 -0700401type genRuleProperties struct {
Dan Willemsen9c8681f2016-09-28 16:21:00 -0700402 // names of the output files that will be generated
403 Out []string
Colin Cross5049f022015-03-18 13:28:46 -0700404}