Repository navigation
Expand file tree
/
Copy pathkotlin.bzl
More file actions
60 lines (51 loc) · 1.92 KB
/
Copy pathkotlin.bzl
File metadata and controls
60 lines (51 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
load(
"@rules_kotlin//kotlin:core.bzl",
"kt_compiler_plugin",
"kt_javac_options",
"kt_kotlinc_options",
"kt_plugin_cfg",
)
JAVA_VERSION = "17"
def setup_kotlin_compiler():
kt_javac_options(name = "javac_options", release = JAVA_VERSION)
kt_kotlinc_options(name = "kotlinc_options", jvm_target = JAVA_VERSION)
def setup_spring_allopen_plugin(target_name = "spring_allopen"):
kt_compiler_plugin(
name = target_name,
id = "org.jetbrains.kotlin.allopen",
options = {"preset": "spring"},
deps = ["@rules_kotlin//kotlin/compiler:allopen-compiler-plugin"],
)
def setup_jpa_noarg_plugin():
"""JPA용 Kotlin no-arg 컴파일러 플러그인을 등록한다.
JPA 엔티티는 인자 없는 생성자를 요구한다. Kotlin 클래스에는 없으므로 컴파일 시 만들어 준다.
"""
kt_compiler_plugin(
name = "jpa_noarg",
id = "org.jetbrains.kotlin.noarg",
options = {"preset": "jpa"},
deps = ["@rules_kotlin//kotlin/compiler:noarg-compiler-plugin"],
)
def setup_jpa_allopen_plugin(target_name = "spring_allopen"):
kt_plugin_cfg(
name = target_name + "_entity_allopen",
plugin = ":" + target_name,
options = {"annotation": ["jakarta.persistence.Entity"]},
)
kt_plugin_cfg(
name = target_name + "_mapped_superclass_allopen",
plugin = ":" + target_name,
options = {"annotation": ["jakarta.persistence.MappedSuperclass"]},
)
kt_plugin_cfg(
name = target_name + "_embeddable_allopen",
plugin = ":" + target_name,
options = {"annotation": ["jakarta.persistence.Embeddable"]},
)
def jpa_allopen_plugins(target_name = "spring_allopen"):
return [
"//:" + target_name,
"//:" + target_name + "_entity_allopen",
"//:" + target_name + "_mapped_superclass_allopen",
"//:" + target_name + "_embeddable_allopen",
]