blob: dffc02ade9c7f260198ff3110fe0a89fb58d5541 [file] [log] [blame]
Paul Duffin001b2342021-03-11 18:43:31 +00001// Copyright 2021 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package sdk
16
17import (
18 "testing"
19
20 "android/soong/android"
21 "android/soong/java"
22)
23
24func TestSnapshotWithCompatConfig(t *testing.T) {
25 result := android.GroupFixturePreparers(
26 prepareForSdkTestWithJava,
27 java.PrepareForTestWithPlatformCompatConfig,
28 ).RunTestWithBp(t, `
29 sdk {
30 name: "mysdk",
31 compat_configs: ["myconfig"],
32 }
33
34 platform_compat_config {
35 name: "myconfig",
36 }
37 `)
38
39 CheckSnapshot(t, result, "mysdk", "",
40 checkVersionedAndroidBpContents(`
41// This is auto-generated. DO NOT EDIT.
42
43prebuilt_platform_compat_config {
44 name: "mysdk_myconfig@current",
45 sdk_member_name: "myconfig",
46 visibility: ["//visibility:public"],
47 metadata: "compat_configs/myconfig/myconfig_meta.xml",
48}
49
50sdk_snapshot {
51 name: "mysdk@current",
52 visibility: ["//visibility:public"],
53 compat_configs: ["mysdk_myconfig@current"],
54}
55`),
56 checkUnversionedAndroidBpContents(`
57// This is auto-generated. DO NOT EDIT.
58
59prebuilt_platform_compat_config {
60 name: "myconfig",
61 prefer: false,
62 visibility: ["//visibility:public"],
63 metadata: "compat_configs/myconfig/myconfig_meta.xml",
64}
65`),
66 checkAllCopyRules(`
67.intermediates/myconfig/android_common/myconfig_meta.xml -> compat_configs/myconfig/myconfig_meta.xml
68`),
69 )
70}