diff options
Diffstat (limited to 'java/java.go')
| -rw-r--r-- | java/java.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/java/java.go b/java/java.go index 92170e680..5f5225c4d 100644 --- a/java/java.go +++ b/java/java.go @@ -283,6 +283,21 @@ type Dependency interface { AidlIncludeDirs() android.Paths } +type SrcDependency interface { + CompiledSrcs() android.Paths + CompiledSrcJars() android.Paths +} + +func (j *Module) CompiledSrcs() android.Paths { + return j.compiledJavaSrcs +} + +func (j *Module) CompiledSrcJars() android.Paths { + return j.compiledSrcJars +} + +var _ SrcDependency = (*Module)(nil) + func InitJavaModule(module android.DefaultableModule, hod android.HostOrDeviceSupported) { android.InitAndroidArchModule(module, hod, android.MultilibCommon) android.InitDefaultableModule(module) @@ -299,6 +314,7 @@ var ( bootClasspathTag = dependencyTag{name: "bootclasspath"} systemModulesTag = dependencyTag{name: "system modules"} frameworkResTag = dependencyTag{name: "framework-res"} + frameworkApkTag = dependencyTag{name: "framework-apk"} kotlinStdlibTag = dependencyTag{name: "kotlin-stdlib"} proguardRaiseTag = dependencyTag{name: "proguard-raise"} ) @@ -459,6 +475,11 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) { if ctx.ModuleName() == "framework" { ctx.AddDependency(ctx.Module(), frameworkResTag, "framework-res") } + if ctx.ModuleName() == "android_stubs_current" || + ctx.ModuleName() == "android_system_stubs_current" || + ctx.ModuleName() == "android_test_stubs_current" { + ctx.AddDependency(ctx.Module(), frameworkApkTag, "framework-res") + } } ctx.AddDependency(ctx.Module(), libTag, j.properties.Libs...) @@ -544,6 +565,7 @@ type deps struct { staticHeaderJars android.Paths staticJarResources android.Paths aidlIncludeDirs android.Paths + srcs android.Paths srcJars android.Paths systemModules android.Path aidlPreprocess android.OptionalPath @@ -606,6 +628,18 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps { // generated by framework-res.apk deps.srcJars = append(deps.srcJars, dep.(*AndroidApp).aaptSrcJar) } + case frameworkApkTag: + if ctx.ModuleName() == "android_stubs_current" || + ctx.ModuleName() == "android_system_stubs_current" || + ctx.ModuleName() == "android_test_stubs_current" { + // framework stubs.jar need to depend on framework-res.apk, in order to pull the + // resource files out of there for aapt. + // + // Normally the package rule runs aapt, which includes the resource, + // but we're not running that in our package rule so just copy in the + // resource files here. + deps.staticJarResources = append(deps.staticJarResources, dep.(*AndroidApp).exportPackage) + } case kotlinStdlibTag: deps.kotlinStdlib = dep.HeaderJars() default: @@ -895,6 +929,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path // static classpath jars have the resources in them, so the resource jars aren't necessary here jars = append(jars, deps.staticJars...) + jars = append(jars, deps.staticJarResources...) var manifest android.OptionalPath if j.properties.Manifest != nil { |