• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2016 The Android Open Source Project
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 {
16    default_applicable_licenses: ["Android-Apache-2.0"],
17    default_team: "trendy_team_art_mainline",
18}
19
20java_defaults {
21    name: "CompilationTestCases_defaults",
22    srcs: ["src/**/*.java"],
23    data: [
24        ":apksigner",
25        ":cts-compilation-testkey-files",
26        ":cts-compilation-testkey2-files",
27    ],
28    java_resource_dirs: ["assets/"],
29    device_common_java_resources: [
30        ":AppUsedByOtherApp",
31        ":AppUsedByOtherApp_1_disable_embedded_profile_dm",
32        ":AppUsedByOtherApp_1_dm",
33        ":AppUsedByOtherApp_2_prof",
34        ":AppUsingOtherApp",
35        ":CompilationTestCases-package-dex-usage",
36        ":CtsCompilationApp",
37        ":CtsCompilationApp_profile",
38        ":CtsCompilationApp_dm",
39        ":CtsCompilationApp_with_bad_profile",
40        ":CtsCompilationApp_with_good_profile",
41        ":CtsCompilationApp_debuggable",
42        ":StatusCheckerApp",
43        ":StatusCheckerApp_profile",
44        ":disable_embedded_profile_dm",
45        ":empty_config_dm",
46    ],
47    libs: [
48        "cts-tradefed",
49        "tradefed",
50        "compatibility-host-util",
51        "guava",
52        "truth",
53    ],
54    static_libs: [
55        "android.content.pm.flags-aconfig-java-host",
56        "art-aconfig-flags-java-lib-host",
57        "flag-junit-host",
58    ],
59}
60
61java_test_host {
62    name: "CtsCompilationTestCases",
63    defaults: ["CompilationTestCases_defaults"],
64    // tag this module as a cts test artifact
65    test_suites: [
66        "cts",
67        "general-tests",
68    ],
69    test_config: "CtsCompilationTestCases.xml",
70}
71
72java_test_host {
73    name: "CompilationTestCases",
74    defaults: ["CompilationTestCases_defaults"],
75    test_suites: [
76        "general-tests",
77    ],
78    test_config: "CompilationTestCases.xml",
79}
80
81// Generates a binary profile from a text profile for an APK.
82// The first input must be the text profile.
83// The second input must be the APK.
84genrule_defaults {
85    name: "profile_defaults",
86    tools: ["profman"],
87    cmd: "inputs=($(in)) && " +
88        "$(location profman) " +
89        "--create-profile-from=$${inputs[0]} " +
90        "--apk=$${inputs[1]} " +
91        "--dex-location=base.apk " +
92        "--reference-profile-file=$(out)",
93}
94
95sh_binary {
96    name: "generate_dm",
97    host_supported: true,
98    src: "scripts/generate_dm.sh",
99}
100
101// Generates a DM file.
102// Each input must be a binary profile or a config file in binary protobuf
103// format.
104genrule_defaults {
105    name: "dm_defaults",
106    tools: [
107        "generate_dm",
108        "soong_zip",
109    ],
110    cmd: "$(location generate_dm) $(location soong_zip) $(out) $(in)",
111}
112
113java_genrule {
114    name: "CtsCompilationApp_profile",
115    defaults: ["profile_defaults"],
116    srcs: [
117        "assets/primary.prof.txt",
118        ":CtsCompilationApp",
119    ],
120    out: ["CtsCompilationApp.prof"],
121}
122
123java_genrule {
124    name: "CtsCompilationApp_dm",
125    defaults: ["dm_defaults"],
126    srcs: [
127        ":CtsCompilationApp_profile",
128    ],
129    out: ["CtsCompilationApp.dm"],
130}
131
132java_genrule {
133    name: "AppUsedByOtherApp_1_prof",
134    defaults: ["profile_defaults"],
135    srcs: [
136        "assets/app_used_by_other_app_1.prof.txt",
137        ":AppUsedByOtherApp",
138    ],
139    out: ["AppUsedByOtherApp_1.prof"],
140}
141
142java_genrule {
143    name: "AppUsedByOtherApp_1_dm",
144    defaults: ["dm_defaults"],
145    srcs: [
146        ":AppUsedByOtherApp_1_prof",
147    ],
148    out: ["AppUsedByOtherApp_1.dm"],
149}
150
151java_genrule {
152    name: "AppUsedByOtherApp_2_prof",
153    defaults: ["profile_defaults"],
154    srcs: [
155        "assets/app_used_by_other_app_2.prof.txt",
156        ":AppUsedByOtherApp",
157    ],
158    out: ["AppUsedByOtherApp_2.prof"],
159}
160
161java_genrule {
162    name: "StatusCheckerApp_profile",
163    defaults: ["profile_defaults"],
164    srcs: [
165        "assets/status_checker_app.prof.txt",
166        ":StatusCheckerApp",
167    ],
168    out: ["StatusCheckerApp.prof"],
169}
170
171genrule {
172    name: "CompilationTestCases-package-dex-usage",
173    srcs: [
174        ":libartservice_protos",
175        "assets/package-dex-usage.textproto",
176    ],
177    tools: ["aprotoc"],
178    cmd: "$(location aprotoc) " +
179        "--encode=com.android.server.art.proto.DexUseProto " +
180        "$(locations :libartservice_protos) " +
181        "< $(location assets/package-dex-usage.textproto) > $(out)",
182    out: ["package-dex-usage.pb"],
183}
184
185genrule {
186    name: "CompilationTestCases-config-empty",
187    srcs: [
188        ":libartservice_protos",
189    ],
190    tools: ["aprotoc"],
191    cmd: "$(location aprotoc) " +
192        "--encode=com.android.server.art.proto.DexMetadataConfig " +
193        "$(locations :libartservice_protos) " +
194        "<<<'' > $(out)",
195    out: ["config-empty.pb"],
196}
197
198genrule {
199    name: "empty_config_dm",
200    defaults: ["dm_defaults"],
201    srcs: [
202        ":CompilationTestCases-config-empty",
203    ],
204    out: ["empty_config.dm"],
205}
206
207genrule {
208    name: "CompilationTestCases-config-disable_embedded_profile",
209    srcs: [
210        ":libartservice_protos",
211    ],
212    tools: ["aprotoc"],
213    cmd: "$(location aprotoc) " +
214        "--encode=com.android.server.art.proto.DexMetadataConfig " +
215        "$(locations :libartservice_protos) " +
216        "<<<'enable_embedded_profile: false' > $(out)",
217    out: ["config-disable_embedded_profile.pb"],
218}
219
220genrule {
221    name: "disable_embedded_profile_dm",
222    defaults: ["dm_defaults"],
223    srcs: [
224        ":CompilationTestCases-config-disable_embedded_profile",
225    ],
226    out: ["disable_embedded_profile.dm"],
227}
228
229java_genrule {
230    name: "AppUsedByOtherApp_1_disable_embedded_profile_dm",
231    defaults: ["dm_defaults"],
232    srcs: [
233        ":AppUsedByOtherApp_1_prof",
234        ":CompilationTestCases-config-disable_embedded_profile",
235    ],
236    out: ["AppUsedByOtherApp_1_disable_embedded_profile.dm"],
237}
238