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
Merged-In: I2ab8f6aadb1440b325697cae4a8ed761c62d15d2
Change-Id: I2ab8f6aadb1440b325697cae4a8ed761c62d15d2
(cherry picked from commit cd07bce437
)
This commit is contained in:
parent
39978527ce
commit
fcb99e07fc
5 changed files with 80 additions and 7 deletions
|
@ -313,10 +313,11 @@ type SdkMemberType interface {
|
||||||
// SdkAware and be added with an SdkMemberTypeDependencyTag tag.
|
// SdkAware and be added with an SdkMemberTypeDependencyTag tag.
|
||||||
HasTransitiveSdkMembers() bool
|
HasTransitiveSdkMembers() bool
|
||||||
|
|
||||||
// Add dependencies from the SDK module to all the variants the member
|
// Add dependencies from the SDK module to all the module variants the member
|
||||||
// contributes to the SDK. The exact set of variants required is determined
|
// type contributes to the SDK. `names` is the list of module names given in
|
||||||
// by the SDK and its properties. The dependencies must be added with the
|
// the member type property (as returned by SdkPropertyName()) in the SDK
|
||||||
// supplied tag.
|
// module. The exact set of variants required is determined by the SDK and its
|
||||||
|
// properties. The dependencies must be added with the supplied tag.
|
||||||
//
|
//
|
||||||
// The BottomUpMutatorContext provided is for the SDK module.
|
// The BottomUpMutatorContext provided is for the SDK module.
|
||||||
AddDependencies(mctx BottomUpMutatorContext, dependencyTag blueprint.DependencyTag, names []string)
|
AddDependencies(mctx BottomUpMutatorContext, dependencyTag blueprint.DependencyTag, names []string)
|
||||||
|
|
|
@ -29,7 +29,7 @@ var headersLibrarySdkMemberType = &librarySdkMemberType{
|
||||||
SupportsSdk: true,
|
SupportsSdk: true,
|
||||||
},
|
},
|
||||||
prebuiltModuleType: "cc_prebuilt_library_headers",
|
prebuiltModuleType: "cc_prebuilt_library_headers",
|
||||||
linkTypes: nil,
|
noOutputFiles: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterLibraryHeadersBuildComponents(ctx android.RegistrationContext) {
|
func RegisterLibraryHeadersBuildComponents(ctx android.RegistrationContext) {
|
||||||
|
|
|
@ -18,6 +18,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
)
|
)
|
||||||
|
@ -63,7 +64,10 @@ type librarySdkMemberType struct {
|
||||||
|
|
||||||
prebuiltModuleType string
|
prebuiltModuleType string
|
||||||
|
|
||||||
// The set of link types supported, set of "static", "shared".
|
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.
|
||||||
linkTypes []string
|
linkTypes []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +341,7 @@ func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberConte
|
||||||
|
|
||||||
// If the library has some link types then it produces an output binary file, otherwise it
|
// If the library has some link types then it produces an output binary file, otherwise it
|
||||||
// is header only.
|
// is header only.
|
||||||
if p.memberType.linkTypes != nil {
|
if !p.memberType.noOutputFiles {
|
||||||
p.outputFile = ccModule.OutputFile().Path()
|
p.outputFile = ccModule.OutputFile().Path()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
11
cc/object.go
11
cc/object.go
|
@ -26,6 +26,16 @@ import (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
android.RegisterModuleType("cc_object", ObjectFactory)
|
android.RegisterModuleType("cc_object", ObjectFactory)
|
||||||
|
android.RegisterSdkMemberType(ccObjectSdkMemberType)
|
||||||
|
}
|
||||||
|
|
||||||
|
var ccObjectSdkMemberType = &librarySdkMemberType{
|
||||||
|
SdkMemberTypeBase: android.SdkMemberTypeBase{
|
||||||
|
PropertyName: "native_objects",
|
||||||
|
SupportsSdk: true,
|
||||||
|
},
|
||||||
|
prebuiltModuleType: "cc_prebuilt_object",
|
||||||
|
linkTypes: nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
type objectLinker struct {
|
type objectLinker struct {
|
||||||
|
@ -67,6 +77,7 @@ func ObjectFactory() android.Module {
|
||||||
// Clang's address-significance tables are incompatible with ld -r.
|
// Clang's address-significance tables are incompatible with ld -r.
|
||||||
module.compiler.appendCflags([]string{"-fno-addrsig"})
|
module.compiler.appendCflags([]string{"-fno-addrsig"})
|
||||||
|
|
||||||
|
module.sdkMemberTypes = []android.SdkMemberType{ccObjectSdkMemberType}
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -225,6 +225,63 @@ func TestSdkWithCc(t *testing.T) {
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSnapshotWithObject(t *testing.T) {
|
||||||
|
result := testSdkWithCc(t, `
|
||||||
|
sdk {
|
||||||
|
name: "mysdk",
|
||||||
|
native_objects: ["crtobj"],
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_object {
|
||||||
|
name: "crtobj",
|
||||||
|
stl: "none",
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
|
result.CheckSnapshot("mysdk", "",
|
||||||
|
checkAndroidBpContents(`
|
||||||
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
cc_prebuilt_object {
|
||||||
|
name: "mysdk_crtobj@current",
|
||||||
|
sdk_member_name: "crtobj",
|
||||||
|
stl: "none",
|
||||||
|
arch: {
|
||||||
|
arm64: {
|
||||||
|
srcs: ["arm64/lib/crtobj.o"],
|
||||||
|
},
|
||||||
|
arm: {
|
||||||
|
srcs: ["arm/lib/crtobj.o"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_prebuilt_object {
|
||||||
|
name: "crtobj",
|
||||||
|
prefer: false,
|
||||||
|
stl: "none",
|
||||||
|
arch: {
|
||||||
|
arm64: {
|
||||||
|
srcs: ["arm64/lib/crtobj.o"],
|
||||||
|
},
|
||||||
|
arm: {
|
||||||
|
srcs: ["arm/lib/crtobj.o"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
sdk_snapshot {
|
||||||
|
name: "mysdk@current",
|
||||||
|
native_objects: ["mysdk_crtobj@current"],
|
||||||
|
}
|
||||||
|
`),
|
||||||
|
checkAllCopyRules(`
|
||||||
|
.intermediates/crtobj/android_arm64_armv8-a/crtobj.o -> arm64/lib/crtobj.o
|
||||||
|
.intermediates/crtobj/android_arm_armv7-a-neon/crtobj.o -> arm/lib/crtobj.o
|
||||||
|
`),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
func TestSnapshotWithCcDuplicateHeaders(t *testing.T) {
|
func TestSnapshotWithCcDuplicateHeaders(t *testing.T) {
|
||||||
result := testSdkWithCc(t, `
|
result := testSdkWithCc(t, `
|
||||||
sdk {
|
sdk {
|
||||||
|
|
Loading…
Reference in a new issue