xref: /aosp_15_r20/build/bazel/rules/kotlin/kotlinc.BUILD (revision 7594170e27e0732bc44b93d1440d87a54b6ffe7c)
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("@soong_injection//java_toolchain:constants.bzl", "constants")
16
17package(default_visibility = ["//visibility:public"])
18
19java_import(
20    name = "annotations",
21    jars = ["lib/annotations-13.0.jar"],
22)
23
24java_import(
25    name = "jvm_abi_gen_plugin",
26    jars = ["lib/jvm-abi-gen.jar"],
27)
28
29java_import(
30    name = "kotlin_annotation_processing",
31    jars = ["lib/kotlin-annotation-processing.jar"],
32)
33
34# sh_binary(
35#     name = "kotlin_compiler",
36#     srcs = ["bin/kotlinc"],
37#     data = glob(["lib/**"]),
38# )
39
40java_binary(
41    name = "kotlin_compiler",
42    jvm_flags = ["-Xmx" + constants.JavacHeapSize],
43    main_class = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler",
44    runtime_deps = [
45        "lib/kotlin-compiler.jar",
46        "lib/kotlin-stdlib.jar",
47        "lib/trove4j.jar",
48    ],
49)
50
51# java_binary(
52#     name = "kotlin_compiler",
53#     main_class = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler",
54#     runtime_deps = [":kotlin_compiler_lib"],
55# )
56
57# java_import(
58#     name = "kotlin_compiler_lib",
59#     jars = ["lib/kotlin-compiler.jar"]
60#     srcjar = "lib/kotlin-compiler-sources.jar",
61# )
62
63java_import(
64    name = "kotlin_reflect",
65    jars = ["lib/kotlin-reflect.jar"],
66    srcjar = "lib/kotlin-reflect-sources.jar",
67)
68
69java_import(
70    name = "kotlin_stdlib",
71    jars = ["lib/kotlin-stdlib.jar"],
72    srcjar = "lib/kotlin-stdlib-sources.jar",
73)
74
75java_import(
76    name = "kotlin_stdlib_jdk7",
77    jars = ["lib/kotlin-stdlib-jdk7.jar"],
78    srcjar = "lib/kotlin-stdlib-jdk7-sources.jar",
79)
80
81java_import(
82    name = "kotlin_stdlib_jdk8",
83    jars = ["lib/kotlin-stdlib-jdk8.jar"],
84    srcjar = "lib/kotlin-stdlib-jdk8-sources.jar",
85)
86
87java_import(
88    name = "kotlin_test",
89    jars = ["lib/kotlin-test.jar"],
90    srcjar = "lib/kotlin-test-sources.jar",
91)
92
93alias(
94    name = "kotlin_test_not_testonly",
95    actual = ":kotlin_test",
96)
97