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 15//########################################################### 16// SettingsLib Shell app just for Robolectric test target. # 17//########################################################### 18 19package { 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 28android_app { 29 name: "SettingsLibShell", 30 use_resource_processor: true, 31 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", 44 srcs: [ 45 "src/**/*.java", 46 "src/**/*.kt", 47 ], 48 static_libs: [ 49 "Settings_robolectric_meta_service_file", 50 "Robolectric_shadows_androidx_fragment_upstream", 51 "SettingsLib-robo-testutils", 52 "androidx.fragment_fragment", 53 "androidx.test.core", 54 "androidx.core_core", 55 "kotlinx_coroutines_test", 56 "flag-junit", 57 "settingslib_media_flags_lib", 58 "settingslib_illustrationpreference_flags_lib", 59 "settingslib_selectorwithwidgetpreference_flags_lib", 60 "testng", // TODO: remove once JUnit on Android provides assertThrows 61 ], 62 java_resource_dirs: ["config"], 63 instrumentation_for: "SettingsLibShell", 64 coverage_libs: ["SettingsLib"], 65 test_options: { 66 timeout: 36000, 67 }, 68 upstream: true, 69 70 strict_mode: false, 71} 72 73java_genrule { 74 name: "Settings_robolectric_meta_service_file", 75 out: ["robolectric_meta_service_file.jar"], 76 tools: ["soong_zip"], 77 cmd: "mkdir -p $(genDir)/META-INF/services/ && touch $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider &&" + 78 "echo -e 'org.robolectric.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " + 79 "echo -e 'org.robolectric.shadows.multidex.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " + 80 "echo -e 'org.robolectric.shadows.httpclient.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " + 81 //"echo -e 'com.android.settings.testutils.shadow.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " + 82 "echo -e 'com.android.settingslib.testutils.shadow.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " + 83 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)/META-INF/services/", 84} 85 86java_library { 87 name: "SettingsLib-robo-testutils", 88 srcs: [ 89 "testutils/com/android/settingslib/testutils/**/*.java", 90 ], 91 javacflags: [ 92 "-Aorg.robolectric.annotation.processing.shadowPackage=com.android.settingslib.testutils.shadow", 93 "-Aorg.robolectric.annotation.processing.sdkCheckMode=ERROR", 94 // Uncomment the below to debug annotation processors not firing. 95 //"-verbose", 96 //"-XprintRounds", 97 //"-XprintProcessorInfo", 98 //"-Xlint", 99 //"-J-verbose", 100 ], 101 plugins: [ 102 "auto_value_plugin_1.9", 103 "auto_value_builder_plugin_1.9", 104 "Robolectric_processor_upstream", 105 ], 106 libs: [ 107 "Robolectric_all-target_upstream", 108 "mockito-robolectric-prebuilt", 109 "truth", 110 ], 111} 112