Support NDK variant of cc_api_variant
Update cc build logic to support NDK variant of cc_api_variant. Any cc_api_library with NDK variant of cc_api_variant would be treated as similar with NDK library. Bug: 259007436 Test: Cuttlefish vendor build succeeded Change-Id: I75a7475f4fdcbac779f5aa64e76c60f94ea7ea1a
This commit is contained in:
33
cc/sdk.go
33
cc/sdk.go
@@ -31,6 +31,7 @@ func sdkMutator(ctx android.BottomUpMutatorContext) {
|
||||
|
||||
switch m := ctx.Module().(type) {
|
||||
case LinkableInterface:
|
||||
ccModule, isCcModule := ctx.Module().(*Module)
|
||||
if m.AlwaysSdk() {
|
||||
if !m.UseSdk() && !m.SplitPerApiLevel() {
|
||||
ctx.ModuleErrorf("UseSdk() must return true when AlwaysSdk is set, did the factory forget to set Sdk_version?")
|
||||
@@ -58,11 +59,32 @@ func sdkMutator(ctx android.BottomUpMutatorContext) {
|
||||
modules[1].(*Module).Properties.PreventInstall = true
|
||||
}
|
||||
ctx.AliasVariation("")
|
||||
} else if isCcModule && ccModule.isImportedApiLibrary() {
|
||||
apiLibrary, _ := ccModule.linker.(*apiLibraryDecorator)
|
||||
if apiLibrary.hasNDKStubs() && ccModule.canUseSdk() {
|
||||
// Handle cc_api_library module with NDK stubs and variants only which can use SDK
|
||||
modules := ctx.CreateVariations("", "sdk")
|
||||
modules[1].(*Module).Properties.IsSdkVariant = true
|
||||
if ctx.Config().UnbundledBuildApps() {
|
||||
// For an unbundled apps build, hide the platform variant from Make.
|
||||
modules[0].(*Module).Properties.HideFromMake = true
|
||||
modules[0].(*Module).Properties.PreventInstall = true
|
||||
} else {
|
||||
// For a platform build, mark the SDK variant so that it gets a ".sdk" suffix when
|
||||
// exposed to Make.
|
||||
modules[1].(*Module).Properties.SdkAndPlatformVariantVisibleToMake = true
|
||||
modules[1].(*Module).Properties.PreventInstall = true
|
||||
}
|
||||
} else {
|
||||
ccModule.Properties.Sdk_version = nil
|
||||
ctx.CreateVariations("")
|
||||
ctx.AliasVariation("")
|
||||
}
|
||||
} else {
|
||||
if m, ok := ctx.Module().(*Module); ok {
|
||||
if isCcModule {
|
||||
// Clear the sdk_version property for modules that don't have an SDK variant so
|
||||
// later code doesn't get confused by it.
|
||||
m.Properties.Sdk_version = nil
|
||||
ccModule.Properties.Sdk_version = nil
|
||||
}
|
||||
ctx.CreateVariations("")
|
||||
ctx.AliasVariation("")
|
||||
@@ -79,6 +101,11 @@ func sdkMutator(ctx android.BottomUpMutatorContext) {
|
||||
case *snapshotModule:
|
||||
ctx.CreateVariations("")
|
||||
case *CcApiVariant:
|
||||
ctx.CreateVariations("")
|
||||
ccApiVariant, _ := ctx.Module().(*CcApiVariant)
|
||||
if String(ccApiVariant.properties.Variant) == "ndk" {
|
||||
ctx.CreateVariations("sdk")
|
||||
} else {
|
||||
ctx.CreateVariations("")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user