summaryrefslogtreecommitdiff
path: root/java/systemserver_classpath_fragment.go
diff options
context:
space:
mode:
author satayev <satayev@google.com> 2021-05-17 22:40:08 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2021-05-17 22:40:08 +0000
commitf1d8819d7df17ab5d168f7d9d638c98b32da5765 (patch)
tree220cc651ec9ebed5ffe9d6dd2bbfcb9c65c31019 /java/systemserver_classpath_fragment.go
parent3d3a2218a61ddd5078cbab9a3138a0cb20e131fa (diff)
parent333a1732b17887260f2290ffacffffeff760eee5 (diff)
Merge changes I8e8e8b01,Ifb1f54d5,I9986e64f
* changes: Add systemserverclasspath_fragments property to apex. Add "contents" property to systemserverclasspath_fragment. Move classpaths.proto related info into a separate provider.
Diffstat (limited to 'java/systemserver_classpath_fragment.go')
-rw-r--r--java/systemserver_classpath_fragment.go48
1 files changed, 44 insertions, 4 deletions
diff --git a/java/systemserver_classpath_fragment.go b/java/systemserver_classpath_fragment.go
index cc5ff96ca..a505c6d01 100644
--- a/java/systemserver_classpath_fragment.go
+++ b/java/systemserver_classpath_fragment.go
@@ -17,6 +17,7 @@ package java
import (
"android/soong/android"
"android/soong/dexpreopt"
+ "github.com/google/blueprint"
)
func init() {
@@ -66,24 +67,63 @@ func (p *platformSystemServerClasspathModule) ClasspathFragmentToConfiguredJarLi
}).(android.ConfiguredJarList)
}
-type systemServerClasspathModule struct {
+type SystemServerClasspathModule struct {
android.ModuleBase
+ android.ApexModuleBase
ClasspathFragmentBase
+
+ properties systemServerClasspathFragmentProperties
+}
+
+func (s *SystemServerClasspathModule) ShouldSupportSdkVersion(ctx android.BaseModuleContext, sdkVersion android.ApiLevel) error {
+ return nil
+}
+
+type systemServerClasspathFragmentProperties struct {
+ // The contents of this systemserverclasspath_fragment, could be either java_library, or java_sdk_library.
+ //
+ // The order of this list matters as it is the order that is used in the SYSTEMSERVERCLASSPATH.
+ Contents []string
}
func systemServerClasspathFactory() android.Module {
- m := &systemServerClasspathModule{}
+ m := &SystemServerClasspathModule{}
+ m.AddProperties(&m.properties)
+ android.InitApexModule(m)
initClasspathFragment(m, SYSTEMSERVERCLASSPATH)
android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon)
return m
}
-func (s *systemServerClasspathModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+func (s *SystemServerClasspathModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ if len(s.properties.Contents) == 0 {
+ ctx.PropertyErrorf("contents", "empty contents are not allowed")
+ }
+
s.classpathFragmentBase().generateClasspathProtoBuildActions(ctx, configuredJarListToClasspathJars(ctx, s.ClasspathFragmentToConfiguredJarList(ctx)))
}
-func (s *systemServerClasspathModule) ClasspathFragmentToConfiguredJarList(ctx android.ModuleContext) android.ConfiguredJarList {
+func (s *SystemServerClasspathModule) ClasspathFragmentToConfiguredJarList(ctx android.ModuleContext) android.ConfiguredJarList {
// TODO(satayev): populate with actual content
return android.EmptyConfiguredJarList()
}
+
+type systemServerClasspathFragmentContentDependencyTag struct {
+ blueprint.BaseDependencyTag
+}
+
+// The tag used for the dependency between the systemserverclasspath_fragment module and its contents.
+var systemServerClasspathFragmentContentDepTag = systemServerClasspathFragmentContentDependencyTag{}
+
+func IsSystemServerClasspathFragmentContentDepTag(tag blueprint.DependencyTag) bool {
+ return tag == systemServerClasspathFragmentContentDepTag
+}
+
+func (s *SystemServerClasspathModule) ComponentDepsMutator(ctx android.BottomUpMutatorContext) {
+ module := ctx.Module()
+
+ for _, name := range s.properties.Contents {
+ ctx.AddDependency(module, systemServerClasspathFragmentContentDepTag, name)
+ }
+}