aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-07-20 01:34:59 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-07-20 01:34:59 +0000
commitbad72547e16affbe6dcd92e5f61bbb1a3af5c997 (patch)
treecf4f14b169d37c61b1722f2f57d9cb05e091a3e9
parenta7be5fbb7e3342bd87b3381389192e537f8f63d7 (diff)
parentec7a0424c37289762107ce8ecd7e3be83d00eb34 (diff)
downloadbuild_soong-bad72547e16affbe6dcd92e5f61bbb1a3af5c997.tar.gz
build_soong-bad72547e16affbe6dcd92e5f61bbb1a3af5c997.tar.bz2
build_soong-bad72547e16affbe6dcd92e5f61bbb1a3af5c997.zip
Use android.Prebuilt for JavaPrebuilts
am: ec7a0424c3 Change-Id: I65c6b1355c4bfd94c70b7a1c355139329109ec07
-rw-r--r--java/java.go79
1 files changed, 48 insertions, 31 deletions
diff --git a/java/java.go b/java/java.go
index adb3d7bd..195a0783 100644
--- a/java/java.go
+++ b/java/java.go
@@ -216,35 +216,45 @@ func (j *Module) collectDeps(ctx android.ModuleContext) (classpath android.Paths
ctx.VisitDirectDeps(func(module blueprint.Module) {
otherName := ctx.OtherModuleName(module)
- if javaDep, ok := module.(JavaDependency); ok {
- if otherName == j.BootClasspath(ctx) {
- bootClasspath = android.OptionalPathForPath(javaDep.ClasspathFile())
- } else if inList(otherName, config.DefaultLibraries) {
- classpath = append(classpath, javaDep.ClasspathFile())
- } else if inList(otherName, j.properties.Java_libs) {
- classpath = append(classpath, javaDep.ClasspathFile())
- } else if inList(otherName, j.properties.Java_static_libs) {
- classpath = append(classpath, javaDep.ClasspathFile())
- classJarSpecs = append(classJarSpecs, javaDep.ClassJarSpecs()...)
- resourceJarSpecs = append(resourceJarSpecs, javaDep.ResourceJarSpecs()...)
- } else if otherName == "framework-res" {
- if ctx.ModuleName() == "framework" {
- // framework.jar has a one-off dependency on the R.java and Manifest.java files
- // generated by framework-res.apk
- srcFileLists = append(srcFileLists, module.(*AndroidApp).aaptJavaFileList)
- }
- } else {
- panic(fmt.Errorf("unknown dependency %q for %q", otherName, ctx.ModuleName()))
+ tag := ctx.OtherModuleDependencyTag(module)
+
+ javaDep, _ := module.(JavaDependency)
+ if javaDep == nil {
+ switch tag {
+ case android.DefaultsDepTag, android.SourceDepTag:
+ default:
+ ctx.ModuleErrorf("depends on non-java module %q", otherName)
+ }
+ return
+ }
+
+ if otherName == j.BootClasspath(ctx) {
+ bootClasspath = android.OptionalPathForPath(javaDep.ClasspathFile())
+ } else if inList(otherName, config.DefaultLibraries) {
+ classpath = append(classpath, javaDep.ClasspathFile())
+ } else if inList(otherName, j.properties.Java_libs) {
+ classpath = append(classpath, javaDep.ClasspathFile())
+ } else if inList(otherName, j.properties.Java_static_libs) {
+ classpath = append(classpath, javaDep.ClasspathFile())
+ classJarSpecs = append(classJarSpecs, javaDep.ClassJarSpecs()...)
+ resourceJarSpecs = append(resourceJarSpecs, javaDep.ResourceJarSpecs()...)
+ } else if otherName == "framework-res" {
+ if ctx.ModuleName() == "framework" {
+ // framework.jar has a one-off dependency on the R.java and Manifest.java files
+ // generated by framework-res.apk
+ srcFileLists = append(srcFileLists, module.(*AndroidApp).aaptJavaFileList)
}
- aidlIncludeDirs = append(aidlIncludeDirs, javaDep.AidlIncludeDirs()...)
- if sdkDep, ok := module.(sdkDependency); ok {
- if sdkDep.AidlPreprocessed().Valid() {
- if aidlPreprocess.Valid() {
- ctx.ModuleErrorf("multiple dependencies with preprocessed aidls:\n %q\n %q",
- aidlPreprocess, sdkDep.AidlPreprocessed())
- } else {
- aidlPreprocess = sdkDep.AidlPreprocessed()
- }
+ } else {
+ panic(fmt.Errorf("unknown dependency %q for %q", otherName, ctx.ModuleName()))
+ }
+ aidlIncludeDirs = append(aidlIncludeDirs, javaDep.AidlIncludeDirs()...)
+ if sdkDep, ok := module.(sdkDependency); ok {
+ if sdkDep.AidlPreprocessed().Valid() {
+ if aidlPreprocess.Valid() {
+ ctx.ModuleErrorf("multiple dependencies with preprocessed aidls:\n %q\n %q",
+ aidlPreprocess, sdkDep.AidlPreprocessed())
+ } else {
+ aidlPreprocess = sdkDep.AidlPreprocessed()
}
}
}
@@ -500,19 +510,24 @@ func JavaBinaryHostFactory() android.Module {
// Java prebuilts
//
-type javaPrebuiltProperties struct {
+type JavaPrebuiltProperties struct {
Srcs []string
}
type JavaPrebuilt struct {
android.ModuleBase
+ prebuilt android.Prebuilt
- properties javaPrebuiltProperties
+ properties JavaPrebuiltProperties
classpathFile android.Path
classJarSpecs, resourceJarSpecs []jarSpec
}
+func (j *JavaPrebuilt) Prebuilt() *android.Prebuilt {
+ return &j.prebuilt
+}
+
func (j *JavaPrebuilt) DepsMutator(ctx android.BottomUpMutatorContext) {
}
@@ -552,7 +567,9 @@ func (j *JavaPrebuilt) AidlIncludeDirs() android.Paths {
func JavaPrebuiltFactory() android.Module {
module := &JavaPrebuilt{}
- module.AddProperties(&module.properties)
+ module.AddProperties(
+ &module.properties,
+ &module.prebuilt.Properties)
android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon)
return module