diff options
author | 2020-07-17 19:28:53 -0700 | |
---|---|---|
committer | 2020-08-06 15:56:09 -0700 | |
commit | 6a6478d49e78703ba22a432c41d819c8df79ef6c (patch) | |
tree | 3778d606b6ec8a2bc6d08683a0f29619d2f497a3 /android/filegroup.go | |
parent | 217a1e406ea3b7e1cbf228d7d4d8a4f555ba482d (diff) |
Reland "Support per-module MakeVars"
This allows setting per-module make variables earlier in the build,
particularly for prebuilt_build_tool users like LEX/M4/BISON (which will
come in a later CL). I moved filegroup over because it's a simpler
common interface, but it doesn't strictly need it.
Test: Inspect out/soong/make_vars-*.mk, out/soong/late-*.mk
Test: treehugger
Change-Id: I38631129d82b0aad2438e83610bb6a97568bf932
Diffstat (limited to 'android/filegroup.go')
-rw-r--r-- | android/filegroup.go | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/android/filegroup.go b/android/filegroup.go index ec522fc06..68311e39a 100644 --- a/android/filegroup.go +++ b/android/filegroup.go @@ -15,9 +15,7 @@ package android import ( - "io" "strings" - "text/template" ) func init() { @@ -71,23 +69,8 @@ func (fg *fileGroup) Srcs() Paths { return append(Paths{}, fg.srcs...) } -var androidMkTemplate = template.Must(template.New("filegroup").Parse(` -ifdef {{.makeVar}} - $(error variable {{.makeVar}} set by soong module is already set in make) -endif -{{.makeVar}} := {{.value}} -.KATI_READONLY := {{.makeVar}} -`)) - -func (fg *fileGroup) AndroidMk() AndroidMkData { - return AndroidMkData{ - Custom: func(w io.Writer, name, prefix, moduleDir string, data AndroidMkData) { - if makeVar := String(fg.properties.Export_to_make_var); makeVar != "" { - androidMkTemplate.Execute(w, map[string]string{ - "makeVar": makeVar, - "value": strings.Join(fg.srcs.Strings(), " "), - }) - } - }, +func (fg *fileGroup) MakeVars(ctx MakeVarsModuleContext) { + if makeVar := String(fg.properties.Export_to_make_var); makeVar != "" { + ctx.StrictRaw(makeVar, strings.Join(fg.srcs.Strings(), " ")) } } |