summaryrefslogtreecommitdiff
path: root/java/system_modules.go
diff options
context:
space:
mode:
Diffstat (limited to 'java/system_modules.go')
-rw-r--r--java/system_modules.go33
1 files changed, 25 insertions, 8 deletions
diff --git a/java/system_modules.go b/java/system_modules.go
index 7394fd547..d0dc74adc 100644
--- a/java/system_modules.go
+++ b/java/system_modules.go
@@ -35,9 +35,8 @@ func init() {
// Register sdk member types.
android.RegisterSdkMemberType(&systemModulesSdkMemberType{
android.SdkMemberTypeBase{
- PropertyName: "java_system_modules",
- SupportsSdk: true,
- TransitiveSdkMembers: true,
+ PropertyName: "java_system_modules",
+ SupportsSdk: true,
},
})
}
@@ -77,8 +76,9 @@ var (
"classpath", "outDir", "workDir")
// Dependency tag that causes the added dependencies to be added as java_header_libs
- // to the sdk/module_exports/snapshot.
- systemModulesLibsTag = android.DependencyTagForSdkMemberType(javaHeaderLibsSdkMemberType)
+ // to the sdk/module_exports/snapshot. Dependencies that are added automatically via this tag are
+ // not automatically exported.
+ systemModulesLibsTag = android.DependencyTagForSdkMemberType(javaHeaderLibsSdkMemberType, false)
)
func TransformJarsToSystemModules(ctx android.ModuleContext, jars android.Paths) (android.Path, android.Paths) {
@@ -114,6 +114,7 @@ func SystemModulesFactory() android.Module {
module.AddProperties(&module.properties)
android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon)
android.InitDefaultableModule(module)
+ android.InitSdkAwareModule(module)
return module
}
@@ -160,8 +161,8 @@ func (system *SystemModules) GenerateAndroidBuildActions(ctx android.ModuleConte
var jars android.Paths
ctx.VisitDirectDepsWithTag(systemModulesLibsTag, func(module android.Module) {
- dep, _ := module.(Dependency)
- jars = append(jars, dep.HeaderJars()...)
+ dep, _ := ctx.OtherModuleProvider(module, JavaInfoProvider).(JavaInfo)
+ jars = append(jars, dep.HeaderJars...)
})
system.headerJars = jars
@@ -169,7 +170,13 @@ func (system *SystemModules) GenerateAndroidBuildActions(ctx android.ModuleConte
system.outputDir, system.outputDeps = TransformJarsToSystemModules(ctx, jars)
}
-func (system *SystemModules) DepsMutator(ctx android.BottomUpMutatorContext) {
+// ComponentDepsMutator is called before prebuilt modules without a corresponding source module are
+// renamed so unless the supplied libs specifically includes the prebuilt_ prefix this is guaranteed
+// to only add dependencies on source modules.
+//
+// The systemModuleLibsTag will prevent the prebuilt mutators from replacing this dependency so it
+// will never be changed to depend on a prebuilt either.
+func (system *SystemModules) ComponentDepsMutator(ctx android.BottomUpMutatorContext) {
ctx.AddVariationDependencies(nil, systemModulesLibsTag, system.properties.Libs...)
}
@@ -192,6 +199,7 @@ func (system *SystemModules) AndroidMk() android.AndroidMkData {
fmt.Fprintln(w, name+":", "$("+makevar+")")
fmt.Fprintln(w, ".PHONY:", name)
+ // TODO(b/151177513): Licenses: Doesn't go through base_rules. May have to generate meta_lic and meta_module here.
},
}
}
@@ -224,6 +232,15 @@ func (system *systemModulesImport) Prebuilt() *android.Prebuilt {
return &system.prebuilt
}
+// ComponentDepsMutator is called before prebuilt modules without a corresponding source module are
+// renamed so as this adds a prebuilt_ prefix this is guaranteed to only add dependencies on source
+// modules.
+func (system *systemModulesImport) ComponentDepsMutator(ctx android.BottomUpMutatorContext) {
+ for _, lib := range system.properties.Libs {
+ ctx.AddVariationDependencies(nil, systemModulesLibsTag, android.PrebuiltNameFromSource(lib))
+ }
+}
+
type systemModulesSdkMemberType struct {
android.SdkMemberTypeBase
}