library_sdk_member.go 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. // Copyright 2019 Google Inc. All rights reserved.
  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. package cc
  15. import (
  16. "path/filepath"
  17. "android/soong/android"
  18. "github.com/google/blueprint"
  19. "github.com/google/blueprint/proptools"
  20. )
  21. // This file contains support for using cc library modules within an sdk.
  22. var sharedLibrarySdkMemberType = &librarySdkMemberType{
  23. SdkMemberTypeBase: android.SdkMemberTypeBase{
  24. PropertyName: "native_shared_libs",
  25. SupportsSdk: true,
  26. HostOsDependent: true,
  27. SupportedLinkageNames: []string{"shared"},
  28. },
  29. prebuiltModuleType: "cc_prebuilt_library_shared",
  30. }
  31. var staticLibrarySdkMemberType = &librarySdkMemberType{
  32. SdkMemberTypeBase: android.SdkMemberTypeBase{
  33. PropertyName: "native_static_libs",
  34. SupportsSdk: true,
  35. HostOsDependent: true,
  36. SupportedLinkageNames: []string{"static"},
  37. },
  38. prebuiltModuleType: "cc_prebuilt_library_static",
  39. }
  40. var staticAndSharedLibrarySdkMemberType = &librarySdkMemberType{
  41. SdkMemberTypeBase: android.SdkMemberTypeBase{
  42. PropertyName: "native_libs",
  43. OverridesPropertyNames: map[string]bool{"native_shared_libs": true, "native_static_libs": true},
  44. SupportsSdk: true,
  45. HostOsDependent: true,
  46. SupportedLinkageNames: []string{"static", "shared"},
  47. },
  48. prebuiltModuleType: "cc_prebuilt_library",
  49. }
  50. func init() {
  51. // Register sdk member types.
  52. android.RegisterSdkMemberType(sharedLibrarySdkMemberType)
  53. android.RegisterSdkMemberType(staticLibrarySdkMemberType)
  54. android.RegisterSdkMemberType(staticAndSharedLibrarySdkMemberType)
  55. }
  56. type librarySdkMemberType struct {
  57. android.SdkMemberTypeBase
  58. prebuiltModuleType string
  59. noOutputFiles bool // True if there are no srcs files.
  60. }
  61. func (mt *librarySdkMemberType) AddDependencies(ctx android.SdkDependencyContext, dependencyTag blueprint.DependencyTag, names []string) {
  62. // The base set of targets which does not include native bridge targets.
  63. defaultTargets := ctx.MultiTargets()
  64. // The lazily created list of native bridge targets.
  65. var includeNativeBridgeTargets []android.Target
  66. for _, lib := range names {
  67. targets := defaultTargets
  68. // If native bridge support is required in the sdk snapshot then add native bridge targets to
  69. // the basic list of targets that are required.
  70. nativeBridgeSupport := ctx.RequiresTrait(lib, nativeBridgeSdkTrait)
  71. if nativeBridgeSupport && ctx.Device() {
  72. // If not already computed then compute the list of native bridge targets.
  73. if includeNativeBridgeTargets == nil {
  74. includeNativeBridgeTargets = append([]android.Target{}, defaultTargets...)
  75. allAndroidTargets := ctx.Config().Targets[android.Android]
  76. for _, possibleNativeBridgeTarget := range allAndroidTargets {
  77. if possibleNativeBridgeTarget.NativeBridge == android.NativeBridgeEnabled {
  78. includeNativeBridgeTargets = append(includeNativeBridgeTargets, possibleNativeBridgeTarget)
  79. }
  80. }
  81. }
  82. // Include the native bridge targets as well.
  83. targets = includeNativeBridgeTargets
  84. }
  85. // memberDependency encapsulates information about the dependencies to add for this member.
  86. type memberDependency struct {
  87. // The targets to depend upon.
  88. targets []android.Target
  89. // Additional image variations to depend upon, is either nil for no image variation or
  90. // contains a single image variation.
  91. imageVariations []blueprint.Variation
  92. }
  93. // Extract the name and version from the module name.
  94. name, version := StubsLibNameAndVersion(lib)
  95. if version == "" {
  96. version = "latest"
  97. }
  98. // Compute the set of dependencies to add.
  99. var memberDependencies []memberDependency
  100. if ctx.Host() {
  101. // Host does not support image variations so add a dependency without any.
  102. memberDependencies = append(memberDependencies, memberDependency{
  103. targets: targets,
  104. })
  105. } else {
  106. // Otherwise, this is targeting the device so add a dependency on the core image variation
  107. // (image:"").
  108. memberDependencies = append(memberDependencies, memberDependency{
  109. imageVariations: []blueprint.Variation{{Mutator: "image", Variation: android.CoreVariation}},
  110. targets: targets,
  111. })
  112. // If required add additional dependencies on the image:ramdisk variants.
  113. if ctx.RequiresTrait(lib, ramdiskImageRequiredSdkTrait) {
  114. memberDependencies = append(memberDependencies, memberDependency{
  115. imageVariations: []blueprint.Variation{{Mutator: "image", Variation: android.RamdiskVariation}},
  116. // Only add a dependency on the first target as that is the only one which will have an
  117. // image:ramdisk variant.
  118. targets: targets[:1],
  119. })
  120. }
  121. // If required add additional dependencies on the image:recovery variants.
  122. if ctx.RequiresTrait(lib, recoveryImageRequiredSdkTrait) {
  123. memberDependencies = append(memberDependencies, memberDependency{
  124. imageVariations: []blueprint.Variation{{Mutator: "image", Variation: android.RecoveryVariation}},
  125. // Only add a dependency on the first target as that is the only one which will have an
  126. // image:recovery variant.
  127. targets: targets[:1],
  128. })
  129. }
  130. }
  131. // For each dependency in the list add dependencies on the targets with the correct variations.
  132. for _, dependency := range memberDependencies {
  133. // For each target add a dependency on the target with any additional dependencies.
  134. for _, target := range dependency.targets {
  135. // Get the variations for the target.
  136. variations := target.Variations()
  137. // Add any additional dependencies needed.
  138. variations = append(variations, dependency.imageVariations...)
  139. if mt.SupportedLinkageNames == nil {
  140. // No link types are supported so add a dependency directly.
  141. ctx.AddFarVariationDependencies(variations, dependencyTag, name)
  142. } else {
  143. // Otherwise, add a dependency on each supported link type in turn.
  144. for _, linkType := range mt.SupportedLinkageNames {
  145. libVariations := append(variations,
  146. blueprint.Variation{Mutator: "link", Variation: linkType})
  147. // If this is for the device and a shared link type then add a dependency onto the
  148. // appropriate version specific variant of the module.
  149. if ctx.Device() && linkType == "shared" {
  150. libVariations = append(libVariations,
  151. blueprint.Variation{Mutator: "version", Variation: version})
  152. }
  153. ctx.AddFarVariationDependencies(libVariations, dependencyTag, name)
  154. }
  155. }
  156. }
  157. }
  158. }
  159. }
  160. func (mt *librarySdkMemberType) IsInstance(module android.Module) bool {
  161. // Check the module to see if it can be used with this module type.
  162. if m, ok := module.(*Module); ok {
  163. for _, allowableMemberType := range m.sdkMemberTypes {
  164. if allowableMemberType == mt {
  165. return true
  166. }
  167. }
  168. }
  169. return false
  170. }
  171. func (mt *librarySdkMemberType) AddPrebuiltModule(ctx android.SdkMemberContext, member android.SdkMember) android.BpModule {
  172. pbm := ctx.SnapshotBuilder().AddPrebuiltModule(member, mt.prebuiltModuleType)
  173. ccModule := member.Variants()[0].(*Module)
  174. if ctx.RequiresTrait(nativeBridgeSdkTrait) {
  175. pbm.AddProperty("native_bridge_supported", true)
  176. }
  177. if ctx.RequiresTrait(ramdiskImageRequiredSdkTrait) {
  178. pbm.AddProperty("ramdisk_available", true)
  179. }
  180. if ctx.RequiresTrait(recoveryImageRequiredSdkTrait) {
  181. pbm.AddProperty("recovery_available", true)
  182. }
  183. if proptools.Bool(ccModule.VendorProperties.Vendor_available) {
  184. pbm.AddProperty("vendor_available", true)
  185. }
  186. if proptools.Bool(ccModule.VendorProperties.Odm_available) {
  187. pbm.AddProperty("odm_available", true)
  188. }
  189. if proptools.Bool(ccModule.VendorProperties.Product_available) {
  190. pbm.AddProperty("product_available", true)
  191. }
  192. sdkVersion := ccModule.SdkVersion()
  193. if sdkVersion != "" {
  194. pbm.AddProperty("sdk_version", sdkVersion)
  195. }
  196. stl := ccModule.stl.Properties.Stl
  197. if stl != nil {
  198. pbm.AddProperty("stl", proptools.String(stl))
  199. }
  200. if lib, ok := ccModule.linker.(*libraryDecorator); ok {
  201. uhs := lib.Properties.Unique_host_soname
  202. if uhs != nil {
  203. pbm.AddProperty("unique_host_soname", proptools.Bool(uhs))
  204. }
  205. }
  206. return pbm
  207. }
  208. func (mt *librarySdkMemberType) CreateVariantPropertiesStruct() android.SdkMemberProperties {
  209. return &nativeLibInfoProperties{memberType: mt}
  210. }
  211. func isBazelOutDirectory(p android.Path) bool {
  212. _, bazel := p.(android.BazelOutPath)
  213. return bazel
  214. }
  215. func isGeneratedHeaderDirectory(p android.Path) bool {
  216. _, gen := p.(android.WritablePath)
  217. // TODO(b/183213331): Here we assume that bazel-based headers are not generated; we need
  218. // to support generated headers in mixed builds.
  219. return gen && !isBazelOutDirectory(p)
  220. }
  221. type includeDirsProperty struct {
  222. // Accessor to retrieve the paths
  223. pathsGetter func(libInfo *nativeLibInfoProperties) android.Paths
  224. // The name of the property in the prebuilt library, "" means there is no property.
  225. propertyName string
  226. // The directory within the snapshot directory into which items should be copied.
  227. snapshotDir string
  228. // True if the items on the path should be copied.
  229. copy bool
  230. // True if the paths represent directories, files if they represent files.
  231. dirs bool
  232. }
  233. var includeDirProperties = []includeDirsProperty{
  234. {
  235. // ExportedIncludeDirs lists directories that contains some header files to be
  236. // copied into a directory in the snapshot. The snapshot directories must be added to
  237. // the export_include_dirs property in the prebuilt module in the snapshot.
  238. pathsGetter: func(libInfo *nativeLibInfoProperties) android.Paths { return libInfo.ExportedIncludeDirs },
  239. propertyName: "export_include_dirs",
  240. snapshotDir: nativeIncludeDir,
  241. copy: true,
  242. dirs: true,
  243. },
  244. {
  245. // ExportedSystemIncludeDirs lists directories that contains some system header files to
  246. // be copied into a directory in the snapshot. The snapshot directories must be added to
  247. // the export_system_include_dirs property in the prebuilt module in the snapshot.
  248. pathsGetter: func(libInfo *nativeLibInfoProperties) android.Paths { return libInfo.ExportedSystemIncludeDirs },
  249. propertyName: "export_system_include_dirs",
  250. snapshotDir: nativeIncludeDir,
  251. copy: true,
  252. dirs: true,
  253. },
  254. {
  255. // ExportedGeneratedIncludeDirs lists directories that contains some header files
  256. // that are explicitly listed in the ExportedGeneratedHeaders property. So, the contents
  257. // of these directories do not need to be copied, but these directories do need adding to
  258. // the export_include_dirs property in the prebuilt module in the snapshot.
  259. pathsGetter: func(libInfo *nativeLibInfoProperties) android.Paths { return libInfo.ExportedGeneratedIncludeDirs },
  260. propertyName: "export_include_dirs",
  261. snapshotDir: nativeGeneratedIncludeDir,
  262. copy: false,
  263. dirs: true,
  264. },
  265. {
  266. // ExportedGeneratedHeaders lists header files that are in one of the directories
  267. // specified in ExportedGeneratedIncludeDirs must be copied into the snapshot.
  268. // As they are in a directory in ExportedGeneratedIncludeDirs they do not need adding to a
  269. // property in the prebuilt module in the snapshot.
  270. pathsGetter: func(libInfo *nativeLibInfoProperties) android.Paths { return libInfo.ExportedGeneratedHeaders },
  271. propertyName: "",
  272. snapshotDir: nativeGeneratedIncludeDir,
  273. copy: true,
  274. dirs: false,
  275. },
  276. }
  277. // Add properties that may, or may not, be arch specific.
  278. func addPossiblyArchSpecificProperties(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, libInfo *nativeLibInfoProperties, outputProperties android.BpPropertySet) {
  279. outputProperties.AddProperty("sanitize", &libInfo.Sanitize)
  280. // Copy the generated library to the snapshot and add a reference to it in the .bp module.
  281. if libInfo.outputFile != nil {
  282. nativeLibraryPath := nativeLibraryPathFor(libInfo)
  283. builder.CopyToSnapshot(libInfo.outputFile, nativeLibraryPath)
  284. outputProperties.AddProperty("srcs", []string{nativeLibraryPath})
  285. }
  286. if len(libInfo.SharedLibs) > 0 {
  287. outputProperties.AddPropertyWithTag("shared_libs", libInfo.SharedLibs, builder.SdkMemberReferencePropertyTag(false))
  288. }
  289. // SystemSharedLibs needs to be propagated if it's a list, even if it's empty,
  290. // so check for non-nil instead of nonzero length.
  291. if libInfo.SystemSharedLibs != nil {
  292. outputProperties.AddPropertyWithTag("system_shared_libs", libInfo.SystemSharedLibs, builder.SdkMemberReferencePropertyTag(false))
  293. }
  294. // Map from property name to the include dirs to add to the prebuilt module in the snapshot.
  295. includeDirs := make(map[string][]string)
  296. // Iterate over each include directory property, copying files and collating property
  297. // values where necessary.
  298. for _, propertyInfo := range includeDirProperties {
  299. // Calculate the base directory in the snapshot into which the files will be copied.
  300. // lib.archSubDir is "" for common properties.
  301. targetDir := filepath.Join(libInfo.OsPrefix(), libInfo.archSubDir, propertyInfo.snapshotDir)
  302. propertyName := propertyInfo.propertyName
  303. // Iterate over each path in one of the include directory properties.
  304. for _, path := range propertyInfo.pathsGetter(libInfo) {
  305. inputPath := path.String()
  306. // Map the input path to a snapshot relative path. The mapping is independent of the module
  307. // that references them so that if multiple modules within the same snapshot export the same
  308. // header files they end up in the same place in the snapshot and so do not get duplicated.
  309. targetRelativePath := inputPath
  310. if isGeneratedHeaderDirectory(path) {
  311. // Remove everything up to the .intermediates/ from the generated output directory to
  312. // leave a module relative path.
  313. base := android.PathForIntermediates(sdkModuleContext, "")
  314. targetRelativePath = android.Rel(sdkModuleContext, base.String(), inputPath)
  315. }
  316. snapshotRelativePath := filepath.Join(targetDir, targetRelativePath)
  317. // Copy the files/directories when necessary.
  318. if propertyInfo.copy {
  319. if propertyInfo.dirs {
  320. // When copying a directory glob and copy all the headers within it.
  321. // TODO(jiyong) copy headers having other suffixes
  322. headers, _ := sdkModuleContext.GlobWithDeps(inputPath+"/**/*.h", nil)
  323. for _, file := range headers {
  324. src := android.PathForSource(sdkModuleContext, file)
  325. // The destination path in the snapshot is constructed from the snapshot relative path
  326. // of the input directory and the input directory relative path of the header file.
  327. inputRelativePath := android.Rel(sdkModuleContext, inputPath, file)
  328. dest := filepath.Join(snapshotRelativePath, inputRelativePath)
  329. builder.CopyToSnapshot(src, dest)
  330. }
  331. } else {
  332. // Otherwise, just copy the file to its snapshot relative path.
  333. builder.CopyToSnapshot(path, snapshotRelativePath)
  334. }
  335. }
  336. // Only directories are added to a property.
  337. if propertyInfo.dirs {
  338. includeDirs[propertyName] = append(includeDirs[propertyName], snapshotRelativePath)
  339. }
  340. }
  341. }
  342. // Add the collated include dir properties to the output.
  343. for _, property := range android.SortedKeys(includeDirs) {
  344. outputProperties.AddProperty(property, includeDirs[property])
  345. }
  346. if len(libInfo.StubsVersions) > 0 {
  347. stubsSet := outputProperties.AddPropertySet("stubs")
  348. stubsSet.AddProperty("versions", libInfo.StubsVersions)
  349. }
  350. }
  351. const (
  352. nativeIncludeDir = "include"
  353. nativeGeneratedIncludeDir = "include_gen"
  354. nativeStubDir = "lib"
  355. )
  356. // path to the native library. Relative to <sdk_root>/<api_dir>
  357. func nativeLibraryPathFor(lib *nativeLibInfoProperties) string {
  358. return filepath.Join(lib.OsPrefix(), lib.archSubDir,
  359. nativeStubDir, lib.outputFile.Base())
  360. }
  361. // nativeLibInfoProperties represents properties of a native lib
  362. //
  363. // The exported (capitalized) fields will be examined and may be changed during common value extraction.
  364. // The unexported fields will be left untouched.
  365. type nativeLibInfoProperties struct {
  366. android.SdkMemberPropertiesBase
  367. memberType *librarySdkMemberType
  368. // archSubDir is the subdirectory within the OS directory in the sdk snapshot into which arch
  369. // specific files will be copied.
  370. //
  371. // It is not exported since any value other than "" is always going to be arch specific.
  372. // This is "" for non-arch specific common properties.
  373. archSubDir string
  374. // The list of possibly common exported include dirs.
  375. //
  376. // This field is exported as its contents may not be arch specific.
  377. ExportedIncludeDirs android.Paths `android:"arch_variant"`
  378. // The list of arch specific exported generated include dirs.
  379. //
  380. // This field is exported as its contents may not be arch specific, e.g. protos.
  381. ExportedGeneratedIncludeDirs android.Paths `android:"arch_variant"`
  382. // The list of arch specific exported generated header files.
  383. //
  384. // This field is exported as its contents may not be arch specific, e.g. protos.
  385. ExportedGeneratedHeaders android.Paths `android:"arch_variant"`
  386. // The list of possibly common exported system include dirs.
  387. //
  388. // This field is exported as its contents may not be arch specific.
  389. ExportedSystemIncludeDirs android.Paths `android:"arch_variant"`
  390. // The list of possibly common exported flags.
  391. //
  392. // This field is exported as its contents may not be arch specific.
  393. ExportedFlags []string `android:"arch_variant"`
  394. // The set of shared libraries
  395. //
  396. // This field is exported as its contents may not be arch specific.
  397. SharedLibs []string `android:"arch_variant"`
  398. // The set of system shared libraries. Note nil and [] are semantically
  399. // distinct - see BaseLinkerProperties.System_shared_libs.
  400. //
  401. // This field is exported as its contents may not be arch specific.
  402. SystemSharedLibs []string `android:"arch_variant"`
  403. // The specific stubs version for the lib variant, or empty string if stubs
  404. // are not in use.
  405. //
  406. // Marked 'ignored-on-host' as the AllStubsVersions() from which this is
  407. // initialized is not set on host and the stubs.versions property which this
  408. // is written to does not vary by arch so cannot be android specific.
  409. StubsVersions []string `sdk:"ignored-on-host"`
  410. // Value of SanitizeProperties.Sanitize. Several - but not all - of these
  411. // affect the expanded variants. All are propagated to avoid entangling the
  412. // sanitizer logic with the snapshot generation.
  413. Sanitize SanitizeUserProps `android:"arch_variant"`
  414. // outputFile is not exported as it is always arch specific.
  415. outputFile android.Path
  416. }
  417. func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
  418. addOutputFile := true
  419. ccModule := variant.(*Module)
  420. if s := ccModule.sanitize; s != nil {
  421. // We currently do not capture sanitizer flags for libs with sanitizers
  422. // enabled, because they may vary among variants that cannot be represented
  423. // in the input blueprint files. In particular, sanitizerDepsMutator enables
  424. // various sanitizers on dependencies, but in many cases only on static
  425. // ones, and we cannot specify sanitizer flags at the link type level (i.e.
  426. // in StaticOrSharedProperties).
  427. if s.isUnsanitizedVariant() {
  428. // This still captures explicitly disabled sanitizers, which may be
  429. // necessary to avoid cyclic dependencies.
  430. p.Sanitize = s.Properties.Sanitize
  431. } else {
  432. // Do not add the output file to the snapshot if we don't represent it
  433. // properly.
  434. addOutputFile = false
  435. }
  436. }
  437. exportedInfo := ctx.SdkModuleContext().OtherModuleProvider(variant, FlagExporterInfoProvider).(FlagExporterInfo)
  438. // Separate out the generated include dirs (which are arch specific) from the
  439. // include dirs (which may not be).
  440. exportedIncludeDirs, exportedGeneratedIncludeDirs := android.FilterPathListPredicate(
  441. exportedInfo.IncludeDirs, isGeneratedHeaderDirectory)
  442. target := ccModule.Target()
  443. p.archSubDir = target.Arch.ArchType.String()
  444. if target.NativeBridge == android.NativeBridgeEnabled {
  445. p.archSubDir += "_native_bridge"
  446. }
  447. // Make sure that the include directories are unique.
  448. p.ExportedIncludeDirs = android.FirstUniquePaths(exportedIncludeDirs)
  449. p.ExportedGeneratedIncludeDirs = android.FirstUniquePaths(exportedGeneratedIncludeDirs)
  450. // Take a copy before filtering out duplicates to avoid changing the slice owned by the
  451. // ccModule.
  452. dirs := append(android.Paths(nil), exportedInfo.SystemIncludeDirs...)
  453. p.ExportedSystemIncludeDirs = android.FirstUniquePaths(dirs)
  454. p.ExportedFlags = exportedInfo.Flags
  455. if ccModule.linker != nil {
  456. specifiedDeps := specifiedDeps{}
  457. specifiedDeps = ccModule.linker.linkerSpecifiedDeps(specifiedDeps)
  458. if lib := ccModule.library; lib != nil {
  459. if !lib.hasStubsVariants() {
  460. // Propagate dynamic dependencies for implementation libs, but not stubs.
  461. p.SharedLibs = specifiedDeps.sharedLibs
  462. } else {
  463. // TODO(b/169373910): 1. Only output the specific version (from
  464. // ccModule.StubsVersion()) if the module is versioned. 2. Ensure that all
  465. // the versioned stub libs are retained in the prebuilt tree; currently only
  466. // the stub corresponding to ccModule.StubsVersion() is.
  467. p.StubsVersions = lib.allStubsVersions()
  468. }
  469. }
  470. p.SystemSharedLibs = specifiedDeps.systemSharedLibs
  471. }
  472. p.ExportedGeneratedHeaders = exportedInfo.GeneratedHeaders
  473. if !p.memberType.noOutputFiles && addOutputFile {
  474. p.outputFile = getRequiredMemberOutputFile(ctx, ccModule)
  475. }
  476. }
  477. func getRequiredMemberOutputFile(ctx android.SdkMemberContext, ccModule *Module) android.Path {
  478. var path android.Path
  479. outputFile := ccModule.OutputFile()
  480. if outputFile.Valid() {
  481. path = outputFile.Path()
  482. } else {
  483. ctx.SdkModuleContext().ModuleErrorf("member variant %s does not have a valid output file", ccModule)
  484. }
  485. return path
  486. }
  487. func (p *nativeLibInfoProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
  488. addPossiblyArchSpecificProperties(ctx.SdkModuleContext(), ctx.SnapshotBuilder(), p, propertySet)
  489. }