blob: 30cbd6b470db898d0fc2885b5935182498b883d0 [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
Inseob Kimc0907f12019-02-08 21:00:45 +0900119
Inseob Kim42882742019-07-30 17:55:33 +0900120 properties syspropLibraryProperties
121
122 checkApiFileTimeStamp android.WritablePath
123 latestApiFile android.Path
124 currentApiFile android.Path
125 dumpedApiFile android.WritablePath
Inseob Kimc0907f12019-02-08 21:00:45 +0900126}
127
128type syspropLibraryProperties struct {
129 // Determine who owns this sysprop library. Possible values are
130 // "Platform", "Vendor", or "Odm"
131 Property_owner string
Inseob Kimf63c2fb2019-03-05 14:22:30 +0900132
133 // list of package names that will be documented and publicized as API
134 Api_packages []string
Inseob Kimc0907f12019-02-08 21:00:45 +0900135
Inseob Kim42882742019-07-30 17:55:33 +0900136 // If set to true, allow this module to be dexed and installed on devices.
137 Installable *bool
138
139 // Make this module available when building for recovery
Jiyong Park854a9442019-02-26 10:27:13 +0900140 Recovery_available *bool
Inseob Kim42882742019-07-30 17:55:33 +0900141
142 // Make this module available when building for vendor
143 Vendor_available *bool
144
145 // list of .sysprop files which defines the properties.
146 Srcs []string `android:"path"`
Inseob Kimac1e9862019-12-09 18:15:47 +0900147
Inseob Kim89db15d2020-02-03 18:06:46 +0900148 // If set to true, build a variant of the module for the host. Defaults to false.
149 Host_supported *bool
150
Inseob Kimac1e9862019-12-09 18:15:47 +0900151 // Whether public stub exists or not.
152 Public_stub *bool `blueprint:"mutated"`
Inseob Kimc0907f12019-02-08 21:00:45 +0900153}
154
155var (
Inseob Kim42882742019-07-30 17:55:33 +0900156 pctx = android.NewPackageContext("android/soong/sysprop")
Inseob Kimc0907f12019-02-08 21:00:45 +0900157 syspropCcTag = dependencyTag{name: "syspropCc"}
Inseob Kim628d7ef2020-03-21 03:38:32 +0900158
159 syspropLibrariesKey = android.NewOnceKey("syspropLibraries")
160 syspropLibrariesLock sync.Mutex
Inseob Kimc0907f12019-02-08 21:00:45 +0900161)
162
Inseob Kim628d7ef2020-03-21 03:38:32 +0900163func syspropLibraries(config android.Config) *[]string {
164 return config.Once(syspropLibrariesKey, func() interface{} {
165 return &[]string{}
166 }).(*[]string)
167}
168
169func SyspropLibraries(config android.Config) []string {
170 return append([]string{}, *syspropLibraries(config)...)
171}
172
Inseob Kimc0907f12019-02-08 21:00:45 +0900173func init() {
174 android.RegisterModuleType("sysprop_library", syspropLibraryFactory)
175}
176
Inseob Kim42882742019-07-30 17:55:33 +0900177func (m *syspropLibrary) Name() string {
178 return m.BaseModuleName() + "_sysprop_library"
Inseob Kimc0907f12019-02-08 21:00:45 +0900179}
180
Inseob Kimac1e9862019-12-09 18:15:47 +0900181func (m *syspropLibrary) Owner() string {
182 return m.properties.Property_owner
183}
184
Inseob Kim42882742019-07-30 17:55:33 +0900185func (m *syspropLibrary) CcModuleName() string {
186 return "lib" + m.BaseModuleName()
187}
188
Inseob Kimac1e9862019-12-09 18:15:47 +0900189func (m *syspropLibrary) JavaPublicStubName() string {
190 if proptools.Bool(m.properties.Public_stub) {
191 return m.BaseModuleName() + "_public"
192 }
193 return ""
194}
195
Inseob Kim988f53c2019-09-16 15:59:01 +0900196func (m *syspropLibrary) javaGenModuleName() string {
197 return m.BaseModuleName() + "_java_gen"
198}
199
Inseob Kimac1e9862019-12-09 18:15:47 +0900200func (m *syspropLibrary) javaGenPublicStubName() string {
201 return m.BaseModuleName() + "_java_gen_public"
202}
203
Inseob Kim42882742019-07-30 17:55:33 +0900204func (m *syspropLibrary) BaseModuleName() string {
205 return m.ModuleBase.Name()
206}
207
Inseob Kimac1e9862019-12-09 18:15:47 +0900208func (m *syspropLibrary) HasPublicStub() bool {
209 return proptools.Bool(m.properties.Public_stub)
210}
211
Inseob Kim628d7ef2020-03-21 03:38:32 +0900212func (m *syspropLibrary) CurrentSyspropApiFile() android.Path {
213 return m.currentApiFile
214}
215
Inseob Kim42882742019-07-30 17:55:33 +0900216func (m *syspropLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
Inseob Kim988f53c2019-09-16 15:59:01 +0900217 baseModuleName := m.BaseModuleName()
218
219 for _, syspropFile := range android.PathsForModuleSrc(ctx, m.properties.Srcs) {
220 if syspropFile.Ext() != ".sysprop" {
221 ctx.PropertyErrorf("srcs", "srcs contains non-sysprop file %q", syspropFile.String())
222 }
223 }
224
225 if ctx.Failed() {
226 return
227 }
228
229 m.currentApiFile = android.PathForSource(ctx, ctx.ModuleDir(), "api", baseModuleName+"-current.txt")
230 m.latestApiFile = android.PathForSource(ctx, ctx.ModuleDir(), "api", baseModuleName+"-latest.txt")
Inseob Kim42882742019-07-30 17:55:33 +0900231
232 // dump API rule
233 rule := android.NewRuleBuilder()
234 m.dumpedApiFile = android.PathForModuleOut(ctx, "api-dump.txt")
235 rule.Command().
236 BuiltTool(ctx, "sysprop_api_dump").
237 Output(m.dumpedApiFile).
238 Inputs(android.PathsForModuleSrc(ctx, m.properties.Srcs))
Inseob Kim988f53c2019-09-16 15:59:01 +0900239 rule.Build(pctx, ctx, baseModuleName+"_api_dump", baseModuleName+" api dump")
Inseob Kim42882742019-07-30 17:55:33 +0900240
241 // check API rule
242 rule = android.NewRuleBuilder()
243
244 // 1. current.txt <-> api_dump.txt
245 msg := fmt.Sprintf(`\n******************************\n`+
246 `API of sysprop_library %s doesn't match with current.txt\n`+
247 `Please update current.txt by:\n`+
Inseob Kim988f53c2019-09-16 15:59:01 +0900248 `m %s-dump-api && rm -rf %q && cp -f %q %q\n`+
249 `******************************\n`, baseModuleName, baseModuleName,
Inseob Kim42882742019-07-30 17:55:33 +0900250 m.currentApiFile.String(), m.dumpedApiFile.String(), m.currentApiFile.String())
251
252 rule.Command().
253 Text("( cmp").Flag("-s").
254 Input(m.dumpedApiFile).
255 Input(m.currentApiFile).
256 Text("|| ( echo").Flag("-e").
257 Flag(`"` + msg + `"`).
258 Text("; exit 38) )")
259
260 // 2. current.txt <-> latest.txt
261 msg = fmt.Sprintf(`\n******************************\n`+
262 `API of sysprop_library %s doesn't match with latest version\n`+
263 `Please fix the breakage and rebuild.\n`+
Inseob Kim988f53c2019-09-16 15:59:01 +0900264 `******************************\n`, baseModuleName)
Inseob Kim42882742019-07-30 17:55:33 +0900265
266 rule.Command().
267 Text("( ").
268 BuiltTool(ctx, "sysprop_api_checker").
269 Input(m.latestApiFile).
270 Input(m.currentApiFile).
271 Text(" || ( echo").Flag("-e").
272 Flag(`"` + msg + `"`).
273 Text("; exit 38) )")
274
275 m.checkApiFileTimeStamp = android.PathForModuleOut(ctx, "check_api.timestamp")
276
277 rule.Command().
278 Text("touch").
279 Output(m.checkApiFileTimeStamp)
280
Inseob Kim988f53c2019-09-16 15:59:01 +0900281 rule.Build(pctx, ctx, baseModuleName+"_check_api", baseModuleName+" check api")
Inseob Kim42882742019-07-30 17:55:33 +0900282}
283
284func (m *syspropLibrary) AndroidMk() android.AndroidMkData {
285 return android.AndroidMkData{
286 Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
287 // sysprop_library module itself is defined as a FAKE module to perform API check.
288 // Actual implementation libraries are created on LoadHookMutator
289 fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)")
290 fmt.Fprintf(w, "LOCAL_MODULE := %s\n", m.Name())
291 fmt.Fprintf(w, "LOCAL_MODULE_CLASS := FAKE\n")
292 fmt.Fprintf(w, "LOCAL_MODULE_TAGS := optional\n")
293 fmt.Fprintf(w, "include $(BUILD_SYSTEM)/base_rules.mk\n\n")
294 fmt.Fprintf(w, "$(LOCAL_BUILT_MODULE): %s\n", m.checkApiFileTimeStamp.String())
295 fmt.Fprintf(w, "\ttouch $@\n\n")
Inseob Kim988f53c2019-09-16 15:59:01 +0900296 fmt.Fprintf(w, ".PHONY: %s-check-api %s-dump-api\n\n", name, name)
297
298 // dump API rule
299 fmt.Fprintf(w, "%s-dump-api: %s\n\n", name, m.dumpedApiFile.String())
Inseob Kim42882742019-07-30 17:55:33 +0900300
301 // check API rule
302 fmt.Fprintf(w, "%s-check-api: %s\n\n", name, m.checkApiFileTimeStamp.String())
Inseob Kim42882742019-07-30 17:55:33 +0900303 }}
304}
305
306// sysprop_library creates schematized APIs from sysprop description files (.sysprop).
307// Both Java and C++ modules can link against sysprop_library, and API stability check
308// against latest APIs (see build/soong/scripts/freeze-sysprop-api-files.sh)
309// is performed.
Inseob Kimc0907f12019-02-08 21:00:45 +0900310func syspropLibraryFactory() android.Module {
311 m := &syspropLibrary{}
312
313 m.AddProperties(
Inseob Kim42882742019-07-30 17:55:33 +0900314 &m.properties,
Inseob Kimc0907f12019-02-08 21:00:45 +0900315 )
Inseob Kim42882742019-07-30 17:55:33 +0900316 android.InitAndroidModule(m)
Inseob Kimc0907f12019-02-08 21:00:45 +0900317 android.AddLoadHook(m, func(ctx android.LoadHookContext) { syspropLibraryHook(ctx, m) })
Inseob Kimc0907f12019-02-08 21:00:45 +0900318 return m
319}
320
Inseob Kimac1e9862019-12-09 18:15:47 +0900321type ccLibraryProperties struct {
322 Name *string
323 Srcs []string
324 Soc_specific *bool
325 Device_specific *bool
326 Product_specific *bool
327 Sysprop struct {
328 Platform *bool
329 }
Inseob Kim89db15d2020-02-03 18:06:46 +0900330 Target struct {
331 Android struct {
332 Header_libs []string
333 Shared_libs []string
334 }
335 Host struct {
336 Static_libs []string
337 }
338 }
Inseob Kimac1e9862019-12-09 18:15:47 +0900339 Required []string
340 Recovery *bool
341 Recovery_available *bool
342 Vendor_available *bool
Inseob Kim89db15d2020-02-03 18:06:46 +0900343 Host_supported *bool
Inseob Kimac1e9862019-12-09 18:15:47 +0900344}
345
346type javaLibraryProperties struct {
347 Name *string
348 Srcs []string
349 Soc_specific *bool
350 Device_specific *bool
351 Product_specific *bool
352 Required []string
353 Sdk_version *string
354 Installable *bool
355 Libs []string
356 Stem *string
357}
358
Inseob Kimc0907f12019-02-08 21:00:45 +0900359func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
Inseob Kim42882742019-07-30 17:55:33 +0900360 if len(m.properties.Srcs) == 0 {
Inseob Kim6e93ac92019-03-21 17:43:49 +0900361 ctx.PropertyErrorf("srcs", "sysprop_library must specify srcs")
362 }
363
Inseob Kim42882742019-07-30 17:55:33 +0900364 missing_api := false
365
366 for _, txt := range []string{"-current.txt", "-latest.txt"} {
367 path := path.Join(ctx.ModuleDir(), "api", m.BaseModuleName()+txt)
368 file := android.ExistentPathForSource(ctx, path)
369 if !file.Valid() {
370 ctx.ModuleErrorf("API file %#v doesn't exist", path)
371 missing_api = true
372 }
373 }
374
375 if missing_api {
376 script := "build/soong/scripts/gen-sysprop-api-files.sh"
377 p := android.ExistentPathForSource(ctx, script)
378
379 if !p.Valid() {
380 panic(fmt.Sprintf("script file %s doesn't exist", script))
381 }
382
383 ctx.ModuleErrorf("One or more api files are missing. "+
384 "You can create them by:\n"+
385 "%s %q %q", script, ctx.ModuleDir(), m.BaseModuleName())
386 return
Inseob Kimc0907f12019-02-08 21:00:45 +0900387 }
388
Inseob Kimac1e9862019-12-09 18:15:47 +0900389 // ctx's Platform or Specific functions represent where this sysprop_library installed.
390 installedInSystem := ctx.Platform() || ctx.SystemExtSpecific()
391 installedInVendorOrOdm := ctx.SocSpecific() || ctx.DeviceSpecific()
392 isOwnerPlatform := false
Inseob Kim42882742019-07-30 17:55:33 +0900393 stub := "sysprop-library-stub-"
Inseob Kimc0907f12019-02-08 21:00:45 +0900394
Inseob Kimac1e9862019-12-09 18:15:47 +0900395 switch m.Owner() {
Inseob Kimc0907f12019-02-08 21:00:45 +0900396 case "Platform":
397 // Every partition can access platform-defined properties
Inseob Kim42882742019-07-30 17:55:33 +0900398 stub += "platform"
Inseob Kimac1e9862019-12-09 18:15:47 +0900399 isOwnerPlatform = true
Inseob Kimc0907f12019-02-08 21:00:45 +0900400 case "Vendor":
401 // System can't access vendor's properties
Inseob Kimac1e9862019-12-09 18:15:47 +0900402 if installedInSystem {
Inseob Kimc0907f12019-02-08 21:00:45 +0900403 ctx.ModuleErrorf("None of soc_specific, device_specific, product_specific is true. " +
404 "System can't access sysprop_library owned by Vendor")
405 }
Inseob Kim42882742019-07-30 17:55:33 +0900406 stub += "vendor"
Inseob Kimc0907f12019-02-08 21:00:45 +0900407 case "Odm":
408 // Only vendor can access Odm-defined properties
Inseob Kimac1e9862019-12-09 18:15:47 +0900409 if !installedInVendorOrOdm {
Inseob Kimc0907f12019-02-08 21:00:45 +0900410 ctx.ModuleErrorf("Neither soc_speicifc nor device_specific is true. " +
411 "Odm-defined properties should be accessed only in Vendor or Odm")
412 }
Inseob Kim42882742019-07-30 17:55:33 +0900413 stub += "vendor"
Inseob Kimc0907f12019-02-08 21:00:45 +0900414 default:
415 ctx.PropertyErrorf("property_owner",
Inseob Kimac1e9862019-12-09 18:15:47 +0900416 "Unknown value %s: must be one of Platform, Vendor or Odm", m.Owner())
Inseob Kimc0907f12019-02-08 21:00:45 +0900417 }
418
Inseob Kimac1e9862019-12-09 18:15:47 +0900419 ccProps := ccLibraryProperties{}
Inseob Kimc0907f12019-02-08 21:00:45 +0900420 ccProps.Name = proptools.StringPtr(m.CcModuleName())
Inseob Kim42882742019-07-30 17:55:33 +0900421 ccProps.Srcs = m.properties.Srcs
Inseob Kimac1e9862019-12-09 18:15:47 +0900422 ccProps.Soc_specific = proptools.BoolPtr(ctx.SocSpecific())
423 ccProps.Device_specific = proptools.BoolPtr(ctx.DeviceSpecific())
424 ccProps.Product_specific = proptools.BoolPtr(ctx.ProductSpecific())
425 ccProps.Sysprop.Platform = proptools.BoolPtr(isOwnerPlatform)
Inseob Kim89db15d2020-02-03 18:06:46 +0900426 ccProps.Target.Android.Header_libs = []string{"libbase_headers"}
427 ccProps.Target.Android.Shared_libs = []string{"liblog"}
428 ccProps.Target.Host.Static_libs = []string{"libbase", "liblog"}
Inseob Kim42882742019-07-30 17:55:33 +0900429 ccProps.Recovery_available = m.properties.Recovery_available
430 ccProps.Vendor_available = m.properties.Vendor_available
Inseob Kim89db15d2020-02-03 18:06:46 +0900431 ccProps.Host_supported = m.properties.Host_supported
Colin Cross84dfc3d2019-09-25 11:33:01 -0700432 ctx.CreateModule(cc.LibraryFactory, &ccProps)
Inseob Kim42882742019-07-30 17:55:33 +0900433
Inseob Kim988f53c2019-09-16 15:59:01 +0900434 scope := "internal"
Inseob Kim988f53c2019-09-16 15:59:01 +0900435
Inseob Kimac1e9862019-12-09 18:15:47 +0900436 // We need to only use public version, if the partition where sysprop_library will be installed
437 // is different from owner.
438
439 if ctx.ProductSpecific() {
440 // Currently product partition can't own any sysprop_library.
Inseob Kim988f53c2019-09-16 15:59:01 +0900441 scope = "public"
Inseob Kimac1e9862019-12-09 18:15:47 +0900442 } else if isOwnerPlatform && installedInVendorOrOdm {
443 // Vendor or Odm should use public version of Platform's sysprop_library.
Inseob Kim988f53c2019-09-16 15:59:01 +0900444 scope = "public"
445 }
446
Inseob Kimac1e9862019-12-09 18:15:47 +0900447 ctx.CreateModule(syspropJavaGenFactory, &syspropGenProperties{
Inseob Kim988f53c2019-09-16 15:59:01 +0900448 Srcs: m.properties.Srcs,
449 Scope: scope,
450 Name: proptools.StringPtr(m.javaGenModuleName()),
Inseob Kimac1e9862019-12-09 18:15:47 +0900451 })
452
453 ctx.CreateModule(java.LibraryFactory, &javaLibraryProperties{
454 Name: proptools.StringPtr(m.BaseModuleName()),
455 Srcs: []string{":" + m.javaGenModuleName()},
456 Soc_specific: proptools.BoolPtr(ctx.SocSpecific()),
457 Device_specific: proptools.BoolPtr(ctx.DeviceSpecific()),
458 Product_specific: proptools.BoolPtr(ctx.ProductSpecific()),
459 Installable: m.properties.Installable,
460 Sdk_version: proptools.StringPtr("core_current"),
461 Libs: []string{stub},
462 })
463
464 // if platform sysprop_library is installed in /system or /system-ext, we regard it as an API
465 // and allow any modules (even from different partition) to link against the sysprop_library.
466 // To do that, we create a public stub and expose it to modules with sdk_version: system_*.
467 if isOwnerPlatform && installedInSystem {
468 m.properties.Public_stub = proptools.BoolPtr(true)
469 ctx.CreateModule(syspropJavaGenFactory, &syspropGenProperties{
470 Srcs: m.properties.Srcs,
471 Scope: "public",
472 Name: proptools.StringPtr(m.javaGenPublicStubName()),
473 })
474
475 ctx.CreateModule(java.LibraryFactory, &javaLibraryProperties{
476 Name: proptools.StringPtr(m.JavaPublicStubName()),
477 Srcs: []string{":" + m.javaGenPublicStubName()},
478 Installable: proptools.BoolPtr(false),
479 Sdk_version: proptools.StringPtr("core_current"),
480 Libs: []string{stub},
481 Stem: proptools.StringPtr(m.BaseModuleName()),
482 })
Inseob Kim988f53c2019-09-16 15:59:01 +0900483 }
Inseob Kim628d7ef2020-03-21 03:38:32 +0900484
485 syspropLibrariesLock.Lock()
486 defer syspropLibrariesLock.Unlock()
487
488 libraries := syspropLibraries(ctx.Config())
489 *libraries = append(*libraries, ctx.ModuleName())
Inseob Kimc0907f12019-02-08 21:00:45 +0900490}
Inseob Kim988f53c2019-09-16 15:59:01 +0900491
492func syspropDepsMutator(ctx android.BottomUpMutatorContext) {
493 if m, ok := ctx.Module().(*syspropLibrary); ok {
494 ctx.AddReverseDependency(m, nil, m.javaGenModuleName())
Inseob Kimac1e9862019-12-09 18:15:47 +0900495
496 if proptools.Bool(m.properties.Public_stub) {
497 ctx.AddReverseDependency(m, nil, m.javaGenPublicStubName())
498 }
Inseob Kim988f53c2019-09-16 15:59:01 +0900499 }
500}