blob: c037c400948f75c68b195553b1b4f951cff1f351 [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",
30 defaults: ["SettingsLibDefaults"],
31 platform_apis: true,
32
33 privileged: true,
34
35 resource_dirs: ["res"],
36}
37
38//###########################################################
39// SettingsLib Robolectric test target. #
40//###########################################################
41android_robolectric_test {
42 name: "SettingsLibRoboTests",
43 srcs: ["src/**/*.java"],
Fan Zhang99decdd2019-06-20 16:31:28 -070044 static_libs: [
Rex Hoffman0e16cd92023-06-07 19:53:58 +000045 "Settings_robolectric_meta_service_file",
46 "Robolectric_shadows_androidx_fragment_upstream",
Fan Zhang99decdd2019-06-20 16:31:28 -070047 "SettingsLib-robo-testutils",
Rex Hoffman0e16cd92023-06-07 19:53:58 +000048 "androidx.fragment_fragment",
arangelov51fd49a2021-05-14 18:05:54 +010049 "androidx.test.core",
50 "androidx.core_core",
Felipe Leme4e6057e2021-05-24 18:10:29 -070051 "testng", // TODO: remove once JUnit on Android provides assertThrows
Fan Zhang99decdd2019-06-20 16:31:28 -070052 ],
Colin Crossfdec9ff2019-05-02 13:21:41 -070053 java_resource_dirs: ["config"],
54 instrumentation_for: "SettingsLibShell",
55 coverage_libs: ["SettingsLib"],
56 test_options: {
Colin Crossc3378672019-05-30 11:39:13 -070057 timeout: 36000,
Colin Crossfdec9ff2019-05-02 13:21:41 -070058 },
Rex Hoffman0e16cd92023-06-07 19:53:58 +000059 upstream: true,
60}
61
62java_genrule {
63 name: "Settings_robolectric_meta_service_file",
64 out: ["robolectric_meta_service_file.jar"],
65 tools: ["soong_zip"],
66 cmd: "mkdir -p $(genDir)/META-INF/services/ && touch $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider &&" +
67 "echo -e 'org.robolectric.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " +
68 "echo -e 'org.robolectric.shadows.multidex.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " +
69 "echo -e 'org.robolectric.shadows.httpclient.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " +
70 //"echo -e 'com.android.settings.testutils.shadow.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " +
71 "echo -e 'com.android.settingslib.testutils.shadow.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " +
72 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)/META-INF/services/",
Colin Crossfdec9ff2019-05-02 13:21:41 -070073}
74
75java_library {
76 name: "SettingsLib-robo-testutils",
77 srcs: [
Fan Zhang99decdd2019-06-20 16:31:28 -070078 "testutils/com/android/settingslib/testutils/**/*.java",
Colin Crossfdec9ff2019-05-02 13:21:41 -070079 ],
Rex Hoffman0e16cd92023-06-07 19:53:58 +000080 javacflags: [
81 "-Aorg.robolectric.annotation.processing.shadowPackage=com.android.settingslib.testutils.shadow",
82 "-Aorg.robolectric.annotation.processing.sdkCheckMode=ERROR",
83 // Uncomment the below to debug annotation processors not firing.
84 //"-verbose",
85 //"-XprintRounds",
86 //"-XprintProcessorInfo",
87 //"-Xlint",
88 //"-J-verbose",
89 ],
90 plugins: [
91 "auto_value_plugin_1.9",
92 "auto_value_builder_plugin_1.9",
93 "Robolectric_processor_upstream",
94 ],
Colin Crossfdec9ff2019-05-02 13:21:41 -070095 libs: [
Rex Hoffman0e16cd92023-06-07 19:53:58 +000096 "Robolectric_all-target_upstream",
Chaohui Wangd0e9dc02022-05-07 17:49:24 +080097 "mockito-robolectric-prebuilt",
Colin Crossfdec9ff2019-05-02 13:21:41 -070098 "truth-prebuilt",
99 ],
100}