2019-12-13 11:40:56 +01:00
|
|
|
// Copyright 2019 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package cc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
|
|
|
|
|
|
|
"android/soong/android"
|
Add SDK member support for cc_object.
Test: m nothing
Test: Add
sdk {
name: "runtime-module-sdk",
native_shared_libs: [
"libc",
"libdl",
"libm",
"ld-android",
],
native_objects: [
"crtbegin_dynamic",
"crtbegin_static",
"crtend_android",
],
}
to bionic/apex/Android.bp. Then:
build/soong/scripts/build-aml-prebuilts.sh runtime-module-sdk
Take the generated runtime-module-sdk-current.zip and unzip into a
master-art tree without bionic/, edit the generated Android.bp to
extend cc_prebuilt_* modules with:
nocrt: true,
stl: "none",
system_shared_libs: [],
apex_available: ["//apex_available:anyapex"],
recovery_available: true,
vendor_available: true,
ramdisk_available: true,
Then "m com.android.art.debug". This passes Soong but fails in the
build step because more members are required.
Bug: 148934017
Change-Id: I2ab8f6aadb1440b325697cae4a8ed761c62d15d2
2020-03-10 23:37:59 +01:00
|
|
|
|
2019-12-13 11:40:56 +01:00
|
|
|
"github.com/google/blueprint"
|
2020-03-06 13:30:43 +01:00
|
|
|
"github.com/google/blueprint/proptools"
|
2019-12-13 11:40:56 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// This file contains support for using cc library modules within an sdk.
|
|
|
|
|
2019-12-13 20:50:38 +01:00
|
|
|
var sharedLibrarySdkMemberType = &librarySdkMemberType{
|
|
|
|
SdkMemberTypeBase: android.SdkMemberTypeBase{
|
|
|
|
PropertyName: "native_shared_libs",
|
2019-12-16 18:43:48 +01:00
|
|
|
SupportsSdk: true,
|
2019-12-13 20:50:38 +01:00
|
|
|
},
|
|
|
|
prebuiltModuleType: "cc_prebuilt_library_shared",
|
|
|
|
linkTypes: []string{"shared"},
|
|
|
|
}
|
|
|
|
|
|
|
|
var staticLibrarySdkMemberType = &librarySdkMemberType{
|
|
|
|
SdkMemberTypeBase: android.SdkMemberTypeBase{
|
|
|
|
PropertyName: "native_static_libs",
|
2019-12-16 18:43:48 +01:00
|
|
|
SupportsSdk: true,
|
2019-12-13 20:50:38 +01:00
|
|
|
},
|
|
|
|
prebuiltModuleType: "cc_prebuilt_library_static",
|
|
|
|
linkTypes: []string{"static"},
|
|
|
|
}
|
|
|
|
|
2020-03-12 11:24:35 +01:00
|
|
|
var staticAndSharedLibrarySdkMemberType = &librarySdkMemberType{
|
|
|
|
SdkMemberTypeBase: android.SdkMemberTypeBase{
|
|
|
|
PropertyName: "native_libs",
|
|
|
|
SupportsSdk: true,
|
|
|
|
},
|
|
|
|
prebuiltModuleType: "cc_prebuilt_library",
|
|
|
|
linkTypes: []string{"static", "shared"},
|
|
|
|
}
|
|
|
|
|
2019-12-13 12:22:16 +01:00
|
|
|
func init() {
|
|
|
|
// Register sdk member types.
|
2019-12-13 20:50:38 +01:00
|
|
|
android.RegisterSdkMemberType(sharedLibrarySdkMemberType)
|
|
|
|
android.RegisterSdkMemberType(staticLibrarySdkMemberType)
|
2020-03-12 11:24:35 +01:00
|
|
|
android.RegisterSdkMemberType(staticAndSharedLibrarySdkMemberType)
|
2019-12-13 11:40:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type librarySdkMemberType struct {
|
2019-12-13 12:22:16 +01:00
|
|
|
android.SdkMemberTypeBase
|
|
|
|
|
2019-12-13 11:40:56 +01:00
|
|
|
prebuiltModuleType string
|
|
|
|
|
Add SDK member support for cc_object.
Test: m nothing
Test: Add
sdk {
name: "runtime-module-sdk",
native_shared_libs: [
"libc",
"libdl",
"libm",
"ld-android",
],
native_objects: [
"crtbegin_dynamic",
"crtbegin_static",
"crtend_android",
],
}
to bionic/apex/Android.bp. Then:
build/soong/scripts/build-aml-prebuilts.sh runtime-module-sdk
Take the generated runtime-module-sdk-current.zip and unzip into a
master-art tree without bionic/, edit the generated Android.bp to
extend cc_prebuilt_* modules with:
nocrt: true,
stl: "none",
system_shared_libs: [],
apex_available: ["//apex_available:anyapex"],
recovery_available: true,
vendor_available: true,
ramdisk_available: true,
Then "m com.android.art.debug". This passes Soong but fails in the
build step because more members are required.
Bug: 148934017
Change-Id: I2ab8f6aadb1440b325697cae4a8ed761c62d15d2
2020-03-10 23:37:59 +01:00
|
|
|
noOutputFiles bool // True if there are no srcs files.
|
|
|
|
|
|
|
|
// The set of link types supported. A set of "static", "shared", or nil to
|
|
|
|
// skip link type variations.
|
2019-12-13 11:40:56 +01:00
|
|
|
linkTypes []string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mt *librarySdkMemberType) AddDependencies(mctx android.BottomUpMutatorContext, dependencyTag blueprint.DependencyTag, names []string) {
|
|
|
|
targets := mctx.MultiTargets()
|
|
|
|
for _, lib := range names {
|
|
|
|
for _, target := range targets {
|
|
|
|
name, version := StubsLibNameAndVersion(lib)
|
|
|
|
if version == "" {
|
|
|
|
version = LatestStubsVersionFor(mctx.Config(), name)
|
|
|
|
}
|
2020-02-21 17:29:57 +01:00
|
|
|
if mt.linkTypes == nil {
|
2019-12-13 11:40:56 +01:00
|
|
|
mctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{
|
|
|
|
{Mutator: "image", Variation: android.CoreVariation},
|
|
|
|
{Mutator: "version", Variation: version},
|
|
|
|
}...), dependencyTag, name)
|
2020-02-21 17:29:57 +01:00
|
|
|
} else {
|
|
|
|
for _, linkType := range mt.linkTypes {
|
|
|
|
mctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{
|
|
|
|
{Mutator: "image", Variation: android.CoreVariation},
|
|
|
|
{Mutator: "link", Variation: linkType},
|
|
|
|
{Mutator: "version", Variation: version},
|
|
|
|
}...), dependencyTag, name)
|
|
|
|
}
|
2019-12-13 11:40:56 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mt *librarySdkMemberType) IsInstance(module android.Module) bool {
|
2019-12-13 20:50:38 +01:00
|
|
|
// Check the module to see if it can be used with this module type.
|
|
|
|
if m, ok := module.(*Module); ok {
|
|
|
|
for _, allowableMemberType := range m.sdkMemberTypes {
|
|
|
|
if allowableMemberType == mt {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
2019-12-13 11:40:56 +01:00
|
|
|
}
|
|
|
|
|
2020-03-19 17:11:18 +01:00
|
|
|
func (mt *librarySdkMemberType) AddPrebuiltModule(ctx android.SdkMemberContext, member android.SdkMember) android.BpModule {
|
|
|
|
pbm := ctx.SnapshotBuilder().AddPrebuiltModule(member, mt.prebuiltModuleType)
|
2020-03-05 15:09:58 +01:00
|
|
|
|
|
|
|
ccModule := member.Variants()[0].(*Module)
|
|
|
|
|
|
|
|
sdkVersion := ccModule.SdkVersion()
|
|
|
|
if sdkVersion != "" {
|
|
|
|
pbm.AddProperty("sdk_version", sdkVersion)
|
|
|
|
}
|
2019-12-13 11:40:56 +01:00
|
|
|
|
2020-03-06 13:30:43 +01:00
|
|
|
stl := ccModule.stl.Properties.Stl
|
|
|
|
if stl != nil {
|
2020-03-11 19:42:08 +01:00
|
|
|
pbm.AddProperty("stl", proptools.String(stl))
|
2020-03-06 13:30:43 +01:00
|
|
|
}
|
2020-06-17 23:52:25 +02:00
|
|
|
|
|
|
|
if lib, ok := ccModule.linker.(*libraryDecorator); ok {
|
|
|
|
uhs := lib.Properties.Unique_host_soname
|
|
|
|
if uhs != nil {
|
|
|
|
pbm.AddProperty("unique_host_soname", proptools.Bool(uhs))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-11 19:42:08 +01:00
|
|
|
return pbm
|
2020-02-27 17:00:53 +01:00
|
|
|
}
|
2019-12-13 11:40:56 +01:00
|
|
|
|
2020-02-27 17:00:53 +01:00
|
|
|
func (mt *librarySdkMemberType) CreateVariantPropertiesStruct() android.SdkMemberProperties {
|
|
|
|
return &nativeLibInfoProperties{memberType: mt}
|
2019-12-13 11:40:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func isGeneratedHeaderDirectory(p android.Path) bool {
|
|
|
|
_, gen := p.(android.WritablePath)
|
|
|
|
return gen
|
|
|
|
}
|
|
|
|
|
2020-02-20 15:33:54 +01:00
|
|
|
type includeDirsProperty struct {
|
|
|
|
// Accessor to retrieve the paths
|
2020-02-27 17:00:53 +01:00
|
|
|
pathsGetter func(libInfo *nativeLibInfoProperties) android.Paths
|
2020-02-20 15:33:54 +01:00
|
|
|
|
|
|
|
// The name of the property in the prebuilt library, "" means there is no property.
|
|
|
|
propertyName string
|
|
|
|
|
|
|
|
// The directory within the snapshot directory into which items should be copied.
|
|
|
|
snapshotDir string
|
|
|
|
|
|
|
|
// True if the items on the path should be copied.
|
|
|
|
copy bool
|
|
|
|
|
|
|
|
// True if the paths represent directories, files if they represent files.
|
|
|
|
dirs bool
|
2020-01-23 12:45:03 +01:00
|
|
|
}
|
|
|
|
|
2020-02-20 15:33:54 +01:00
|
|
|
var includeDirProperties = []includeDirsProperty{
|
|
|
|
{
|
|
|
|
// ExportedIncludeDirs lists directories that contains some header files to be
|
|
|
|
// copied into a directory in the snapshot. The snapshot directories must be added to
|
|
|
|
// the export_include_dirs property in the prebuilt module in the snapshot.
|
2020-02-27 17:00:53 +01:00
|
|
|
pathsGetter: func(libInfo *nativeLibInfoProperties) android.Paths { return libInfo.ExportedIncludeDirs },
|
2020-02-20 15:33:54 +01:00
|
|
|
propertyName: "export_include_dirs",
|
|
|
|
snapshotDir: nativeIncludeDir,
|
|
|
|
copy: true,
|
|
|
|
dirs: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// ExportedSystemIncludeDirs lists directories that contains some system header files to
|
|
|
|
// be copied into a directory in the snapshot. The snapshot directories must be added to
|
|
|
|
// the export_system_include_dirs property in the prebuilt module in the snapshot.
|
2020-02-27 17:00:53 +01:00
|
|
|
pathsGetter: func(libInfo *nativeLibInfoProperties) android.Paths { return libInfo.ExportedSystemIncludeDirs },
|
2020-02-20 15:33:54 +01:00
|
|
|
propertyName: "export_system_include_dirs",
|
|
|
|
snapshotDir: nativeIncludeDir,
|
|
|
|
copy: true,
|
|
|
|
dirs: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// exportedGeneratedIncludeDirs lists directories that contains some header files
|
|
|
|
// that are explicitly listed in the exportedGeneratedHeaders property. So, the contents
|
|
|
|
// of these directories do not need to be copied, but these directories do need adding to
|
|
|
|
// the export_include_dirs property in the prebuilt module in the snapshot.
|
2020-02-27 17:00:53 +01:00
|
|
|
pathsGetter: func(libInfo *nativeLibInfoProperties) android.Paths { return libInfo.exportedGeneratedIncludeDirs },
|
2020-02-20 15:33:54 +01:00
|
|
|
propertyName: "export_include_dirs",
|
|
|
|
snapshotDir: nativeGeneratedIncludeDir,
|
|
|
|
copy: false,
|
|
|
|
dirs: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// exportedGeneratedHeaders lists header files that are in one of the directories
|
|
|
|
// specified in exportedGeneratedIncludeDirs must be copied into the snapshot.
|
|
|
|
// As they are in a directory in exportedGeneratedIncludeDirs they do not need adding to a
|
|
|
|
// property in the prebuilt module in the snapshot.
|
2020-02-27 17:00:53 +01:00
|
|
|
pathsGetter: func(libInfo *nativeLibInfoProperties) android.Paths { return libInfo.exportedGeneratedHeaders },
|
2020-02-20 15:33:54 +01:00
|
|
|
propertyName: "",
|
|
|
|
snapshotDir: nativeGeneratedIncludeDir,
|
|
|
|
copy: true,
|
|
|
|
dirs: false,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add properties that may, or may not, be arch specific.
|
2020-02-27 17:00:53 +01:00
|
|
|
func addPossiblyArchSpecificProperties(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, libInfo *nativeLibInfoProperties, outputProperties android.BpPropertySet) {
|
|
|
|
|
|
|
|
// Copy the generated library to the snapshot and add a reference to it in the .bp module.
|
|
|
|
if libInfo.outputFile != nil {
|
|
|
|
nativeLibraryPath := nativeLibraryPathFor(libInfo)
|
|
|
|
builder.CopyToSnapshot(libInfo.outputFile, nativeLibraryPath)
|
|
|
|
outputProperties.AddProperty("srcs", []string{nativeLibraryPath})
|
|
|
|
}
|
2020-02-20 15:33:54 +01:00
|
|
|
|
2020-03-06 13:30:43 +01:00
|
|
|
if len(libInfo.SharedLibs) > 0 {
|
|
|
|
outputProperties.AddPropertyWithTag("shared_libs", libInfo.SharedLibs, builder.SdkMemberReferencePropertyTag(false))
|
|
|
|
}
|
|
|
|
|
2020-03-24 02:19:52 +01:00
|
|
|
// SystemSharedLibs needs to be propagated if it's a list, even if it's empty,
|
|
|
|
// so check for non-nil instead of nonzero length.
|
|
|
|
if libInfo.SystemSharedLibs != nil {
|
2020-03-06 13:30:43 +01:00
|
|
|
outputProperties.AddPropertyWithTag("system_shared_libs", libInfo.SystemSharedLibs, builder.SdkMemberReferencePropertyTag(false))
|
|
|
|
}
|
|
|
|
|
2020-02-20 15:33:54 +01:00
|
|
|
// Map from property name to the include dirs to add to the prebuilt module in the snapshot.
|
|
|
|
includeDirs := make(map[string][]string)
|
|
|
|
|
|
|
|
// Iterate over each include directory property, copying files and collating property
|
|
|
|
// values where necessary.
|
|
|
|
for _, propertyInfo := range includeDirProperties {
|
|
|
|
// Calculate the base directory in the snapshot into which the files will be copied.
|
|
|
|
// lib.ArchType is "" for common properties.
|
|
|
|
targetDir := filepath.Join(libInfo.archType, propertyInfo.snapshotDir)
|
|
|
|
|
|
|
|
propertyName := propertyInfo.propertyName
|
|
|
|
|
|
|
|
// Iterate over each path in one of the include directory properties.
|
|
|
|
for _, path := range propertyInfo.pathsGetter(libInfo) {
|
|
|
|
|
|
|
|
// Copy the files/directories when necessary.
|
|
|
|
if propertyInfo.copy {
|
|
|
|
if propertyInfo.dirs {
|
|
|
|
// When copying a directory glob and copy all the headers within it.
|
|
|
|
// TODO(jiyong) copy headers having other suffixes
|
|
|
|
headers, _ := sdkModuleContext.GlobWithDeps(path.String()+"/**/*.h", nil)
|
|
|
|
for _, file := range headers {
|
|
|
|
src := android.PathForSource(sdkModuleContext, file)
|
|
|
|
dest := filepath.Join(targetDir, file)
|
|
|
|
builder.CopyToSnapshot(src, dest)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Otherwise, just copy the files.
|
|
|
|
dest := filepath.Join(targetDir, libInfo.name, path.Rel())
|
|
|
|
builder.CopyToSnapshot(path, dest)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Only directories are added to a property.
|
|
|
|
if propertyInfo.dirs {
|
|
|
|
var snapshotPath string
|
|
|
|
if isGeneratedHeaderDirectory(path) {
|
|
|
|
snapshotPath = filepath.Join(targetDir, libInfo.name)
|
|
|
|
} else {
|
|
|
|
snapshotPath = filepath.Join(targetDir, path.String())
|
|
|
|
}
|
|
|
|
|
|
|
|
includeDirs[propertyName] = append(includeDirs[propertyName], snapshotPath)
|
|
|
|
}
|
|
|
|
}
|
2020-01-23 12:45:03 +01:00
|
|
|
}
|
2020-02-20 15:33:54 +01:00
|
|
|
|
|
|
|
// Add the collated include dir properties to the output.
|
|
|
|
for property, dirs := range includeDirs {
|
|
|
|
outputProperties.AddProperty(property, dirs)
|
2020-01-23 12:45:03 +01:00
|
|
|
}
|
2020-04-01 21:38:01 +02:00
|
|
|
|
|
|
|
if len(libInfo.StubsVersion) > 0 {
|
|
|
|
stubsSet := outputProperties.AddPropertySet("stubs")
|
|
|
|
stubsSet.AddProperty("versions", []string{libInfo.StubsVersion})
|
|
|
|
}
|
2020-01-23 12:45:03 +01:00
|
|
|
}
|
|
|
|
|
2019-12-13 11:40:56 +01:00
|
|
|
const (
|
|
|
|
nativeIncludeDir = "include"
|
|
|
|
nativeGeneratedIncludeDir = "include_gen"
|
|
|
|
nativeStubDir = "lib"
|
|
|
|
)
|
|
|
|
|
|
|
|
// path to the native library. Relative to <sdk_root>/<api_dir>
|
2020-02-27 17:00:53 +01:00
|
|
|
func nativeLibraryPathFor(lib *nativeLibInfoProperties) string {
|
2020-03-02 11:16:35 +01:00
|
|
|
return filepath.Join(lib.OsPrefix(), lib.archType,
|
2019-12-13 11:40:56 +01:00
|
|
|
nativeStubDir, lib.outputFile.Base())
|
|
|
|
}
|
|
|
|
|
|
|
|
// nativeLibInfoProperties represents properties of a native lib
|
|
|
|
//
|
|
|
|
// The exported (capitalized) fields will be examined and may be changed during common value extraction.
|
|
|
|
// The unexported fields will be left untouched.
|
|
|
|
type nativeLibInfoProperties struct {
|
2020-02-27 17:00:53 +01:00
|
|
|
android.SdkMemberPropertiesBase
|
|
|
|
|
|
|
|
memberType *librarySdkMemberType
|
|
|
|
|
2019-12-13 11:40:56 +01:00
|
|
|
// The name of the library, is not exported as this must not be changed during optimization.
|
|
|
|
name string
|
|
|
|
|
|
|
|
// archType is not exported as if set (to a non default value) it is always arch specific.
|
|
|
|
// This is "" for common properties.
|
|
|
|
archType string
|
|
|
|
|
2020-02-20 15:33:54 +01:00
|
|
|
// The list of possibly common exported include dirs.
|
|
|
|
//
|
|
|
|
// This field is exported as its contents may not be arch specific.
|
2020-05-06 11:23:19 +02:00
|
|
|
ExportedIncludeDirs android.Paths `android:"arch_variant"`
|
2019-12-13 11:40:56 +01:00
|
|
|
|
2020-02-20 15:33:54 +01:00
|
|
|
// The list of arch specific exported generated include dirs.
|
|
|
|
//
|
|
|
|
// This field is not exported as its contents are always arch specific.
|
|
|
|
exportedGeneratedIncludeDirs android.Paths
|
|
|
|
|
|
|
|
// The list of arch specific exported generated header files.
|
|
|
|
//
|
|
|
|
// This field is not exported as its contents are is always arch specific.
|
2019-12-13 11:40:56 +01:00
|
|
|
exportedGeneratedHeaders android.Paths
|
|
|
|
|
2020-02-20 15:33:54 +01:00
|
|
|
// The list of possibly common exported system include dirs.
|
|
|
|
//
|
|
|
|
// This field is exported as its contents may not be arch specific.
|
2020-05-06 11:23:19 +02:00
|
|
|
ExportedSystemIncludeDirs android.Paths `android:"arch_variant"`
|
2020-02-20 15:33:54 +01:00
|
|
|
|
|
|
|
// The list of possibly common exported flags.
|
|
|
|
//
|
|
|
|
// This field is exported as its contents may not be arch specific.
|
2020-05-06 11:23:19 +02:00
|
|
|
ExportedFlags []string `android:"arch_variant"`
|
2020-02-20 15:33:54 +01:00
|
|
|
|
2020-03-06 13:30:43 +01:00
|
|
|
// The set of shared libraries
|
|
|
|
//
|
|
|
|
// This field is exported as its contents may not be arch specific.
|
2020-05-06 11:23:19 +02:00
|
|
|
SharedLibs []string `android:"arch_variant"`
|
2020-03-06 13:30:43 +01:00
|
|
|
|
2020-03-24 02:19:52 +01:00
|
|
|
// The set of system shared libraries. Note nil and [] are semantically
|
|
|
|
// distinct - see BaseLinkerProperties.System_shared_libs.
|
2020-03-06 13:30:43 +01:00
|
|
|
//
|
|
|
|
// This field is exported as its contents may not be arch specific.
|
2020-05-06 11:23:19 +02:00
|
|
|
SystemSharedLibs []string `android:"arch_variant"`
|
2020-03-06 13:30:43 +01:00
|
|
|
|
2020-04-01 21:38:01 +02:00
|
|
|
// The specific stubs version for the lib variant, or empty string if stubs
|
|
|
|
// are not in use.
|
2020-05-04 16:32:08 +02:00
|
|
|
//
|
|
|
|
// Marked 'ignored-on-host' as the StubsVersion() from which this is initialized is
|
|
|
|
// not set on host and the stubs.versions property which this is written to is does
|
|
|
|
// not vary by arch so cannot be android specific.
|
|
|
|
StubsVersion string `sdk:"ignored-on-host"`
|
2020-04-01 21:38:01 +02:00
|
|
|
|
2019-12-13 11:40:56 +01:00
|
|
|
// outputFile is not exported as it is always arch specific.
|
|
|
|
outputFile android.Path
|
|
|
|
}
|
|
|
|
|
2020-03-19 17:11:18 +01:00
|
|
|
func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
|
2020-02-27 17:00:53 +01:00
|
|
|
ccModule := variant.(*Module)
|
|
|
|
|
|
|
|
// If the library has some link types then it produces an output binary file, otherwise it
|
|
|
|
// is header only.
|
Add SDK member support for cc_object.
Test: m nothing
Test: Add
sdk {
name: "runtime-module-sdk",
native_shared_libs: [
"libc",
"libdl",
"libm",
"ld-android",
],
native_objects: [
"crtbegin_dynamic",
"crtbegin_static",
"crtend_android",
],
}
to bionic/apex/Android.bp. Then:
build/soong/scripts/build-aml-prebuilts.sh runtime-module-sdk
Take the generated runtime-module-sdk-current.zip and unzip into a
master-art tree without bionic/, edit the generated Android.bp to
extend cc_prebuilt_* modules with:
nocrt: true,
stl: "none",
system_shared_libs: [],
apex_available: ["//apex_available:anyapex"],
recovery_available: true,
vendor_available: true,
ramdisk_available: true,
Then "m com.android.art.debug". This passes Soong but fails in the
build step because more members are required.
Bug: 148934017
Change-Id: I2ab8f6aadb1440b325697cae4a8ed761c62d15d2
2020-03-10 23:37:59 +01:00
|
|
|
if !p.memberType.noOutputFiles {
|
2020-05-05 15:11:57 +02:00
|
|
|
p.outputFile = getRequiredMemberOutputFile(ctx, ccModule)
|
2020-02-27 17:00:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Separate out the generated include dirs (which are arch specific) from the
|
|
|
|
// include dirs (which may not be).
|
|
|
|
exportedIncludeDirs, exportedGeneratedIncludeDirs := android.FilterPathListPredicate(
|
|
|
|
ccModule.ExportedIncludeDirs(), isGeneratedHeaderDirectory)
|
|
|
|
|
|
|
|
p.name = variant.Name()
|
|
|
|
p.archType = ccModule.Target().Arch.ArchType.String()
|
2020-03-12 11:24:35 +01:00
|
|
|
|
|
|
|
// Make sure that the include directories are unique.
|
|
|
|
p.ExportedIncludeDirs = android.FirstUniquePaths(exportedIncludeDirs)
|
|
|
|
p.exportedGeneratedIncludeDirs = android.FirstUniquePaths(exportedGeneratedIncludeDirs)
|
|
|
|
p.ExportedSystemIncludeDirs = android.FirstUniquePaths(ccModule.ExportedSystemIncludeDirs())
|
|
|
|
|
2020-02-27 17:00:53 +01:00
|
|
|
p.ExportedFlags = ccModule.ExportedFlags()
|
2020-03-06 13:30:43 +01:00
|
|
|
if ccModule.linker != nil {
|
|
|
|
specifiedDeps := specifiedDeps{}
|
|
|
|
specifiedDeps = ccModule.linker.linkerSpecifiedDeps(specifiedDeps)
|
|
|
|
|
2020-04-21 21:45:35 +02:00
|
|
|
if !ccModule.HasStubsVariants() {
|
|
|
|
// Propagate dynamic dependencies for implementation libs, but not stubs.
|
|
|
|
p.SharedLibs = specifiedDeps.sharedLibs
|
|
|
|
}
|
2020-03-06 13:30:43 +01:00
|
|
|
p.SystemSharedLibs = specifiedDeps.systemSharedLibs
|
|
|
|
}
|
2020-02-27 17:00:53 +01:00
|
|
|
p.exportedGeneratedHeaders = ccModule.ExportedGeneratedHeaders()
|
2020-04-01 21:38:01 +02:00
|
|
|
|
|
|
|
if ccModule.HasStubsVariants() {
|
|
|
|
p.StubsVersion = ccModule.StubsVersion()
|
|
|
|
}
|
2020-02-27 17:00:53 +01:00
|
|
|
}
|
|
|
|
|
2020-05-05 15:11:57 +02:00
|
|
|
func getRequiredMemberOutputFile(ctx android.SdkMemberContext, ccModule *Module) android.Path {
|
|
|
|
var path android.Path
|
|
|
|
outputFile := ccModule.OutputFile()
|
|
|
|
if outputFile.Valid() {
|
|
|
|
path = outputFile.Path()
|
|
|
|
} else {
|
|
|
|
ctx.SdkModuleContext().ModuleErrorf("member variant %s does not have a valid output file", ccModule)
|
|
|
|
}
|
|
|
|
return path
|
|
|
|
}
|
|
|
|
|
2020-03-19 17:11:18 +01:00
|
|
|
func (p *nativeLibInfoProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
|
|
|
|
addPossiblyArchSpecificProperties(ctx.SdkModuleContext(), ctx.SnapshotBuilder(), p, propertySet)
|
2019-12-13 11:40:56 +01:00
|
|
|
}
|