aboutsummaryrefslogtreecommitdiff
path: root/build/aidl_gen_rule.go
diff options
context:
space:
mode:
authorJooyung Han <jooyung@google.com>2021-06-04 19:49:34 +0900
committerJooyung Han <jooyung@google.com>2021-06-08 04:45:21 +0000
commit42c5f2901a498fce38dab37d028d00682d5c2150 (patch)
tree1dcc1902f3340fb3f98e8d78f2c34e631b9d81c9 /build/aidl_gen_rule.go
parent93f48f05694750c45ef959941d2d7674236c5bb2 (diff)
downloadaidl-42c5f2901a498fce38dab37d028d00682d5c2150.tar.gz
use preprocessed.aidl for imported modules
For the AIDL compiler to load imported types - each module generates preprocessed.aidl - pass preprocessed.aidl with -p for imported modules This prevents the compiler from loading the entire dependencies. Bug: 189728905 Test: m Change-Id: I5e015bef38efe86efed63bbbd7e12a992eecb9f0
Diffstat (limited to 'build/aidl_gen_rule.go')
-rw-r--r--build/aidl_gen_rule.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/build/aidl_gen_rule.go b/build/aidl_gen_rule.go
index c38f1b45..aad984fc 100644
--- a/build/aidl_gen_rule.go
+++ b/build/aidl_gen_rule.go
@@ -65,7 +65,6 @@ var (
type aidlGenProperties struct {
Srcs []string `android:"path"`
AidlRoot string // base directory for the input aidl file
- IsToT bool
ImportsWithoutVersion []string
Stability *string
Lang string // target language [java|cpp|ndk|rust]
@@ -83,6 +82,7 @@ type aidlGenRule struct {
properties aidlGenProperties
+ deps deps
implicitInputs android.Paths
importFlags string
@@ -105,12 +105,14 @@ func (g *aidlGenRule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
return
}
+ g.deps = getDeps(ctx)
+
genDirTimestamp := android.PathForModuleGen(ctx, "timestamp") // $out/gen/timestamp
g.implicitInputs = append(g.implicitInputs, genDirTimestamp)
+ g.implicitInputs = append(g.implicitInputs, g.deps.implicits...)
+ g.implicitInputs = append(g.implicitInputs, g.deps.preprocessed...)
- importPaths, implicits := getImportsFromDeps(ctx, g.properties.IsToT)
- imports = append(imports, importPaths...)
-
+ imports = append(imports, g.deps.imports...)
g.importFlags = strings.Join(wrap("-I", imports, ""), " ")
g.genOutDir = android.PathForModuleGen(ctx)
@@ -123,10 +125,9 @@ func (g *aidlGenRule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// This is to clean genOutDir before generating any file
ctx.Build(pctx, android.BuildParams{
- Rule: aidlDirPrepareRule,
- Implicits: implicits,
- Inputs: srcs,
- Output: genDirTimestamp,
+ Rule: aidlDirPrepareRule,
+ Inputs: srcs,
+ Output: genDirTimestamp,
Args: map[string]string{
"outDir": g.genOutDir.String(),
},
@@ -177,6 +178,7 @@ func (g *aidlGenRule) generateBuildActionsForSingleAidl(ctx android.ModuleContex
if g.properties.Stability != nil {
optionalFlags = append(optionalFlags, "--stability", *g.properties.Stability)
}
+ optionalFlags = append(optionalFlags, wrap("-p", g.deps.preprocessed.Strings(), "")...)
var headers android.WritablePaths
if g.properties.Lang == langJava {