java: add one-off build logic for frameworks/base

framework.jar needs to compile against R.java and Manifest.java from
framework-res.apk.  Rather than complicating the Blueprints properties
with values that will only be used once, add one-off logic to
collectDeps to extract the rJarSpec out of the framework-res module.

Change-Id: I1195b1b5e07badc583703479382ceba35300b8fd
This commit is contained in:
Colin Cross
2015-04-13 14:02:52 -07:00
parent 276284f577
commit e7a9f3f7ed
2 changed files with 15 additions and 7 deletions

View File

@@ -31,7 +31,6 @@ import (
// TODO:
// Autogenerated files:
// AIDL
// Proto
// Renderscript
// Post-jar passes:
@@ -192,7 +191,7 @@ func (j *javaBase) aidlFlags(ctx common.AndroidModuleContext, aidlPreprocess str
func (j *javaBase) collectDeps(ctx common.AndroidModuleContext) (classpath []string,
bootClasspath string, classJarSpecs, resourceJarSpecs []jarSpec, aidlPreprocess string,
aidlIncludeDirs []string) {
aidlIncludeDirs []string, srcFileLists []string) {
ctx.VisitDirectDeps(func(module blueprint.Module) {
otherName := ctx.OtherModuleName(module)
@@ -205,6 +204,10 @@ func (j *javaBase) collectDeps(ctx common.AndroidModuleContext) (classpath []str
classpath = append(classpath, javaDep.ClasspathFile())
classJarSpecs = append(classJarSpecs, javaDep.ClassJarSpecs()...)
resourceJarSpecs = append(resourceJarSpecs, javaDep.ResourceJarSpecs()...)
} else if ctx.ModuleName() == "framework" && otherName == "framework-res" {
// framework.jar has a one-off dependency on the R.java and Manifest.java files
// generated by framework-res.apk
srcFileLists = append(srcFileLists, module.(*javaBase).module.(*AndroidApp).rJarSpec.fileList)
} else {
panic(fmt.Errorf("unknown dependency %q for %q", otherName, ctx.ModuleName()))
}
@@ -224,7 +227,8 @@ func (j *javaBase) collectDeps(ctx common.AndroidModuleContext) (classpath []str
}
})
return classpath, bootClasspath, classJarSpecs, resourceJarSpecs, aidlPreprocess, aidlIncludeDirs
return classpath, bootClasspath, classJarSpecs, resourceJarSpecs, aidlPreprocess,
aidlIncludeDirs, srcFileLists
}
func (j *javaBase) GenerateAndroidBuildActions(ctx common.AndroidModuleContext) {
@@ -237,7 +241,7 @@ func (j *javaBase) GenerateJavaBuildActions(ctx common.AndroidModuleContext) {
common.ModuleSrcDir(ctx))
classpath, bootClasspath, classJarSpecs, resourceJarSpecs, aidlPreprocess,
aidlIncludeDirs := j.collectDeps(ctx)
aidlIncludeDirs, srcFileLists := j.collectDeps(ctx)
var flags javaBuilderFlags
@@ -271,7 +275,7 @@ func (j *javaBase) GenerateJavaBuildActions(ctx common.AndroidModuleContext) {
if len(srcFiles) > 0 {
// Compile java sources into .class files
classes := TransformJavaToClasses(ctx, srcFiles, flags, javacDeps)
classes := TransformJavaToClasses(ctx, srcFiles, srcFileLists, flags, javacDeps)
if ctx.Failed() {
return
}