Add support for android_library modules

Add support for compiling android_library modules into AARs,
and refactor app support on top of it.

Bug: 73724997
Test: app_test.go
Change-Id: I1dfac5fffe577c6680bc4709147b2061eb7d819c
This commit is contained in:
Colin Cross
2018-03-28 14:58:31 -07:00
parent ad6cbf18da
commit a97c5d3f08
11 changed files with 576 additions and 360 deletions

View File

@@ -334,6 +334,8 @@ type sdkDep struct {
module string
systemModules string
frameworkResModule string
jar android.Path
aidl android.Path
}
@@ -423,11 +425,12 @@ func decodeSdkDep(ctx android.BaseContext, v string) sdkDep {
}
}
toModule := func(m string) sdkDep {
toModule := func(m, r string) sdkDep {
ret := sdkDep{
useModule: true,
module: m,
systemModules: m + "_system_modules",
useModule: true,
module: m,
systemModules: m + "_system_modules",
frameworkResModule: r,
}
if m == "core.current.stubs" {
ret.systemModules = "core-system-modules"
@@ -442,16 +445,17 @@ func decodeSdkDep(ctx android.BaseContext, v string) sdkDep {
switch v {
case "":
return sdkDep{
useDefaultLibs: true,
useDefaultLibs: true,
frameworkResModule: "framework-res",
}
case "current":
return toModule("android_stubs_current")
return toModule("android_stubs_current", "framework-res")
case "system_current":
return toModule("android_system_stubs_current")
return toModule("android_system_stubs_current", "framework-res")
case "test_current":
return toModule("android_test_stubs_current")
return toModule("android_test_stubs_current", "framework-res")
case "core_current":
return toModule("core.current.stubs")
return toModule("core.current.stubs", "")
default:
return toFile(v)
}
@@ -681,7 +685,10 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
tag := ctx.OtherModuleDependencyTag(module)
if to, ok := module.(*Library); ok {
checkLinkType(ctx, j, to, tag.(dependencyTag))
switch tag {
case bootClasspathTag, libTag, staticLibTag:
checkLinkType(ctx, j, to, tag.(dependencyTag))
}
}
switch dep := module.(type) {
case Dependency: