sysprop_library.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. // 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. // sysprop package defines a module named sysprop_library that can implement sysprop as API
  15. // See https://source.android.com/devices/architecture/sysprops-apis for details
  16. package sysprop
  17. import (
  18. "fmt"
  19. "io"
  20. "os"
  21. "path"
  22. "sync"
  23. "android/soong/bazel"
  24. "github.com/google/blueprint"
  25. "github.com/google/blueprint/proptools"
  26. "android/soong/android"
  27. "android/soong/cc"
  28. "android/soong/java"
  29. )
  30. type dependencyTag struct {
  31. blueprint.BaseDependencyTag
  32. name string
  33. }
  34. type syspropGenProperties struct {
  35. Srcs []string `android:"path"`
  36. Scope string
  37. Name *string
  38. Check_api *string
  39. }
  40. type syspropJavaGenRule struct {
  41. android.ModuleBase
  42. properties syspropGenProperties
  43. genSrcjars android.Paths
  44. }
  45. var _ android.OutputFileProducer = (*syspropJavaGenRule)(nil)
  46. var (
  47. syspropJava = pctx.AndroidStaticRule("syspropJava",
  48. blueprint.RuleParams{
  49. Command: `rm -rf $out.tmp && mkdir -p $out.tmp && ` +
  50. `$syspropJavaCmd --scope $scope --java-output-dir $out.tmp $in && ` +
  51. `$soongZipCmd -jar -o $out -C $out.tmp -D $out.tmp && rm -rf $out.tmp`,
  52. CommandDeps: []string{
  53. "$syspropJavaCmd",
  54. "$soongZipCmd",
  55. },
  56. }, "scope")
  57. )
  58. func init() {
  59. pctx.HostBinToolVariable("soongZipCmd", "soong_zip")
  60. pctx.HostBinToolVariable("syspropJavaCmd", "sysprop_java")
  61. }
  62. // syspropJavaGenRule module generates srcjar containing generated java APIs.
  63. // It also depends on check api rule, so api check has to pass to use sysprop_library.
  64. func (g *syspropJavaGenRule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
  65. var checkApiFileTimeStamp android.WritablePath
  66. ctx.VisitDirectDeps(func(dep android.Module) {
  67. if m, ok := dep.(*syspropLibrary); ok {
  68. checkApiFileTimeStamp = m.checkApiFileTimeStamp
  69. }
  70. })
  71. for _, syspropFile := range android.PathsForModuleSrc(ctx, g.properties.Srcs) {
  72. srcJarFile := android.GenPathWithExt(ctx, "sysprop", syspropFile, "srcjar")
  73. ctx.Build(pctx, android.BuildParams{
  74. Rule: syspropJava,
  75. Description: "sysprop_java " + syspropFile.Rel(),
  76. Output: srcJarFile,
  77. Input: syspropFile,
  78. Implicit: checkApiFileTimeStamp,
  79. Args: map[string]string{
  80. "scope": g.properties.Scope,
  81. },
  82. })
  83. g.genSrcjars = append(g.genSrcjars, srcJarFile)
  84. }
  85. }
  86. func (g *syspropJavaGenRule) DepsMutator(ctx android.BottomUpMutatorContext) {
  87. // Add a dependency from the stubs to sysprop library so that the generator rule can depend on
  88. // the check API rule of the sysprop library.
  89. ctx.AddFarVariationDependencies(nil, nil, proptools.String(g.properties.Check_api))
  90. }
  91. func (g *syspropJavaGenRule) OutputFiles(tag string) (android.Paths, error) {
  92. switch tag {
  93. case "":
  94. return g.genSrcjars, nil
  95. default:
  96. return nil, fmt.Errorf("unsupported module reference tag %q", tag)
  97. }
  98. }
  99. func syspropJavaGenFactory() android.Module {
  100. g := &syspropJavaGenRule{}
  101. g.AddProperties(&g.properties)
  102. android.InitAndroidModule(g)
  103. return g
  104. }
  105. type syspropLibrary struct {
  106. android.ModuleBase
  107. android.ApexModuleBase
  108. android.BazelModuleBase
  109. properties syspropLibraryProperties
  110. checkApiFileTimeStamp android.WritablePath
  111. latestApiFile android.OptionalPath
  112. currentApiFile android.OptionalPath
  113. dumpedApiFile android.WritablePath
  114. }
  115. type syspropLibraryProperties struct {
  116. // Determine who owns this sysprop library. Possible values are
  117. // "Platform", "Vendor", or "Odm"
  118. Property_owner string
  119. // list of package names that will be documented and publicized as API
  120. Api_packages []string
  121. // If set to true, allow this module to be dexed and installed on devices.
  122. Installable *bool
  123. // Make this module available when building for ramdisk
  124. Ramdisk_available *bool
  125. // Make this module available when building for recovery
  126. Recovery_available *bool
  127. // Make this module available when building for vendor
  128. Vendor_available *bool
  129. // Make this module available when building for product
  130. Product_available *bool
  131. // list of .sysprop files which defines the properties.
  132. Srcs []string `android:"path"`
  133. // If set to true, build a variant of the module for the host. Defaults to false.
  134. Host_supported *bool
  135. Cpp struct {
  136. // Minimum sdk version that the artifact should support when it runs as part of mainline modules(APEX).
  137. // Forwarded to cc_library.min_sdk_version
  138. Min_sdk_version *string
  139. }
  140. Java struct {
  141. // Minimum sdk version that the artifact should support when it runs as part of mainline modules(APEX).
  142. // Forwarded to java_library.min_sdk_version
  143. Min_sdk_version *string
  144. }
  145. }
  146. var (
  147. pctx = android.NewPackageContext("android/soong/sysprop")
  148. syspropCcTag = dependencyTag{name: "syspropCc"}
  149. syspropLibrariesKey = android.NewOnceKey("syspropLibraries")
  150. syspropLibrariesLock sync.Mutex
  151. )
  152. // List of sysprop_library used by property_contexts to perform type check.
  153. func syspropLibraries(config android.Config) *[]string {
  154. return config.Once(syspropLibrariesKey, func() interface{} {
  155. return &[]string{}
  156. }).(*[]string)
  157. }
  158. func SyspropLibraries(config android.Config) []string {
  159. return append([]string{}, *syspropLibraries(config)...)
  160. }
  161. func init() {
  162. registerSyspropBuildComponents(android.InitRegistrationContext)
  163. }
  164. func registerSyspropBuildComponents(ctx android.RegistrationContext) {
  165. ctx.RegisterModuleType("sysprop_library", syspropLibraryFactory)
  166. }
  167. func (m *syspropLibrary) Name() string {
  168. return m.BaseModuleName() + "_sysprop_library"
  169. }
  170. func (m *syspropLibrary) Owner() string {
  171. return m.properties.Property_owner
  172. }
  173. func (m *syspropLibrary) CcImplementationModuleName() string {
  174. return "lib" + m.BaseModuleName()
  175. }
  176. func (m *syspropLibrary) javaPublicStubName() string {
  177. return m.BaseModuleName() + "_public"
  178. }
  179. func (m *syspropLibrary) javaGenModuleName() string {
  180. return m.BaseModuleName() + "_java_gen"
  181. }
  182. func (m *syspropLibrary) javaGenPublicStubName() string {
  183. return m.BaseModuleName() + "_java_gen_public"
  184. }
  185. func (m *syspropLibrary) BaseModuleName() string {
  186. return m.ModuleBase.Name()
  187. }
  188. func (m *syspropLibrary) CurrentSyspropApiFile() android.OptionalPath {
  189. return m.currentApiFile
  190. }
  191. // GenerateAndroidBuildActions of sysprop_library handles API dump and API check.
  192. // generated java_library will depend on these API files.
  193. func (m *syspropLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
  194. baseModuleName := m.BaseModuleName()
  195. for _, syspropFile := range android.PathsForModuleSrc(ctx, m.properties.Srcs) {
  196. if syspropFile.Ext() != ".sysprop" {
  197. ctx.PropertyErrorf("srcs", "srcs contains non-sysprop file %q", syspropFile.String())
  198. }
  199. }
  200. if ctx.Failed() {
  201. return
  202. }
  203. apiDirectoryPath := path.Join(ctx.ModuleDir(), "api")
  204. currentApiFilePath := path.Join(apiDirectoryPath, baseModuleName+"-current.txt")
  205. latestApiFilePath := path.Join(apiDirectoryPath, baseModuleName+"-latest.txt")
  206. m.currentApiFile = android.ExistentPathForSource(ctx, currentApiFilePath)
  207. m.latestApiFile = android.ExistentPathForSource(ctx, latestApiFilePath)
  208. // dump API rule
  209. rule := android.NewRuleBuilder(pctx, ctx)
  210. m.dumpedApiFile = android.PathForModuleOut(ctx, "api-dump.txt")
  211. rule.Command().
  212. BuiltTool("sysprop_api_dump").
  213. Output(m.dumpedApiFile).
  214. Inputs(android.PathsForModuleSrc(ctx, m.properties.Srcs))
  215. rule.Build(baseModuleName+"_api_dump", baseModuleName+" api dump")
  216. // check API rule
  217. rule = android.NewRuleBuilder(pctx, ctx)
  218. // We allow that the API txt files don't exist, when the sysprop_library only contains internal
  219. // properties. But we have to feed current api file and latest api file to the rule builder.
  220. // Currently we can't get android.Path representing the null device, so we add any existing API
  221. // txt files to implicits, and then directly feed string paths, rather than calling Input(Path)
  222. // method.
  223. var apiFileList android.Paths
  224. currentApiArgument := os.DevNull
  225. if m.currentApiFile.Valid() {
  226. apiFileList = append(apiFileList, m.currentApiFile.Path())
  227. currentApiArgument = m.currentApiFile.String()
  228. }
  229. latestApiArgument := os.DevNull
  230. if m.latestApiFile.Valid() {
  231. apiFileList = append(apiFileList, m.latestApiFile.Path())
  232. latestApiArgument = m.latestApiFile.String()
  233. }
  234. // 1. compares current.txt to api-dump.txt
  235. // current.txt should be identical to api-dump.txt.
  236. msg := fmt.Sprintf(`\n******************************\n`+
  237. `API of sysprop_library %s doesn't match with current.txt\n`+
  238. `Please update current.txt by:\n`+
  239. `m %s-dump-api && mkdir -p %q && rm -rf %q && cp -f %q %q\n`+
  240. `******************************\n`, baseModuleName, baseModuleName,
  241. apiDirectoryPath, currentApiFilePath, m.dumpedApiFile.String(), currentApiFilePath)
  242. rule.Command().
  243. Text("( cmp").Flag("-s").
  244. Input(m.dumpedApiFile).
  245. Text(currentApiArgument).
  246. Text("|| ( echo").Flag("-e").
  247. Flag(`"` + msg + `"`).
  248. Text("; exit 38) )")
  249. // 2. compares current.txt to latest.txt (frozen API)
  250. // current.txt should be compatible with latest.txt
  251. msg = fmt.Sprintf(`\n******************************\n`+
  252. `API of sysprop_library %s doesn't match with latest version\n`+
  253. `Please fix the breakage and rebuild.\n`+
  254. `******************************\n`, baseModuleName)
  255. rule.Command().
  256. Text("( ").
  257. BuiltTool("sysprop_api_checker").
  258. Text(latestApiArgument).
  259. Text(currentApiArgument).
  260. Text(" || ( echo").Flag("-e").
  261. Flag(`"` + msg + `"`).
  262. Text("; exit 38) )").
  263. Implicits(apiFileList)
  264. m.checkApiFileTimeStamp = android.PathForModuleOut(ctx, "check_api.timestamp")
  265. rule.Command().
  266. Text("touch").
  267. Output(m.checkApiFileTimeStamp)
  268. rule.Build(baseModuleName+"_check_api", baseModuleName+" check api")
  269. }
  270. func (m *syspropLibrary) AndroidMk() android.AndroidMkData {
  271. return android.AndroidMkData{
  272. Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
  273. // sysprop_library module itself is defined as a FAKE module to perform API check.
  274. // Actual implementation libraries are created on LoadHookMutator
  275. fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)", " # sysprop.syspropLibrary")
  276. fmt.Fprintln(w, "LOCAL_MODULE :=", m.Name())
  277. data.Entries.WriteLicenseVariables(w)
  278. fmt.Fprintf(w, "LOCAL_MODULE_CLASS := FAKE\n")
  279. fmt.Fprintf(w, "LOCAL_MODULE_TAGS := optional\n")
  280. fmt.Fprintf(w, "include $(BUILD_SYSTEM)/base_rules.mk\n\n")
  281. fmt.Fprintf(w, "$(LOCAL_BUILT_MODULE): %s\n", m.checkApiFileTimeStamp.String())
  282. fmt.Fprintf(w, "\ttouch $@\n\n")
  283. fmt.Fprintf(w, ".PHONY: %s-check-api %s-dump-api\n\n", name, name)
  284. // dump API rule
  285. fmt.Fprintf(w, "%s-dump-api: %s\n\n", name, m.dumpedApiFile.String())
  286. // check API rule
  287. fmt.Fprintf(w, "%s-check-api: %s\n\n", name, m.checkApiFileTimeStamp.String())
  288. }}
  289. }
  290. var _ android.ApexModule = (*syspropLibrary)(nil)
  291. // Implements android.ApexModule
  292. func (m *syspropLibrary) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
  293. sdkVersion android.ApiLevel) error {
  294. return fmt.Errorf("sysprop_library is not supposed to be part of apex modules")
  295. }
  296. // sysprop_library creates schematized APIs from sysprop description files (.sysprop).
  297. // Both Java and C++ modules can link against sysprop_library, and API stability check
  298. // against latest APIs (see build/soong/scripts/freeze-sysprop-api-files.sh)
  299. // is performed. Note that the generated C++ module has its name prefixed with
  300. // `lib`, and it is this module that should be depended on from other C++
  301. // modules; i.e., if the sysprop_library module is named `foo`, C++ modules
  302. // should depend on `libfoo`.
  303. func syspropLibraryFactory() android.Module {
  304. m := &syspropLibrary{}
  305. m.AddProperties(
  306. &m.properties,
  307. )
  308. android.InitAndroidModule(m)
  309. android.InitApexModule(m)
  310. android.InitBazelModule(m)
  311. android.AddLoadHook(m, func(ctx android.LoadHookContext) { syspropLibraryHook(ctx, m) })
  312. return m
  313. }
  314. type ccLibraryProperties struct {
  315. Name *string
  316. Srcs []string
  317. Soc_specific *bool
  318. Device_specific *bool
  319. Product_specific *bool
  320. Sysprop struct {
  321. Platform *bool
  322. }
  323. Target struct {
  324. Android struct {
  325. Header_libs []string
  326. Shared_libs []string
  327. }
  328. Host struct {
  329. Static_libs []string
  330. }
  331. }
  332. Required []string
  333. Recovery *bool
  334. Recovery_available *bool
  335. Vendor_available *bool
  336. Product_available *bool
  337. Ramdisk_available *bool
  338. Host_supported *bool
  339. Apex_available []string
  340. Min_sdk_version *string
  341. Bazel_module struct {
  342. Bp2build_available *bool
  343. }
  344. }
  345. type javaLibraryProperties struct {
  346. Name *string
  347. Srcs []string
  348. Soc_specific *bool
  349. Device_specific *bool
  350. Product_specific *bool
  351. Required []string
  352. Sdk_version *string
  353. Installable *bool
  354. Libs []string
  355. Stem *string
  356. SyspropPublicStub string
  357. Apex_available []string
  358. Min_sdk_version *string
  359. }
  360. func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
  361. if len(m.properties.Srcs) == 0 {
  362. ctx.PropertyErrorf("srcs", "sysprop_library must specify srcs")
  363. }
  364. // ctx's Platform or Specific functions represent where this sysprop_library installed.
  365. installedInSystem := ctx.Platform() || ctx.SystemExtSpecific()
  366. installedInVendorOrOdm := ctx.SocSpecific() || ctx.DeviceSpecific()
  367. installedInProduct := ctx.ProductSpecific()
  368. isOwnerPlatform := false
  369. var javaSyspropStub string
  370. // javaSyspropStub contains stub libraries used by generated APIs, instead of framework stub.
  371. // This is to make sysprop_library link against core_current.
  372. if installedInVendorOrOdm {
  373. javaSyspropStub = "sysprop-library-stub-vendor"
  374. } else if installedInProduct {
  375. javaSyspropStub = "sysprop-library-stub-product"
  376. } else {
  377. javaSyspropStub = "sysprop-library-stub-platform"
  378. }
  379. switch m.Owner() {
  380. case "Platform":
  381. // Every partition can access platform-defined properties
  382. isOwnerPlatform = true
  383. case "Vendor":
  384. // System can't access vendor's properties
  385. if installedInSystem {
  386. ctx.ModuleErrorf("None of soc_specific, device_specific, product_specific is true. " +
  387. "System can't access sysprop_library owned by Vendor")
  388. }
  389. case "Odm":
  390. // Only vendor can access Odm-defined properties
  391. if !installedInVendorOrOdm {
  392. ctx.ModuleErrorf("Neither soc_speicifc nor device_specific is true. " +
  393. "Odm-defined properties should be accessed only in Vendor or Odm")
  394. }
  395. default:
  396. ctx.PropertyErrorf("property_owner",
  397. "Unknown value %s: must be one of Platform, Vendor or Odm", m.Owner())
  398. }
  399. // Generate a C++ implementation library.
  400. // cc_library can receive *.sysprop files as their srcs, generating sources itself.
  401. ccProps := ccLibraryProperties{}
  402. ccProps.Name = proptools.StringPtr(m.CcImplementationModuleName())
  403. ccProps.Srcs = m.properties.Srcs
  404. ccProps.Soc_specific = proptools.BoolPtr(ctx.SocSpecific())
  405. ccProps.Device_specific = proptools.BoolPtr(ctx.DeviceSpecific())
  406. ccProps.Product_specific = proptools.BoolPtr(ctx.ProductSpecific())
  407. ccProps.Sysprop.Platform = proptools.BoolPtr(isOwnerPlatform)
  408. ccProps.Target.Android.Header_libs = []string{"libbase_headers"}
  409. ccProps.Target.Android.Shared_libs = []string{"liblog"}
  410. ccProps.Target.Host.Static_libs = []string{"libbase", "liblog"}
  411. ccProps.Recovery_available = m.properties.Recovery_available
  412. ccProps.Vendor_available = m.properties.Vendor_available
  413. ccProps.Product_available = m.properties.Product_available
  414. ccProps.Ramdisk_available = m.properties.Ramdisk_available
  415. ccProps.Host_supported = m.properties.Host_supported
  416. ccProps.Apex_available = m.ApexProperties.Apex_available
  417. ccProps.Min_sdk_version = m.properties.Cpp.Min_sdk_version
  418. // A Bazel macro handles this, so this module does not need to be handled
  419. // in bp2build
  420. // TODO(b/237810289) perhaps do something different here so that we aren't
  421. // also disabling these modules in mixed builds
  422. ccProps.Bazel_module.Bp2build_available = proptools.BoolPtr(false)
  423. ctx.CreateModule(cc.LibraryFactory, &ccProps)
  424. scope := "internal"
  425. // We need to only use public version, if the partition where sysprop_library will be installed
  426. // is different from owner.
  427. if ctx.ProductSpecific() {
  428. // Currently product partition can't own any sysprop_library. So product always uses public.
  429. scope = "public"
  430. } else if isOwnerPlatform && installedInVendorOrOdm {
  431. // Vendor or Odm should use public version of Platform's sysprop_library.
  432. scope = "public"
  433. }
  434. // Generate a Java implementation library.
  435. // Contrast to C++, syspropJavaGenRule module will generate srcjar and the srcjar will be fed
  436. // to Java implementation library.
  437. ctx.CreateModule(syspropJavaGenFactory, &syspropGenProperties{
  438. Srcs: m.properties.Srcs,
  439. Scope: scope,
  440. Name: proptools.StringPtr(m.javaGenModuleName()),
  441. Check_api: proptools.StringPtr(ctx.ModuleName()),
  442. })
  443. // if platform sysprop_library is installed in /system or /system-ext, we regard it as an API
  444. // and allow any modules (even from different partition) to link against the sysprop_library.
  445. // To do that, we create a public stub and expose it to modules with sdk_version: system_*.
  446. var publicStub string
  447. if isOwnerPlatform && installedInSystem {
  448. publicStub = m.javaPublicStubName()
  449. }
  450. ctx.CreateModule(java.LibraryFactory, &javaLibraryProperties{
  451. Name: proptools.StringPtr(m.BaseModuleName()),
  452. Srcs: []string{":" + m.javaGenModuleName()},
  453. Soc_specific: proptools.BoolPtr(ctx.SocSpecific()),
  454. Device_specific: proptools.BoolPtr(ctx.DeviceSpecific()),
  455. Product_specific: proptools.BoolPtr(ctx.ProductSpecific()),
  456. Installable: m.properties.Installable,
  457. Sdk_version: proptools.StringPtr("core_current"),
  458. Libs: []string{javaSyspropStub},
  459. SyspropPublicStub: publicStub,
  460. Apex_available: m.ApexProperties.Apex_available,
  461. Min_sdk_version: m.properties.Java.Min_sdk_version,
  462. })
  463. if publicStub != "" {
  464. ctx.CreateModule(syspropJavaGenFactory, &syspropGenProperties{
  465. Srcs: m.properties.Srcs,
  466. Scope: "public",
  467. Name: proptools.StringPtr(m.javaGenPublicStubName()),
  468. Check_api: proptools.StringPtr(ctx.ModuleName()),
  469. })
  470. ctx.CreateModule(java.LibraryFactory, &javaLibraryProperties{
  471. Name: proptools.StringPtr(publicStub),
  472. Srcs: []string{":" + m.javaGenPublicStubName()},
  473. Installable: proptools.BoolPtr(false),
  474. Sdk_version: proptools.StringPtr("core_current"),
  475. Libs: []string{javaSyspropStub},
  476. Stem: proptools.StringPtr(m.BaseModuleName()),
  477. })
  478. }
  479. // syspropLibraries will be used by property_contexts to check types.
  480. // Record absolute paths of sysprop_library to prevent soong_namespace problem.
  481. if m.ExportedToMake() {
  482. syspropLibrariesLock.Lock()
  483. defer syspropLibrariesLock.Unlock()
  484. libraries := syspropLibraries(ctx.Config())
  485. *libraries = append(*libraries, "//"+ctx.ModuleDir()+":"+ctx.ModuleName())
  486. }
  487. }
  488. // TODO(b/240463568): Additional properties will be added for API validation
  489. func (m *syspropLibrary) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
  490. labels := cc.SyspropLibraryLabels{
  491. SyspropLibraryLabel: m.BaseModuleName(),
  492. SharedLibraryLabel: m.CcImplementationModuleName(),
  493. StaticLibraryLabel: cc.BazelLabelNameForStaticModule(m.CcImplementationModuleName()),
  494. }
  495. cc.Bp2buildSysprop(ctx,
  496. labels,
  497. bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrc(ctx, m.properties.Srcs)),
  498. m.properties.Cpp.Min_sdk_version)
  499. }