Merge "Add prebuilt_platform_compat_config" am: d5065cfc66
am: c5b7854036
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1642109 Change-Id: I85be48a0c65bc9caa2e2d4b7063ac41ec2581b6c
This commit is contained in:
commit
8185bd8586
|
@ -569,7 +569,7 @@ var (
|
|||
executableTag = dependencyTag{name: "executable", payload: true}
|
||||
fsTag = dependencyTag{name: "filesystem", payload: true}
|
||||
bootImageTag = dependencyTag{name: "bootImage", payload: true}
|
||||
compatConfigTag = dependencyTag{name: "compatConfig", payload: true}
|
||||
compatConfigTag = dependencyTag{name: "compatConfig", payload: true, sourceOnly: true}
|
||||
javaLibTag = dependencyTag{name: "javaLib", payload: true}
|
||||
jniLibTag = dependencyTag{name: "jniLib", payload: true}
|
||||
keyTag = dependencyTag{name: "key"}
|
||||
|
|
|
@ -6018,6 +6018,13 @@ func TestCompatConfig(t *testing.T) {
|
|||
system_modules: "none",
|
||||
apex_available: [ "myapex" ],
|
||||
}
|
||||
|
||||
// Make sure that a preferred prebuilt does not affect the apex contents.
|
||||
prebuilt_platform_compat_config {
|
||||
name: "myjar-platform-compat-config",
|
||||
metadata: "compat-config/metadata.xml",
|
||||
prefer: true,
|
||||
}
|
||||
`)
|
||||
ctx := result.TestContext
|
||||
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
|
||||
|
|
|
@ -26,6 +26,7 @@ func init() {
|
|||
func registerPlatformCompatConfigBuildComponents(ctx android.RegistrationContext) {
|
||||
ctx.RegisterSingletonType("platform_compat_config_singleton", platformCompatConfigSingletonFactory)
|
||||
ctx.RegisterModuleType("platform_compat_config", PlatformCompatConfigFactory)
|
||||
ctx.RegisterModuleType("prebuilt_platform_compat_config", prebuiltCompatConfigFactory)
|
||||
ctx.RegisterModuleType("global_compat_config", globalCompatConfigFactory)
|
||||
}
|
||||
|
||||
|
@ -116,6 +117,49 @@ func PlatformCompatConfigFactory() android.Module {
|
|||
return module
|
||||
}
|
||||
|
||||
// A prebuilt version of the platform compat config module.
|
||||
type prebuiltCompatConfigModule struct {
|
||||
android.ModuleBase
|
||||
android.SdkBase
|
||||
prebuilt android.Prebuilt
|
||||
|
||||
properties prebuiltCompatConfigProperties
|
||||
|
||||
metadataFile android.Path
|
||||
}
|
||||
|
||||
type prebuiltCompatConfigProperties struct {
|
||||
Metadata *string `android:"path"`
|
||||
}
|
||||
|
||||
func (module *prebuiltCompatConfigModule) Prebuilt() *android.Prebuilt {
|
||||
return &module.prebuilt
|
||||
}
|
||||
|
||||
func (module *prebuiltCompatConfigModule) Name() string {
|
||||
return module.prebuilt.Name(module.ModuleBase.Name())
|
||||
}
|
||||
|
||||
func (module *prebuiltCompatConfigModule) compatConfigMetadata() android.Path {
|
||||
return module.metadataFile
|
||||
}
|
||||
|
||||
var _ platformCompatConfigMetadataProvider = (*prebuiltCompatConfigModule)(nil)
|
||||
|
||||
func (module *prebuiltCompatConfigModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
module.metadataFile = module.prebuilt.SingleSourcePath(ctx)
|
||||
}
|
||||
|
||||
// A prebuilt version of platform_compat_config that provides the metadata.
|
||||
func prebuiltCompatConfigFactory() android.Module {
|
||||
m := &prebuiltCompatConfigModule{}
|
||||
m.AddProperties(&m.properties)
|
||||
android.InitSingleSourcePrebuiltModule(m, &m.properties, "Metadata")
|
||||
android.InitSdkAwareModule(m)
|
||||
android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon)
|
||||
return m
|
||||
}
|
||||
|
||||
// compat singleton rules
|
||||
type platformCompatConfigSingleton struct {
|
||||
metadata android.Path
|
||||
|
|
Loading…
Reference in New Issue