aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-07-20 01:39:59 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-07-20 01:39:59 +0000
commitafb1764d9b122abefe0704fcacdac8900e14bb7b (patch)
treef133f9888807187c2a65295752e6f313e9065159
parenteb49242cbeb1d7c568705180dca42d9524e910f6 (diff)
parent4cab63a8e79797e25be5f2f54271f2ba05a2542b (diff)
downloadbuild_soong-afb1764d9b122abefe0704fcacdac8900e14bb7b.tar.gz
build_soong-afb1764d9b122abefe0704fcacdac8900e14bb7b.tar.bz2
build_soong-afb1764d9b122abefe0704fcacdac8900e14bb7b.zip
Use android.Prebuilt for JavaPrebuilts am: ec7a0424c3 am: bad72547e1
am: 4cab63a8e7 Change-Id: I1825f12eee21c7c21c8bda6ecc47790ee2affe88
-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