diff options
| author | 2018-02-23 11:18:47 -0800 | |
|---|---|---|
| committer | 2018-03-09 10:53:42 -0800 | |
| commit | b2b33de3c0699cf4a17c3519fe1916fafba73d2d (patch) | |
| tree | 6ef71e6792950a8726370c1bcb9e28cb299d784b /java/java.go | |
| parent | 8aed42c798419bb66bfc5214aaa8d0ce8d125958 (diff) | |
Fetch generated srcs from java libs for droiddoc.
api-stubs, system-api-stubs and etc need generated sources and srcjars from "framework",
so add a property that tell module to fetch srcs and srcjars from its
dependency libraries. The libraries in that property has to be in the
module's classpath.
Also add doc_defaults targets.
Bug: b/70351683
Test: m -j
Change-Id: I05831fbcad488037710950e4f05dc8fb2a12f403
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 { |