Merge "Generate image variation without version" into main

This commit is contained in:
Kiyoung Kim
2024-01-05 04:57:26 +00:00
committed by Gerrit Code Review
8 changed files with 127 additions and 45 deletions

View File

@@ -184,12 +184,12 @@ func (mod *Module) HasNonSystemVariants() bool {
}
func (mod *Module) InProduct() bool {
return mod.Properties.ImageVariationPrefix == cc.ProductVariationPrefix
return mod.Properties.ImageVariation == cc.ProductVariation
}
// Returns true if the module is "vendor" variant. Usually these modules are installed in /vendor
func (mod *Module) InVendor() bool {
return mod.Properties.ImageVariationPrefix == cc.VendorVariationPrefix
return mod.Properties.ImageVariation == cc.VendorVariation
}
func (mod *Module) SetImageVariation(ctx android.BaseModuleContext, variant string, module android.Module) {
@@ -198,9 +198,11 @@ func (mod *Module) SetImageVariation(ctx android.BaseModuleContext, variant stri
m.MakeAsPlatform()
} else if variant == android.RecoveryVariation {
m.MakeAsPlatform()
} else if strings.HasPrefix(variant, cc.VendorVariationPrefix) {
m.Properties.ImageVariationPrefix = cc.VendorVariationPrefix
m.Properties.VndkVersion = strings.TrimPrefix(variant, cc.VendorVariationPrefix)
} else if strings.HasPrefix(variant, cc.VendorVariation) {
m.Properties.ImageVariation = cc.VendorVariation
if strings.HasPrefix(variant, cc.VendorVariationPrefix) {
m.Properties.VndkVersion = strings.TrimPrefix(variant, cc.VendorVariationPrefix)
}
// Makefile shouldn't know vendor modules other than BOARD_VNDK_VERSION.
// Hide other vendor variants to avoid collision.
@@ -209,9 +211,11 @@ func (mod *Module) SetImageVariation(ctx android.BaseModuleContext, variant stri
m.Properties.HideFromMake = true
m.HideFromMake()
}
} else if strings.HasPrefix(variant, cc.ProductVariationPrefix) {
m.Properties.ImageVariationPrefix = cc.ProductVariationPrefix
m.Properties.VndkVersion = strings.TrimPrefix(variant, cc.ProductVariationPrefix)
} else if strings.HasPrefix(variant, cc.ProductVariation) {
m.Properties.ImageVariation = cc.ProductVariation
if strings.HasPrefix(variant, cc.ProductVariationPrefix) {
m.Properties.VndkVersion = strings.TrimPrefix(variant, cc.ProductVariationPrefix)
}
}
}

View File

@@ -20,6 +20,7 @@ import (
"android/soong/bloaty"
"android/soong/testing"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@@ -69,9 +70,9 @@ type BaseProperties struct {
AndroidMkProcMacroLibs []string `blueprint:"mutated"`
AndroidMkStaticLibs []string `blueprint:"mutated"`
ImageVariationPrefix string `blueprint:"mutated"`
VndkVersion string `blueprint:"mutated"`
SubName string `blueprint:"mutated"`
ImageVariation string `blueprint:"mutated"`
VndkVersion string `blueprint:"mutated"`
SubName string `blueprint:"mutated"`
// SubName is used by CC for tracking image variants / SDK versions. RustSubName is used for Rust-specific
// subnaming which shouldn't be visible to CC modules (such as the rlib stdlinkage subname). This should be