• 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:compiler_plugin.bzl", "kt_compiler_plugin")
16load("//tests/analysis:util.bzl", "create_file")
17load("@bazel_skylib//rules:build_test.bzl", "build_test")
18load(":assert_compiler_plugin_test.bzl", "assert_compiler_plugin_test")
19
20licenses(["notice"])
21
22assert_compiler_plugin_test(
23    name = "example_plugin_test",
24    expected_args = [
25        "plugin:com.google.example:key=value",
26    ],
27    expected_id = "com.google.example",
28    expected_jar = "//tests/analysis/compiler_plugin:empty_jar",
29    target_under_test = ":example_plugin",
30)
31
32build_test(
33    name = "example_plugin_in_java_library_build_test",
34    targets = [
35        ":example_plugin_in_java_library",
36    ],
37)
38
39java_library(
40    name = "example_plugin_in_java_library",
41    srcs = [create_file(
42        name = "Tmp.java",
43        content = """
44          @SuppressWarnings("DefaultPackage")
45          class Tmp { }
46        """,
47    )],
48    plugins = [":example_plugin"],
49)
50
51kt_compiler_plugin(
52    name = "example_plugin",
53    args = {
54        "key": "value",
55    },
56    jar = "//tests/analysis/compiler_plugin:empty_jar",
57    plugin_id = "com.google.example",
58)
59