diff options
author | Jiyong Park <jiyong@google.com> | 2019-08-16 21:12:10 +0900 |
---|---|---|
committer | Jiyong Park <jiyong@google.com> | 2019-08-26 08:09:33 +0000 |
commit | 1112c4c0d749e322c2e02616ba3abbd2e067564d (patch) | |
tree | df6cb6b95db44ed4cc3c3182152f9759177a591c /java/gen.go | |
parent | fb7e0b3aa2f3502fe4db83908833ba10cce6f24f (diff) | |
download | build_soong-1112c4c0d749e322c2e02616ba3abbd2e067564d.tar.gz build_soong-1112c4c0d749e322c2e02616ba3abbd2e067564d.tar.bz2 build_soong-1112c4c0d749e322c2e02616ba3abbd2e067564d.zip |
Remove srcs_lib_whitelist_dirs
This change removes srcs_lib_whitelist_dirs which was used to let
droiddoc to know the base directories for the AIDL/Java source files.
Instead, the base directories are given via the path property of the
filegroup modules.
This change also includes a fix that the base directories from all
filegroup modules listed in srcs are used as the import paths for the
AIDL compiler. This removes the need to have aidl.[local_]include_dirs.
Bug: 70046217
Test: m
Exempt-From-Owner-Approval: Approved internally
Merged-In: I62ff2a7dd3943d9a3d95d91c36a30fd44ea467d2
(cherry picked from commit f79334d95cd2fd770db1d7ad5a88d1756758b15b)
Change-Id: I62ff2a7dd3943d9a3d95d91c36a30fd44ea467d2
Diffstat (limited to 'java/gen.go')
-rw-r--r-- | java/gen.go | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/java/gen.go b/java/gen.go index 69965ece..c9cabc82 100644 --- a/java/gen.go +++ b/java/gen.go @@ -65,10 +65,6 @@ var ( func genAidl(ctx android.ModuleContext, aidlFile android.Path, aidlFlags string, deps android.Paths) android.Path { javaFile := android.GenPathWithExt(ctx, "aidl", aidlFile, "java") depFile := javaFile.String() + ".d" - baseDir := strings.TrimSuffix(aidlFile.String(), aidlFile.Rel()) - if baseDir != "" { - aidlFlags += " -I" + baseDir - } ctx.Build(pctx, android.BuildParams{ Rule: aidl, @@ -111,15 +107,30 @@ func genSysprop(ctx android.ModuleContext, syspropFile android.Path) android.Pat return srcJarFile } +func genAidlIncludeFlags(srcFiles android.Paths) string { + var baseDirs []string + for _, srcFile := range srcFiles { + if srcFile.Ext() == ".aidl" { + baseDir := strings.TrimSuffix(srcFile.String(), srcFile.Rel()) + if baseDir != "" && !android.InList(baseDir, baseDirs) { + baseDirs = append(baseDirs, baseDir) + } + } + } + return android.JoinWithPrefix(baseDirs, " -I") +} + func (j *Module) genSources(ctx android.ModuleContext, srcFiles android.Paths, flags javaBuilderFlags) android.Paths { outSrcFiles := make(android.Paths, 0, len(srcFiles)) + aidlIncludeFlags := genAidlIncludeFlags(srcFiles) + for _, srcFile := range srcFiles { switch srcFile.Ext() { case ".aidl": - javaFile := genAidl(ctx, srcFile, flags.aidlFlags, flags.aidlDeps) + javaFile := genAidl(ctx, srcFile, flags.aidlFlags+aidlIncludeFlags, flags.aidlDeps) outSrcFiles = append(outSrcFiles, javaFile) case ".logtags": j.logtagsSrcs = append(j.logtagsSrcs, srcFile) |