blob: a2e35d9b0742919d6995e5a7a4bfc5c63cdaa5ed [file] [log] [blame]
Inseob Kimc0907f12019-02-08 21:00:45 +09001// Copyright (C) 2019 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package sysprop
16
17import (
Inseob Kim42882742019-07-30 17:55:33 +090018 "fmt"
19 "io"
20 "path"
Inseob Kim628d7ef2020-03-21 03:38:32 +090021 "sync"
Colin Crossf8b860a2019-04-16 14:43:28 -070022
Inseob Kimc0907f12019-02-08 21:00:45 +090023 "github.com/google/blueprint"
24 "github.com/google/blueprint/proptools"
Inseob Kim42882742019-07-30 17:55:33 +090025
26 "android/soong/android"
27 "android/soong/cc"
28 "android/soong/java"
Inseob Kimc0907f12019-02-08 21:00:45 +090029)
30
31type dependencyTag struct {
32 blueprint.BaseDependencyTag
33 name string
34}
35
Inseob Kim988f53c2019-09-16 15:59:01 +090036type syspropGenProperties struct {
37 Srcs []string `android:"path"`
38 Scope string
Inseob Kimac1e9862019-12-09 18:15:47 +090039 Name *string
Inseob Kim988f53c2019-09-16 15:59:01 +090040}
41
42type syspropJavaGenRule struct {
43 android.ModuleBase
44
45 properties syspropGenProperties
46
47 genSrcjars android.Paths
48}
49
50var _ android.OutputFileProducer = (*syspropJavaGenRule)(nil)
51
52var (
53 syspropJava = pctx.AndroidStaticRule("syspropJava",
54 blueprint.RuleParams{
55 Command: `rm -rf $out.tmp && mkdir -p $out.tmp && ` +
56 `$syspropJavaCmd --scope $scope --java-output-dir $out.tmp $in && ` +
57 `$soongZipCmd -jar -o $out -C $out.tmp -D $out.tmp && rm -rf $out.tmp`,
58 CommandDeps: []string{
59 "$syspropJavaCmd",
60 "$soongZipCmd",
61 },
62 }, "scope")
63)
64
65func init() {
66 pctx.HostBinToolVariable("soongZipCmd", "soong_zip")
67 pctx.HostBinToolVariable("syspropJavaCmd", "sysprop_java")
68
69 android.PreArchMutators(func(ctx android.RegisterMutatorsContext) {
70 ctx.BottomUp("sysprop_deps", syspropDepsMutator).Parallel()
71 })
72}
73
74func (g *syspropJavaGenRule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
75 var checkApiFileTimeStamp android.WritablePath
76
77 ctx.VisitDirectDeps(func(dep android.Module) {
78 if m, ok := dep.(*syspropLibrary); ok {
79 checkApiFileTimeStamp = m.checkApiFileTimeStamp
80 }
81 })
82
83 for _, syspropFile := range android.PathsForModuleSrc(ctx, g.properties.Srcs) {
84 srcJarFile := android.GenPathWithExt(ctx, "sysprop", syspropFile, "srcjar")
85
86 ctx.Build(pctx, android.BuildParams{
87 Rule: syspropJava,
88 Description: "sysprop_java " + syspropFile.Rel(),
89 Output: srcJarFile,
90 Input: syspropFile,
91 Implicit: checkApiFileTimeStamp,
92 Args: map[string]string{
93 "scope": g.properties.Scope,
94 },
95 })
96
97 g.genSrcjars = append(g.genSrcjars, srcJarFile)
98 }
99}
100
101func (g *syspropJavaGenRule) OutputFiles(tag string) (android.Paths, error) {
102 switch tag {
103 case "":
104 return g.genSrcjars, nil
105 default:
106 return nil, fmt.Errorf("unsupported module reference tag %q", tag)
107 }
108}
109
110func syspropJavaGenFactory() android.Module {
111 g := &syspropJavaGenRule{}
112 g.AddProperties(&g.properties)
113 android.InitAndroidModule(g)
114 return g
115}
116
Inseob Kimc0907f12019-02-08 21:00:45 +0900117type syspropLibrary struct {
Inseob Kim42882742019-07-30 17:55:33 +0900118 android.ModuleBase
Paul Duffin7b3de8f2020-03-30 18:00:25 +0100119 android.ApexModuleBase
Inseob Kimc0907f12019-02-08 21:00:45 +0900120
Inseob Kim42882742019-07-30 17:55:33 +0900121 properties syspropLibraryProperties
122
123 checkApiFileTimeStamp android.WritablePath
124 latestApiFile android.Path
125 currentApiFile android.Path
126 dumpedApiFile android.WritablePath
Inseob Kimc0907f12019-02-08 21:00:45 +0900127}
128
129type syspropLibraryProperties struct {
130 // Determine who owns this sysprop library. Possible values are
131 // "Platform", "Vendor", or "Odm"
132 Property_owner string
Inseob Kimf63c2fb2019-03-05 14:22:30 +0900133
134 // list of package names that will be documented and publicized as API
135 Api_packages []string
Inseob Kimc0907f12019-02-08 21:00:45 +0900136
Inseob Kim42882742019-07-30 17:55:33 +0900137 // If set to true, allow this module to be dexed and installed on devices.
138 Installable *bool
139
140 // Make this module available when building for recovery
Jiyong Park854a9442019-02-26 10:27:13 +0900141 Recovery_available *bool
Inseob Kim42882742019-07-30 17:55:33 +0900142
143 // Make this module available when building for vendor
144 Vendor_available *bool
145
146 // list of .sysprop files which defines the properties.
147 Srcs []string `android:"path"`
Inseob Kimac1e9862019-12-09 18:15:47 +0900148
Inseob Kim89db15d2020-02-03 18:06:46 +0900149 // If set to true, build a variant of the module for the host. Defaults to false.
150 Host_supported *bool
151
Inseob Kimac1e9862019-12-09 18:15:47 +0900152 // Whether public stub exists or not.
153 Public_stub *bool `blueprint:"mutated"`
Inseob Kimc0907f12019-02-08 21:00:45 +0900154}
155
156var (
Inseob Kim42882742019-07-30 17:55:33 +0900157 pctx = android.NewPackageContext("android/soong/sysprop")
Inseob Kimc0907f12019-02-08 21:00:45 +0900158 syspropCcTag = dependencyTag{name: "syspropCc"}
Inseob Kim628d7ef2020-03-21 03:38:32 +0900159
160 syspropLibrariesKey = android.NewOnceKey("syspropLibraries")
161 syspropLibrariesLock sync.Mutex
Inseob Kimc0907f12019-02-08 21:00:45 +0900162)
163
Inseob Kim628d7ef2020-03-21 03:38:32 +0900164func syspropLibraries(config android.Config) *[]string {
165 return config.Once(syspropLibrariesKey, func() interface{} {
166 return &[]string{}
167 }).(*[]string)
168}
169
170func SyspropLibraries(config android.Config) []string {
171 return append([]string{}, *syspropLibraries(config)...)
172}
173
Inseob Kimc0907f12019-02-08 21:00:45 +0900174func init() {
175 android.RegisterModuleType("sysprop_library", syspropLibraryFactory)
176}
177
Inseob Kim42882742019-07-30 17:55:33 +0900178func (m *syspropLibrary) Name() string {
179 return m.BaseModuleName() + "_sysprop_library"
Inseob Kimc0907f12019-02-08 21:00:45 +0900180}
181
Inseob Kimac1e9862019-12-09 18:15:47 +0900182func (m *syspropLibrary) Owner() string {
183 return m.properties.Property_owner
184}
185
Inseob Kim42882742019-07-30 17:55:33 +0900186func (m *syspropLibrary) CcModuleName() string {
187 return "lib" + m.BaseModuleName()
188}
189
Inseob Kimac1e9862019-12-09 18:15:47 +0900190func (m *syspropLibrary) JavaPublicStubName() string {
191 if proptools.Bool(m.properties.Public_stub) {
192 return m.BaseModuleName() + "_public"
193 }
194 return ""
195}
196
Inseob Kim988f53c2019-09-16 15:59:01 +0900197func (m *syspropLibrary) javaGenModuleName() string {
198 return m.BaseModuleName() + "_java_gen"
199}
200
Inseob Kimac1e9862019-12-09 18:15:47 +0900201func (m *syspropLibrary) javaGenPublicStubName() string {
202 return m.BaseModuleName() + "_java_gen_public"
203}
204
Inseob Kim42882742019-07-30 17:55:33 +0900205func (m *syspropLibrary) BaseModuleName() string {
206 return m.ModuleBase.Name()
207}
208
Inseob Kimac1e9862019-12-09 18:15:47 +0900209func (m *syspropLibrary) HasPublicStub() bool {
210 return proptools.Bool(m.properties.Public_stub)
211}
212
Inseob Kim628d7ef2020-03-21 03:38:32 +0900213func (m *syspropLibrary) CurrentSyspropApiFile() android.Path {
214 return m.currentApiFile
215}
216
Inseob Kim42882742019-07-30 17:55:33 +0900217func (m *syspropLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
Inseob Kim988f53c2019-09-16 15:59:01 +0900218 baseModuleName := m.BaseModuleName()
219
220 for _, syspropFile := range android.PathsForModuleSrc(ctx, m.properties.Srcs) {
221 if syspropFile.Ext() != ".sysprop" {
222 ctx.PropertyErrorf("srcs", "srcs contains non-sysprop file %q", syspropFile.String())
223 }
224 }
225
226 if ctx.Failed() {
227 return
228 }
229
230 m.currentApiFile = android.PathForSource(ctx, ctx.ModuleDir(), "api", baseModuleName+"-current.txt")
231 m.latestApiFile = android.PathForSource(ctx, ctx.ModuleDir(), "api", baseModuleName+"-latest.txt")
Inseob Kim42882742019-07-30 17:55:33 +0900232
233 // dump API rule
234 rule := android.NewRuleBuilder()
235 m.dumpedApiFile = android.PathForModuleOut(ctx, "api-dump.txt")
236 rule.Command().
237 BuiltTool(ctx, "sysprop_api_dump").
238 Output(m.dumpedApiFile).
239 Inputs(android.PathsForModuleSrc(ctx, m.properties.Srcs))
Inseob Kim988f53c2019-09-16 15:59:01 +0900240 rule.Build(pctx, ctx, baseModuleName+"_api_dump", baseModuleName+" api dump")
Inseob Kim42882742019-07-30 17:55:33 +0900241
242 // check API rule
243 rule = android.NewRuleBuilder()
244
245 // 1. current.txt <-> api_dump.txt
246 msg := fmt.Sprintf(`\n******************************\n`+
247 `API of sysprop_library %s doesn't match with current.txt\n`+
248 `Please update current.txt by:\n`+
Inseob Kim988f53c2019-09-16 15:59:01 +0900249 `m %s-dump-api && rm -rf %q && cp -f %q %q\n`+
250 `******************************\n`, baseModuleName, baseModuleName,
Inseob Kim42882742019-07-30 17:55:33 +0900251 m.currentApiFile.String(), m.dumpedApiFile.String(), m.currentApiFile.String())
252
253 rule.Command().
254 Text("( cmp").Flag("-s").
255 Input(m.dumpedApiFile).
256 Input(m.currentApiFile).
257 Text("|| ( echo").Flag("-e").
258 Flag(`"` + msg + `"`).
259 Text("; exit 38) )")
260
261 // 2. current.txt <-> latest.txt
262 msg = fmt.Sprintf(`\n******************************\n`+
263 `API of sysprop_library %s doesn't match with latest version\n`+
264 `Please fix the breakage and rebuild.\n`+
Inseob Kim988f53c2019-09-16 15:59:01 +0900265 `******************************\n`, baseModuleName)
Inseob Kim42882742019-07-30 17:55:33 +0900266
267 rule.Command().
268 Text("( ").
269 BuiltTool(ctx, "sysprop_api_checker").
270 Input(m.latestApiFile).
271 Input(m.currentApiFile).
272 Text(" || ( echo").Flag("-e").
273 Flag(`"` + msg + `"`).
274 Text("; exit 38) )")
275
276 m.checkApiFileTimeStamp = android.PathForModuleOut(ctx, "check_api.timestamp")
277
278 rule.Command().
279 Text("touch").
280 Output(m.checkApiFileTimeStamp)
281
Inseob Kim988f53c2019-09-16 15:59:01 +0900282 rule.Build(pctx, ctx, baseModuleName+"_check_api", baseModuleName+" check api")
Inseob Kim42882742019-07-30 17:55:33 +0900283}
284
285func (m *syspropLibrary) AndroidMk() android.AndroidMkData {
286 return android.AndroidMkData{
287 Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
288 // sysprop_library module itself is defined as a FAKE module to perform API check.
289 // Actual implementation libraries are created on LoadHookMutator
290 fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)")
291 fmt.Fprintf(w, "LOCAL_MODULE := %s\n", m.Name())
292 fmt.Fprintf(w, "LOCAL_MODULE_CLASS := FAKE\n")
293 fmt.Fprintf(w, "LOCAL_MODULE_TAGS := optional\n")
294 fmt.Fprintf(w, "include $(BUILD_SYSTEM)/base_rules.mk\n\n")
295 fmt.Fprintf(w, "$(LOCAL_BUILT_MODULE): %s\n", m.checkApiFileTimeStamp.String())
296 fmt.Fprintf(w, "\ttouch $@\n\n")
Inseob Kim988f53c2019-09-16 15:59:01 +0900297 fmt.Fprintf(w, ".PHONY: %s-check-api %s-dump-api\n\n", name, name)
298
299 // dump API rule
300 fmt.Fprintf(w, "%s-dump-api: %s\n\n", name, m.dumpedApiFile.String())
Inseob Kim42882742019-07-30 17:55:33 +0900301
302 // check API rule
303 fmt.Fprintf(w, "%s-check-api: %s\n\n", name, m.checkApiFileTimeStamp.String())
Inseob Kim42882742019-07-30 17:55:33 +0900304 }}
305}
306
307// sysprop_library creates schematized APIs from sysprop description files (.sysprop).
308// Both Java and C++ modules can link against sysprop_library, and API stability check
309// against latest APIs (see build/soong/scripts/freeze-sysprop-api-files.sh)
310// is performed.
Inseob Kimc0907f12019-02-08 21:00:45 +0900311func syspropLibraryFactory() android.Module {
312 m := &syspropLibrary{}
313
314 m.AddProperties(
Inseob Kim42882742019-07-30 17:55:33 +0900315 &m.properties,
Inseob Kimc0907f12019-02-08 21:00:45 +0900316 )
Inseob Kim42882742019-07-30 17:55:33 +0900317 android.InitAndroidModule(m)
Paul Duffin7b3de8f2020-03-30 18:00:25 +0100318 android.InitApexModule(m)
Inseob Kimc0907f12019-02-08 21:00:45 +0900319 android.AddLoadHook(m, func(ctx android.LoadHookContext) { syspropLibraryHook(ctx, m) })
Inseob Kimc0907f12019-02-08 21:00:45 +0900320 return m
321}
322
Inseob Kimac1e9862019-12-09 18:15:47 +0900323type ccLibraryProperties struct {
324 Name *string
325 Srcs []string
326 Soc_specific *bool
327 Device_specific *bool
328 Product_specific *bool
329 Sysprop struct {
330 Platform *bool
331 }
Inseob Kim89db15d2020-02-03 18:06:46 +0900332 Target struct {
333 Android struct {
334 Header_libs []string
335 Shared_libs []string
336 }
337 Host struct {
338 Static_libs []string
339 }
340 }
Inseob Kimac1e9862019-12-09 18:15:47 +0900341 Required []string
342 Recovery *bool
343 Recovery_available *bool
344 Vendor_available *bool
Inseob Kim89db15d2020-02-03 18:06:46 +0900345 Host_supported *bool
Paul Duffin7b3de8f2020-03-30 18:00:25 +0100346 Apex_available []string
Inseob Kimac1e9862019-12-09 18:15:47 +0900347}
348
349type javaLibraryProperties struct {
350 Name *string
351 Srcs []string
352 Soc_specific *bool
353 Device_specific *bool
354 Product_specific *bool
355 Required []string
356 Sdk_version *string
357 Installable *bool
358 Libs []string
359 Stem *string
360}
361
Inseob Kimc0907f12019-02-08 21:00:45 +0900362func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
Inseob Kim42882742019-07-30 17:55:33 +0900363 if len(m.properties.Srcs) == 0 {
Inseob Kim6e93ac92019-03-21 17:43:49 +0900364 ctx.PropertyErrorf("srcs", "sysprop_library must specify srcs")
365 }
366
Inseob Kim42882742019-07-30 17:55:33 +0900367 missing_api := false
368
369 for _, txt := range []string{"-current.txt", "-latest.txt"} {
370 path := path.Join(ctx.ModuleDir(), "api", m.BaseModuleName()+txt)
371 file := android.ExistentPathForSource(ctx, path)
372 if !file.Valid() {
373 ctx.ModuleErrorf("API file %#v doesn't exist", path)
374 missing_api = true
375 }
376 }
377
378 if missing_api {
379 script := "build/soong/scripts/gen-sysprop-api-files.sh"
380 p := android.ExistentPathForSource(ctx, script)
381
382 if !p.Valid() {
383 panic(fmt.Sprintf("script file %s doesn't exist", script))
384 }
385
386 ctx.ModuleErrorf("One or more api files are missing. "+
387 "You can create them by:\n"+
388 "%s %q %q", script, ctx.ModuleDir(), m.BaseModuleName())
389 return
Inseob Kimc0907f12019-02-08 21:00:45 +0900390 }
391
Inseob Kimac1e9862019-12-09 18:15:47 +0900392 // ctx's Platform or Specific functions represent where this sysprop_library installed.
393 installedInSystem := ctx.Platform() || ctx.SystemExtSpecific()
394 installedInVendorOrOdm := ctx.SocSpecific() || ctx.DeviceSpecific()
395 isOwnerPlatform := false
Inseob Kim42882742019-07-30 17:55:33 +0900396 stub := "sysprop-library-stub-"
Inseob Kimc0907f12019-02-08 21:00:45 +0900397
Inseob Kimac1e9862019-12-09 18:15:47 +0900398 switch m.Owner() {
Inseob Kimc0907f12019-02-08 21:00:45 +0900399 case "Platform":
400 // Every partition can access platform-defined properties
Inseob Kim42882742019-07-30 17:55:33 +0900401 stub += "platform"
Inseob Kimac1e9862019-12-09 18:15:47 +0900402 isOwnerPlatform = true
Inseob Kimc0907f12019-02-08 21:00:45 +0900403 case "Vendor":
404 // System can't access vendor's properties
Inseob Kimac1e9862019-12-09 18:15:47 +0900405 if installedInSystem {
Inseob Kimc0907f12019-02-08 21:00:45 +0900406 ctx.ModuleErrorf("None of soc_specific, device_specific, product_specific is true. " +
407 "System can't access sysprop_library owned by Vendor")
408 }
Inseob Kim42882742019-07-30 17:55:33 +0900409 stub += "vendor"
Inseob Kimc0907f12019-02-08 21:00:45 +0900410 case "Odm":
411 // Only vendor can access Odm-defined properties
Inseob Kimac1e9862019-12-09 18:15:47 +0900412 if !installedInVendorOrOdm {
Inseob Kimc0907f12019-02-08 21:00:45 +0900413 ctx.ModuleErrorf("Neither soc_speicifc nor device_specific is true. " +
414 "Odm-defined properties should be accessed only in Vendor or Odm")
415 }
Inseob Kim42882742019-07-30 17:55:33 +0900416 stub += "vendor"
Inseob Kimc0907f12019-02-08 21:00:45 +0900417 default:
418 ctx.PropertyErrorf("property_owner",
Inseob Kimac1e9862019-12-09 18:15:47 +0900419 "Unknown value %s: must be one of Platform, Vendor or Odm", m.Owner())
Inseob Kimc0907f12019-02-08 21:00:45 +0900420 }
421
Inseob Kimac1e9862019-12-09 18:15:47 +0900422 ccProps := ccLibraryProperties{}
Inseob Kimc0907f12019-02-08 21:00:45 +0900423 ccProps.Name = proptools.StringPtr(m.CcModuleName())
Inseob Kim42882742019-07-30 17:55:33 +0900424 ccProps.Srcs = m.properties.Srcs
Inseob Kimac1e9862019-12-09 18:15:47 +0900425 ccProps.Soc_specific = proptools.BoolPtr(ctx.SocSpecific())
426 ccProps.Device_specific = proptools.BoolPtr(ctx.DeviceSpecific())
427 ccProps.Product_specific = proptools.BoolPtr(ctx.ProductSpecific())
428 ccProps.Sysprop.Platform = proptools.BoolPtr(isOwnerPlatform)
Inseob Kim89db15d2020-02-03 18:06:46 +0900429 ccProps.Target.Android.Header_libs = []string{"libbase_headers"}
430 ccProps.Target.Android.Shared_libs = []string{"liblog"}
431 ccProps.Target.Host.Static_libs = []string{"libbase", "liblog"}
Inseob Kim42882742019-07-30 17:55:33 +0900432 ccProps.Recovery_available = m.properties.Recovery_available
433 ccProps.Vendor_available = m.properties.Vendor_available
Inseob Kim89db15d2020-02-03 18:06:46 +0900434 ccProps.Host_supported = m.properties.Host_supported
Paul Duffin7b3de8f2020-03-30 18:00:25 +0100435 ccProps.Apex_available = m.ApexProperties.Apex_available
Colin Cross84dfc3d2019-09-25 11:33:01 -0700436 ctx.CreateModule(cc.LibraryFactory, &ccProps)
Inseob Kim42882742019-07-30 17:55:33 +0900437
Inseob Kim988f53c2019-09-16 15:59:01 +0900438 scope := "internal"
Inseob Kim988f53c2019-09-16 15:59:01 +0900439
Inseob Kimac1e9862019-12-09 18:15:47 +0900440 // We need to only use public version, if the partition where sysprop_library will be installed
441 // is different from owner.
442
443 if ctx.ProductSpecific() {
444 // Currently product partition can't own any sysprop_library.
Inseob Kim988f53c2019-09-16 15:59:01 +0900445 scope = "public"
Inseob Kimac1e9862019-12-09 18:15:47 +0900446 } else if isOwnerPlatform && installedInVendorOrOdm {
447 // Vendor or Odm should use public version of Platform's sysprop_library.
Inseob Kim988f53c2019-09-16 15:59:01 +0900448 scope = "public"
449 }
450
Inseob Kimac1e9862019-12-09 18:15:47 +0900451 ctx.CreateModule(syspropJavaGenFactory, &syspropGenProperties{
Inseob Kim988f53c2019-09-16 15:59:01 +0900452 Srcs: m.properties.Srcs,
453 Scope: scope,
454 Name: proptools.StringPtr(m.javaGenModuleName()),
Inseob Kimac1e9862019-12-09 18:15:47 +0900455 })
456
457 ctx.CreateModule(java.LibraryFactory, &javaLibraryProperties{
458 Name: proptools.StringPtr(m.BaseModuleName()),
459 Srcs: []string{":" + m.javaGenModuleName()},
460 Soc_specific: proptools.BoolPtr(ctx.SocSpecific()),
461 Device_specific: proptools.BoolPtr(ctx.DeviceSpecific()),
462 Product_specific: proptools.BoolPtr(ctx.ProductSpecific()),
463 Installable: m.properties.Installable,
464 Sdk_version: proptools.StringPtr("core_current"),
465 Libs: []string{stub},
466 })
467
468 // if platform sysprop_library is installed in /system or /system-ext, we regard it as an API
469 // and allow any modules (even from different partition) to link against the sysprop_library.
470 // To do that, we create a public stub and expose it to modules with sdk_version: system_*.
471 if isOwnerPlatform && installedInSystem {
472 m.properties.Public_stub = proptools.BoolPtr(true)
473 ctx.CreateModule(syspropJavaGenFactory, &syspropGenProperties{
474 Srcs: m.properties.Srcs,
475 Scope: "public",
476 Name: proptools.StringPtr(m.javaGenPublicStubName()),
477 })
478
479 ctx.CreateModule(java.LibraryFactory, &javaLibraryProperties{
480 Name: proptools.StringPtr(m.JavaPublicStubName()),
481 Srcs: []string{":" + m.javaGenPublicStubName()},
482 Installable: proptools.BoolPtr(false),
483 Sdk_version: proptools.StringPtr("core_current"),
484 Libs: []string{stub},
485 Stem: proptools.StringPtr(m.BaseModuleName()),
486 })
Inseob Kim988f53c2019-09-16 15:59:01 +0900487 }
Inseob Kim628d7ef2020-03-21 03:38:32 +0900488
489 syspropLibrariesLock.Lock()
490 defer syspropLibrariesLock.Unlock()
491
492 libraries := syspropLibraries(ctx.Config())
493 *libraries = append(*libraries, ctx.ModuleName())
Inseob Kimc0907f12019-02-08 21:00:45 +0900494}
Inseob Kim988f53c2019-09-16 15:59:01 +0900495
496func syspropDepsMutator(ctx android.BottomUpMutatorContext) {
497 if m, ok := ctx.Module().(*syspropLibrary); ok {
498 ctx.AddReverseDependency(m, nil, m.javaGenModuleName())
Inseob Kimac1e9862019-12-09 18:15:47 +0900499
500 if proptools.Bool(m.properties.Public_stub) {
501 ctx.AddReverseDependency(m, nil, m.javaGenPublicStubName())
502 }
Inseob Kim988f53c2019-09-16 15:59:01 +0900503 }
504}