diff options
author | Dan Willemsen <dwillemsen@google.com> | 2016-11-03 14:28:51 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2016-12-05 15:49:40 -0800 |
commit | e1240db6ab4d6e2bb669bfaeb8f31362d93f533d (patch) | |
tree | 9b8a4b4036e1c0cb7d50de78f0a6862d25f50320 /cc/gen.go | |
parent | 91e90040863fdec48eccb8be75326f60c0413133 (diff) | |
download | build_soong-e1240db6ab4d6e2bb669bfaeb8f31362d93f533d.tar.gz build_soong-e1240db6ab4d6e2bb669bfaeb8f31362d93f533d.tar.bz2 build_soong-e1240db6ab4d6e2bb669bfaeb8f31362d93f533d.zip |
Support aidl cpp generation
Ideally we'd calculate the headers that are written here too, but I'll
add that in a later change that actually enforces the generated header
list.
Test: mmma -j system/tools/aidl
Change-Id: Ifd2e8e8ff444b0f67270fb5156e7bf7bceddb6be
Diffstat (limited to 'cc/gen.go')
-rw-r--r-- | cc/gen.go | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -28,6 +28,8 @@ func init() { pctx.SourcePathVariable("lexCmd", "prebuilts/misc/${config.HostPrebuiltTag}/flex/flex-2.5.39") pctx.SourcePathVariable("yaccCmd", "prebuilts/misc/${config.HostPrebuiltTag}/bison/bison") pctx.SourcePathVariable("yaccDataDir", "external/bison/data") + + pctx.HostBinToolVariable("aidlCmd", "aidl-cpp") } var ( @@ -45,6 +47,16 @@ var ( CommandDeps: []string{"$lexCmd"}, Description: "lex $out", }) + + aidl = pctx.AndroidStaticRule("aidl", + blueprint.RuleParams{ + Command: "$aidlCmd -d${out}.d -ninja $aidlFlags $in $outDir $out", + CommandDeps: []string{"$aidlCmd"}, + Depfile: "${out}.d", + Deps: blueprint.DepsGCC, + Description: "aidl $out", + }, + "aidlFlags", "outDir") ) func genYacc(ctx android.ModuleContext, yaccFile android.Path, outFile android.ModuleGenPath, yaccFlags string) (headerFile android.ModuleGenPath) { @@ -64,6 +76,22 @@ func genYacc(ctx android.ModuleContext, yaccFile android.Path, outFile android.M return headerFile } +func genAidl(ctx android.ModuleContext, aidlFile android.Path, outFile android.ModuleGenPath, aidlFlags string) android.Paths { + + ctx.ModuleBuild(pctx, android.ModuleBuildParams{ + Rule: aidl, + Output: outFile, + Input: aidlFile, + Args: map[string]string{ + "aidlFlags": aidlFlags, + "outDir": android.PathForModuleGen(ctx, "aidl").String(), + }, + }) + + // TODO: This should return the generated headers, not the source file. + return android.Paths{outFile} +} + func genLex(ctx android.ModuleContext, lexFile android.Path, outFile android.ModuleGenPath) { ctx.ModuleBuild(pctx, android.ModuleBuildParams{ Rule: lex, @@ -99,6 +127,10 @@ func genSources(ctx android.ModuleContext, srcFiles android.Paths, cppFile, headerFile := genProto(ctx, srcFile, buildFlags.protoFlags) srcFiles[i] = cppFile deps = append(deps, headerFile) + case ".aidl": + cppFile := android.GenPathWithExt(ctx, "aidl", srcFile, "cpp") + srcFiles[i] = cppFile + deps = append(deps, genAidl(ctx, srcFile, cppFile, buildFlags.aidlFlags)...) } } |