• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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:for_analysis.bzl", ktfa = "kt_for_analysis")
17load("//kotlin/jvm/testing:jvm_library_analysis_test.bzl", "kt_jvm_library_analysis_test")
18
19package(
20    default_applicable_licenses = ["//:license"],
21    default_testonly = True,
22)
23
24licenses(["notice"])
25
26kt_testing_rules.assert_failure_test(
27    name = "no_srcs_test",
28    msg_contains = "Expected a source-bearing or an export-oriented target",
29    target_under_test = ktfa.kt_jvm_library(
30        name = "no_srcs",
31        srcs = [],
32    ),
33)
34
35kt_jvm_library_analysis_test(
36    name = "no_srcs_with_exports_test",
37    expect_jdeps = False,
38    required_mnemonic_counts = {"KtAndroidLint": "0"},
39    target_under_test = ktfa.kt_jvm_library(
40        name = "no_srcs_with_exports",
41        srcs = [],
42        exports = [
43            ktfa.kt_jvm_library(
44                name = "no_srcs_with_exports_export",
45                srcs = ["Input.kt"],
46            ),
47        ],
48    ),
49)
50
51kt_jvm_library_analysis_test(
52    name = "only_kt_srcs_test",
53    target_under_test = ktfa.kt_jvm_library(
54        name = "only_kt_srcs",
55        srcs = [
56            "Input.kt",
57        ],
58    ),
59)
60
61kt_jvm_library_analysis_test(
62    name = "only_java_srcs_test",
63    target_under_test = ktfa.kt_jvm_library(
64        name = "only_java_srcs",
65        srcs = [
66            "Input.java",
67        ],
68    ),
69)
70