xref: /aosp_15_r20/external/bazelbuild-kotlin-rules/tests/jvm/analysis/jvm_compile/no_srcs/BUILD (revision 3a22c0a33dd99bcca39a024d43e6fbcc55c2806e)
1# Copyright 2022 Google LLC. All rights reserved.
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
15load("//kotlin:common.bzl", "common")
16load("//kotlin/common/testing:testing_rules.bzl", "kt_testing_rules")
17load("//kotlin/jvm/testing:for_analysis.bzl", ktfa = "kt_for_analysis")
18load("//kotlin/jvm/testing:jvm_compile_stubs.bzl", "kt_jvm_compile_stubs")
19
20package(
21    default_applicable_licenses = ["//:license"],
22    default_testonly = True,
23)
24
25licenses(["notice"])
26
27kt_jvm_compile_stubs.analysis_test(
28    name = "no_srcs_android_family_test",
29    target_under_test = kt_jvm_compile_stubs.rule(
30        name = "no_srcs_android_family",
31        srcs = [],
32        common_srcs = [],
33        rule_family = common.RULE_FAMILY.ANDROID_LIBRARY,
34    ),
35)
36
37kt_testing_rules.assert_failure_test(
38    name = "no_srcs_jvm_family_test",
39    msg_contains = "Expected one of (srcs, common_srcs, exports) is not empty",
40    target_under_test = kt_jvm_compile_stubs.rule(
41        name = "no_srcs_jvm_family",
42        srcs = [],
43        common_srcs = [],
44        rule_family = common.RULE_FAMILY.JVM_LIBRARY,
45        exports = [],
46    ),
47)
48
49kt_jvm_compile_stubs.analysis_test(
50    name = "no_srcs_jvm_family_with_exports_test",
51    target_under_test = kt_jvm_compile_stubs.rule(
52        name = "no_srcs_jvm_family_with_exports",
53        srcs = [],
54        common_srcs = [],
55        rule_family = common.RULE_FAMILY.ANDROID_LIBRARY,
56        exports = [
57            ktfa.java_library(
58                name = "no_srcs_jvm_family_export",
59                srcs = [],
60            ),
61        ],
62    ),
63)
64