• 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_compile_stubs.bzl", "kt_jvm_compile_stubs")
18
19package(
20    default_applicable_licenses = ["//:license"],
21    default_testonly = True,
22)
23
24licenses(["notice"])
25
26kt_jvm_compile_stubs.analysis_test(
27    name = "has_r_java_named_resources_test",
28    expected_kotlinc_classpath_names = [
29        "platformclasspath.jar",  # bootclasspath
30        "libjava_library_resources-hjar.jar",  # r_java
31        "libjava_library-hjar.jar",  # deps
32        "kotlin-stdlib-ijar.jar",  # stdlibs
33        "annotations-13.0-ijar.jar",  # stdlibs
34    ],
35    target_under_test = kt_jvm_compile_stubs.rule(
36        name = "has_r_java_named_resources",
37        srcs = ["Input.kt"],
38        r_java = ":java_library_resources",
39        deps = [":java_library"],
40    ),
41)
42
43kt_testing_rules.assert_failure_test(
44    name = "has_r_java_not_named_resources_test",
45    msg_contains = "illegal dependency provided for r_java",
46    target_under_test = kt_jvm_compile_stubs.rule(
47        name = "has_r_java_not_named_resources",
48        srcs = ["Input.kt"],
49        r_java = ":java_library",
50    ),
51)
52
53ktfa.java_library(
54    name = "java_library_resources",
55    srcs = ["Input.java"],
56)
57
58ktfa.java_library(
59    name = "java_library",
60    srcs = ["Input.java"],
61)
62