xref: /aosp_15_r20/external/bazelbuild-kotlin-rules/tests/jvm/analysis/jvm_compile/src_artifacts/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/testing:testing_rules.bzl", "kt_testing_rules")
16load("//kotlin/jvm/testing:jvm_compile_stubs.bzl", "kt_jvm_compile_stubs")
17
18package(
19    default_applicable_licenses = ["//:license"],
20    default_testonly = True,
21)
22
23licenses(["notice"])
24
25kt_jvm_compile_stubs.analysis_test(
26    name = "has_allowed_aritfacts_test",
27    target_under_test = kt_jvm_compile_stubs.rule(
28        name = "has_allowed_artifacts",
29        srcs = [
30            # go/keep-sorted start
31            kt_testing_rules.create_dir(name = "has_allowed_artifacts/java"),
32            kt_testing_rules.create_dir(name = "has_allowed_artifacts/kotlin"),
33            kt_testing_rules.create_file(name = "has_allowed_artifacts/java.srcjar"),
34            kt_testing_rules.create_file(name = "has_allowed_artifacts/src.java"),
35            kt_testing_rules.create_file(name = "has_allowed_artifacts/src.kt"),
36            # go/keep-sorted end
37        ],
38    ),
39)
40
41kt_testing_rules.assert_failure_test(
42    name = "has_unexpected_file_type_test",
43    msg_contains = "/src.unexpected",
44    target_under_test = kt_jvm_compile_stubs.rule(
45        name = "has_unexpected_file_type",
46        srcs = [
47            kt_testing_rules.create_file(name = "has_unexpected_file_type/src.unexpected"),
48        ],
49    ),
50)
51
52kt_testing_rules.assert_failure_test(
53    name = "has_unexpected_dir_ending_test",
54    msg_contains = "/kotlin/unexpected",
55    target_under_test = kt_jvm_compile_stubs.rule(
56        name = "has_unexpected_dir_ending",
57        srcs = [
58            kt_testing_rules.create_dir(name = "has_unexpected_dir_ending_test/kotlin/unexpected"),
59        ],
60    ),
61)
62