blob: 75c40bfa8b6019bc59cd7eb2c1676c1c58136bb8 [file] [log] [blame]
Colin Crossfdec9ff2019-05-02 13:21:41 -07001// 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
15//###########################################################
16// SettingsLib Shell app just for Robolectric test target. #
17//###########################################################
18
Bob Badour8a6a2bc2021-02-12 17:07:05 -080019package {
20 // See: http://go/android-license-faq
21 // A large-scale-change added 'default_applicable_licenses' to import
22 // all of the 'license_kinds' from "frameworks_base_license"
23 // to get the below license kinds:
24 // SPDX-license-identifier-Apache-2.0
25 default_applicable_licenses: ["frameworks_base_license"],
26}
27
Colin Crossfdec9ff2019-05-02 13:21:41 -070028android_app {
29 name: "SettingsLibShell",
Peter Kalauskas84c5a992023-08-23 13:39:23 -070030 use_resource_processor: true,
Colin Crossfdec9ff2019-05-02 13:21:41 -070031 defaults: ["SettingsLibDefaults"],
32 platform_apis: true,
33
34 privileged: true,
35
36 resource_dirs: ["res"],
37}
38
39//###########################################################
40// SettingsLib Robolectric test target. #
41//###########################################################
42android_robolectric_test {
43 name: "SettingsLibRoboTests",
tomhsu9d118962024-05-09 11:22:17 +000044 srcs: [
45 "src/**/*.java",
46 "src/**/*.kt",
47 ],
Fan Zhang99decdd2019-06-20 16:31:28 -070048 static_libs: [
Rex Hoffman0e16cd92023-06-07 19:53:58 +000049 "Settings_robolectric_meta_service_file",
50 "Robolectric_shadows_androidx_fragment_upstream",
Fan Zhang99decdd2019-06-20 16:31:28 -070051 "SettingsLib-robo-testutils",
Rex Hoffman0e16cd92023-06-07 19:53:58 +000052 "androidx.fragment_fragment",
arangelov51fd49a2021-05-14 18:05:54 +010053 "androidx.test.core",
54 "androidx.core_core",
Ioana Alexandru3064da52024-06-18 15:14:31 +020055 "kotlinx_coroutines_test",
Jacqueline Bronger966072d2023-08-22 14:31:40 +020056 "flag-junit",
Evan Lairda06440f2023-12-15 17:14:07 -050057 "settingslib_media_flags_lib",
Chris Antolbcad6e22024-05-13 22:03:19 +000058 "settingslib_illustrationpreference_flags_lib",
Felipe Leme4e6057e2021-05-24 18:10:29 -070059 "testng", // TODO: remove once JUnit on Android provides assertThrows
Fan Zhang99decdd2019-06-20 16:31:28 -070060 ],
Colin Crossfdec9ff2019-05-02 13:21:41 -070061 java_resource_dirs: ["config"],
62 instrumentation_for: "SettingsLibShell",
63 coverage_libs: ["SettingsLib"],
64 test_options: {
Colin Crossc3378672019-05-30 11:39:13 -070065 timeout: 36000,
Colin Crossfdec9ff2019-05-02 13:21:41 -070066 },
Rex Hoffman0e16cd92023-06-07 19:53:58 +000067 upstream: true,
Kevin Liueef626a2024-05-02 20:36:09 +000068
69 strict_mode: false,
Rex Hoffman0e16cd92023-06-07 19:53:58 +000070}
71
72java_genrule {
73 name: "Settings_robolectric_meta_service_file",
74 out: ["robolectric_meta_service_file.jar"],
75 tools: ["soong_zip"],
76 cmd: "mkdir -p $(genDir)/META-INF/services/ && touch $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider &&" +
77 "echo -e 'org.robolectric.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " +
78 "echo -e 'org.robolectric.shadows.multidex.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " +
79 "echo -e 'org.robolectric.shadows.httpclient.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " +
80 //"echo -e 'com.android.settings.testutils.shadow.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " +
81 "echo -e 'com.android.settingslib.testutils.shadow.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " +
82 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)/META-INF/services/",
Colin Crossfdec9ff2019-05-02 13:21:41 -070083}
84
85java_library {
86 name: "SettingsLib-robo-testutils",
87 srcs: [
Fan Zhang99decdd2019-06-20 16:31:28 -070088 "testutils/com/android/settingslib/testutils/**/*.java",
Colin Crossfdec9ff2019-05-02 13:21:41 -070089 ],
Rex Hoffman0e16cd92023-06-07 19:53:58 +000090 javacflags: [
91 "-Aorg.robolectric.annotation.processing.shadowPackage=com.android.settingslib.testutils.shadow",
92 "-Aorg.robolectric.annotation.processing.sdkCheckMode=ERROR",
93 // Uncomment the below to debug annotation processors not firing.
94 //"-verbose",
95 //"-XprintRounds",
96 //"-XprintProcessorInfo",
97 //"-Xlint",
98 //"-J-verbose",
99 ],
100 plugins: [
101 "auto_value_plugin_1.9",
102 "auto_value_builder_plugin_1.9",
103 "Robolectric_processor_upstream",
104 ],
Colin Crossfdec9ff2019-05-02 13:21:41 -0700105 libs: [
Rex Hoffman0e16cd92023-06-07 19:53:58 +0000106 "Robolectric_all-target_upstream",
Chaohui Wangd0e9dc02022-05-07 17:49:24 +0800107 "mockito-robolectric-prebuilt",
Krzysztof KosiƄski60b70872023-10-06 20:11:39 +0000108 "truth",
Colin Crossfdec9ff2019-05-02 13:21:41 -0700109 ],
110}