summaryrefslogtreecommitdiff
path: root/java/systemserver_classpath_fragment.go
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2021-09-26 03:52:19 +0000
committer Jiakai Zhang <jiakaiz@google.com> 2021-09-30 10:05:58 +0000
commitc9864278da15ccd4cfd164ab7408f20aa2811191 (patch)
treebe96ce329a364ce3563c52d8030bed1a5ced53c1 /java/systemserver_classpath_fragment.go
parent6a779a4b5026e4b693c0ca336eb09420c76262c8 (diff)
Add prebuilt_systemserverclasspath_fragment rule.
This is the prebuilt side of systemserverclasspath_fragment, currently for used for dexpreopting. The change to automactially generate prebuilt_systemserverclasspath_fragment rules will be in a separate CL. Bug: 194150908 Test: m nothing Change-Id: Ibf5322f80f78ac3ca037489f4a279456fe38a23f
Diffstat (limited to 'java/systemserver_classpath_fragment.go')
-rw-r--r--java/systemserver_classpath_fragment.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/java/systemserver_classpath_fragment.go b/java/systemserver_classpath_fragment.go
index de2a9787f..e2738d7fa 100644
--- a/java/systemserver_classpath_fragment.go
+++ b/java/systemserver_classpath_fragment.go
@@ -28,6 +28,7 @@ func init() {
func registerSystemserverClasspathBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("platform_systemserverclasspath", platformSystemServerClasspathFactory)
ctx.RegisterModuleType("systemserverclasspath_fragment", systemServerClasspathFactory)
+ ctx.RegisterModuleType("prebuilt_systemserverclasspath_fragment", prebuiltSystemServerClasspathModuleFactory)
}
type platformSystemServerClasspathModule struct {
@@ -144,8 +145,14 @@ func IsSystemServerClasspathFragmentContentDepTag(tag blueprint.DependencyTag) b
func (s *SystemServerClasspathModule) ComponentDepsMutator(ctx android.BottomUpMutatorContext) {
module := ctx.Module()
+ _, isSourceModule := module.(*SystemServerClasspathModule)
for _, name := range s.properties.Contents {
+ // A systemserverclasspath_fragment must depend only on other source modules, while the
+ // prebuilt_systemserverclasspath_fragment_fragment must only depend on other prebuilt modules.
+ if !isSourceModule {
+ name = android.PrebuiltNameFromSource(name)
+ }
ctx.AddDependency(module, systemServerClasspathFragmentContentDepTag, name)
}
}
@@ -155,3 +162,28 @@ func (s *SystemServerClasspathModule) IDEInfo(dpInfo *android.IdeInfo) {
dpInfo.Deps = append(dpInfo.Deps, s.properties.Contents...)
dpInfo.Paths = append(dpInfo.Paths, s.modulePaths...)
}
+
+// A prebuilt version of the systemserverclasspath_fragment module.
+type prebuiltSystemServerClasspathModule struct {
+ SystemServerClasspathModule
+ prebuilt android.Prebuilt
+}
+
+func (module *prebuiltSystemServerClasspathModule) Prebuilt() *android.Prebuilt {
+ return &module.prebuilt
+}
+
+func (module *prebuiltSystemServerClasspathModule) Name() string {
+ return module.prebuilt.Name(module.ModuleBase.Name())
+}
+
+func prebuiltSystemServerClasspathModuleFactory() android.Module {
+ m := &prebuiltSystemServerClasspathModule{}
+ m.AddProperties(&m.properties)
+ // This doesn't actually have any prebuilt files of its own so pass a placeholder for the srcs
+ // array.
+ android.InitPrebuiltModule(m, &[]string{"placeholder"})
+ android.InitApexModule(m)
+ android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon)
+ return m
+}