summaryrefslogtreecommitdiff
path: root/java/systemserver_classpath_fragment.go
diff options
context:
space:
mode:
authorsatayev <satayev@google.com>2021-05-17 21:13:44 +0100
committerPaul Duffin <paulduffin@google.com>2021-05-18 10:37:51 +0100
commit7b182e717779d6582ffd21277ee325690648229e (patch)
tree76d1af4cbd5b3ed40ba76b24a244f11ec1414e42 /java/systemserver_classpath_fragment.go
parent72ede0fac5df789b054302ed4d2b4989225fc1fe (diff)
Add "contents" property to systemserverclasspath_fragment.
Similar to bcp_fragment's contents, this property lists all java library contributions made by this fragment. Bug: 180105615 Test: m nothing Merged-In: Ifb1f54d5db290fffaa31933d15207014bb72d2fb Change-Id: Ifb1f54d5db290fffaa31933d15207014bb72d2fb (cherry picked from commit 9366a053da11ba44c9d70671dfac7c294c5427d0)
Diffstat (limited to 'java/systemserver_classpath_fragment.go')
-rw-r--r--java/systemserver_classpath_fragment.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/java/systemserver_classpath_fragment.go b/java/systemserver_classpath_fragment.go
index cc5ff96ca..4e65c056b 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() {
@@ -70,16 +71,30 @@ type systemServerClasspathModule struct {
android.ModuleBase
ClasspathFragmentBase
+
+ properties systemServerClasspathFragmentProperties
+}
+
+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.AddProperties(&m.properties)
initClasspathFragment(m, SYSTEMSERVERCLASSPATH)
android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon)
return m
}
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)))
}
@@ -87,3 +102,22 @@ func (s *systemServerClasspathModule) ClasspathFragmentToConfiguredJarList(ctx a
// 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)
+ }
+}