1*7594170eSAndroid Build Coastguard Worker""" 2*7594170eSAndroid Build Coastguard WorkerCopyright (C) 2023 The Android Open Source Project 3*7594170eSAndroid Build Coastguard Worker 4*7594170eSAndroid Build Coastguard WorkerLicensed under the Apache License, Version 2.0 (the "License"); 5*7594170eSAndroid Build Coastguard Workeryou may not use this file except in compliance with the License. 6*7594170eSAndroid Build Coastguard WorkerYou may obtain a copy of the License at 7*7594170eSAndroid Build Coastguard Worker 8*7594170eSAndroid Build Coastguard Worker http://www.apache.org/licenses/LICENSE-2.0 9*7594170eSAndroid Build Coastguard Worker 10*7594170eSAndroid Build Coastguard WorkerUnless required by applicable law or agreed to in writing, software 11*7594170eSAndroid Build Coastguard Workerdistributed under the License is distributed on an "AS IS" BASIS, 12*7594170eSAndroid Build Coastguard WorkerWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*7594170eSAndroid Build Coastguard WorkerSee the License for the specific language governing permissions and 14*7594170eSAndroid Build Coastguard Workerlimitations under the License. 15*7594170eSAndroid Build Coastguard Worker""" 16*7594170eSAndroid Build Coastguard Worker 17*7594170eSAndroid Build Coastguard Workerload("@rules_testing//lib:analysis_test.bzl", "analysis_test", "test_suite") 18*7594170eSAndroid Build Coastguard Workerload("//build/bazel/rules/java:java_resources.bzl", "java_resources") 19*7594170eSAndroid Build Coastguard Worker 20*7594170eSAndroid Build Coastguard Workerdef _java_resources_test_impl(env, target): 21*7594170eSAndroid Build Coastguard Worker target_subject = env.expect.that_target(target) 22*7594170eSAndroid Build Coastguard Worker target_subject.has_provider(JavaInfo) 23*7594170eSAndroid Build Coastguard Worker 24*7594170eSAndroid Build Coastguard Workerdef test_java_resources_provider(name): 25*7594170eSAndroid Build Coastguard Worker res_name = name + "_target" 26*7594170eSAndroid Build Coastguard Worker java_resources( 27*7594170eSAndroid Build Coastguard Worker name = res_name, 28*7594170eSAndroid Build Coastguard Worker resources = ["foo.txt"], 29*7594170eSAndroid Build Coastguard Worker tags = ["manual"], 30*7594170eSAndroid Build Coastguard Worker ) 31*7594170eSAndroid Build Coastguard Worker analysis_test(name, impl = _java_resources_test_impl, target = res_name) 32*7594170eSAndroid Build Coastguard Worker 33*7594170eSAndroid Build Coastguard Workerdef java_resources_test_suite(name): 34*7594170eSAndroid Build Coastguard Worker test_suite( 35*7594170eSAndroid Build Coastguard Worker name = name, 36*7594170eSAndroid Build Coastguard Worker tests = [ 37*7594170eSAndroid Build Coastguard Worker test_java_resources_provider, 38*7594170eSAndroid Build Coastguard Worker ], 39*7594170eSAndroid Build Coastguard Worker ) 40