Merge "Export any platform_compat_config used by apex to sdk snapshot" am: 69d09f49ec am: fa26f65155

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2160797

Change-Id: I0d76be94940191a58dcfbb01a4d7b4fd80cfb54c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Paul Duffin 2022-07-21 22:58:04 +00:00 committed by Automerger Merge Worker
commit 4dcb86de2c
3 changed files with 37 additions and 14 deletions

View file

@ -640,7 +640,7 @@ var (
fsTag = &dependencyTag{name: "filesystem", payload: true}
bcpfTag = &dependencyTag{name: "bootclasspathFragment", payload: true, sourceOnly: true, memberType: java.BootclasspathFragmentSdkMemberType}
sscpfTag = &dependencyTag{name: "systemserverclasspathFragment", payload: true, sourceOnly: true, memberType: java.SystemServerClasspathFragmentSdkMemberType}
compatConfigTag = &dependencyTag{name: "compatConfig", payload: true, sourceOnly: true}
compatConfigTag = &dependencyTag{name: "compatConfig", payload: true, sourceOnly: true, memberType: java.CompatConfigSdkMemberType}
javaLibTag = &dependencyTag{name: "javaLib", payload: true}
jniLibTag = &dependencyTag{name: "jniLib", payload: true}
keyTag = &dependencyTag{name: "key"}

View file

@ -26,12 +26,14 @@ import (
func init() {
registerPlatformCompatConfigBuildComponents(android.InitRegistrationContext)
android.RegisterSdkMemberType(&compatConfigMemberType{
SdkMemberTypeBase: android.SdkMemberTypeBase{
PropertyName: "compat_configs",
SupportsSdk: true,
},
})
android.RegisterSdkMemberType(CompatConfigSdkMemberType)
}
var CompatConfigSdkMemberType = &compatConfigMemberType{
SdkMemberTypeBase: android.SdkMemberTypeBase{
PropertyName: "compat_configs",
SupportsSdk: true,
},
}
func registerPlatformCompatConfigBuildComponents(ctx android.RegistrationContext) {

View file

@ -21,16 +21,12 @@ import (
"android/soong/java"
)
func TestSnapshotWithCompatConfig(t *testing.T) {
func testSnapshotWithCompatConfig(t *testing.T, sdk string) {
result := android.GroupFixturePreparers(
prepareForSdkTestWithJava,
java.PrepareForTestWithPlatformCompatConfig,
).RunTestWithBp(t, `
sdk {
name: "mysdk",
compat_configs: ["myconfig"],
}
prepareForSdkTestWithApex,
).RunTestWithBp(t, sdk+`
platform_compat_config {
name: "myconfig",
}
@ -73,3 +69,28 @@ prebuilt_platform_compat_config {
}),
)
}
func TestSnapshotWithCompatConfig(t *testing.T) {
testSnapshotWithCompatConfig(t, `
sdk {
name: "mysdk",
compat_configs: ["myconfig"],
}
`)
}
func TestSnapshotWithCompatConfig_Apex(t *testing.T) {
testSnapshotWithCompatConfig(t, `
apex {
name: "myapex",
key: "myapex.key",
min_sdk_version: "2",
compat_configs: ["myconfig"],
}
sdk {
name: "mysdk",
apexes: ["myapex"],
}
`)
}