summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2019-04-21 17:20:16 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2019-04-21 17:20:16 +0000
commit8bf9bd9f913055784418e5fb7eace21942cae422 (patch)
tree2de19c60e0316e9fb56064f8a524c0761508bd15 /java/java.go
parent7fdab6eeecb9dacdb4a4a7c7ce60b583657fdba7 (diff)
parent3047fa23da6d9f6e504c81e275ad7f6761fb7c7b (diff)
Merge "Build framework.aidl in Soong"
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go38
1 files changed, 22 insertions, 16 deletions
diff --git a/java/java.go b/java/java.go
index 2cf9267fb..d6c759b45 100644
--- a/java/java.go
+++ b/java/java.go
@@ -416,7 +416,7 @@ type sdkDep struct {
frameworkResModule string
jars android.Paths
- aidl android.Path
+ aidl android.OptionalPath
}
type jniLib struct {
@@ -540,7 +540,7 @@ func (j *Module) hasSrcExt(ext string) bool {
}
func (j *Module) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.OptionalPath,
- aidlIncludeDirs android.Paths) []string {
+ aidlIncludeDirs android.Paths) (string, android.Paths) {
aidlIncludes := android.PathsForModuleSrc(ctx, j.deviceProperties.Aidl.Local_include_dirs)
aidlIncludes = append(aidlIncludes,
@@ -548,16 +548,24 @@ func (j *Module) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.Opt
aidlIncludes = append(aidlIncludes,
android.PathsForSource(ctx, j.deviceProperties.Aidl.Include_dirs)...)
- flags := []string{}
+ var flags []string
+ var deps android.Paths
if aidlPreprocess.Valid() {
flags = append(flags, "-p"+aidlPreprocess.String())
- } else {
+ deps = append(deps, aidlPreprocess.Path())
+ } else if len(aidlIncludeDirs) > 0 {
flags = append(flags, android.JoinWithPrefix(aidlIncludeDirs.Strings(), "-I"))
}
- flags = append(flags, android.JoinWithPrefix(j.exportAidlIncludeDirs.Strings(), "-I"))
- flags = append(flags, android.JoinWithPrefix(aidlIncludes.Strings(), "-I"))
+ if len(j.exportAidlIncludeDirs) > 0 {
+ flags = append(flags, android.JoinWithPrefix(j.exportAidlIncludeDirs.Strings(), "-I"))
+ }
+
+ if len(aidlIncludes) > 0 {
+ flags = append(flags, android.JoinWithPrefix(aidlIncludes.Strings(), "-I"))
+ }
+
flags = append(flags, "-I"+android.PathForModuleSrc(ctx).String())
if src := android.ExistentPathForSource(ctx, ctx.ModuleDir(), "src"); src.Valid() {
flags = append(flags, "-I"+src.String())
@@ -571,7 +579,7 @@ func (j *Module) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.Opt
flags = append(flags, "--transaction_names")
}
- return flags
+ return strings.Join(flags, " "), deps
}
type deps struct {
@@ -689,7 +697,9 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
} else if sdkDep.useFiles {
// sdkDep.jar is actually equivalent to turbine header.jar.
deps.classpath = append(deps.classpath, sdkDep.jars...)
- deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, sdkDep.aidl)
+ deps.aidlPreprocess = sdkDep.aidl
+ } else {
+ deps.aidlPreprocess = sdkDep.aidl
}
}
@@ -730,6 +740,7 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
deps.classpath = append(deps.classpath, dep.HeaderJars()...)
// sdk lib names from dependencies are re-exported
j.exportedSdkLibs = append(j.exportedSdkLibs, dep.ExportedSdkLibs()...)
+ deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, dep.AidlIncludeDirs()...)
case staticLibTag:
deps.classpath = append(deps.classpath, dep.HeaderJars()...)
deps.staticJars = append(deps.staticJars, dep.ImplementationJars()...)
@@ -737,6 +748,7 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
deps.staticResourceJars = append(deps.staticResourceJars, dep.ResourceJars()...)
// sdk lib names from dependencies are re-exported
j.exportedSdkLibs = append(j.exportedSdkLibs, dep.ExportedSdkLibs()...)
+ deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, dep.AidlIncludeDirs()...)
case pluginTag:
if plugin, ok := dep.(*Plugin); ok {
deps.processorPath = append(deps.processorPath, dep.ImplementationAndResourcesJars()...)
@@ -771,7 +783,6 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
deps.kotlinAnnotations = dep.HeaderJars()
}
- deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, dep.AidlIncludeDirs()...)
case android.SourceFileProducer:
switch tag {
case libTag:
@@ -812,7 +823,7 @@ func getJavaVersion(ctx android.ModuleContext, javaVersion string, sdkContext sd
v := sdkContext.sdkVersion()
// For PDK builds, use the latest SDK version instead of "current"
if ctx.Config().IsPdkBuild() && (v == "" || v == "current") {
- sdkVersions := ctx.Config().Get(sdkSingletonKey).([]int)
+ sdkVersions := ctx.Config().Get(sdkVersionsKey).([]int)
latestSdkVersion := 0
if len(sdkVersions) > 0 {
latestSdkVersion = sdkVersions[len(sdkVersions)-1]
@@ -925,12 +936,7 @@ func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaB
}
// aidl flags.
- aidlFlags := j.aidlFlags(ctx, deps.aidlPreprocess, deps.aidlIncludeDirs)
- if len(aidlFlags) > 0 {
- // optimization.
- ctx.Variable(pctx, "aidlFlags", strings.Join(aidlFlags, " "))
- flags.aidlFlags = "$aidlFlags"
- }
+ flags.aidlFlags, flags.aidlDeps = j.aidlFlags(ctx, deps.aidlPreprocess, deps.aidlIncludeDirs)
if len(javacFlags) > 0 {
// optimization.