Skip to content

Commit 4825c0f

Browse files
committed
feat: kotlin dsl and generator
1 parent 5bed5a1 commit 4825c0f

55 files changed

Lines changed: 9247 additions & 91 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

BUILD.bazel

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,12 @@ tsconfig_to_swcconfig.t2s(
101101
stdout = ".swcrc",
102102
visibility = ["//:__subpackages__"],
103103
)
104+
105+
# Kotlin compiler options for kotlin-dsl
106+
load("@rules_kotlin//kotlin:core.bzl", "kt_kotlinc_options")
107+
108+
kt_kotlinc_options(
109+
name = "kt_opts",
110+
jvm_target = "21",
111+
visibility = ["//visibility:public"],
112+
)

MODULE.bazel

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,24 @@ build_constants(
7878
name = "build_constants",
7979
version_file = "//:VERSION",
8080
)
81+
82+
####### Kotlin (for kotlin-dsl) #########
83+
bazel_dep(name = "rules_kotlin", version = "2.2.1")
84+
bazel_dep(name = "rules_jvm_external", version = "6.6")
85+
86+
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
87+
maven.install(
88+
artifacts = [
89+
"org.jetbrains.kotlin:kotlin-stdlib:2.3.0",
90+
"org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0",
91+
"io.kotest:kotest-runner-junit5:6.0.7",
92+
"io.kotest:kotest-assertions-core:6.0.7",
93+
"io.kotest:kotest-assertions-json:6.0.7",
94+
"org.junit.platform:junit-platform-console:1.11.4",
95+
],
96+
repositories = [
97+
"https://repo1.maven.org/maven2",
98+
],
99+
)
100+
use_repo(maven, "maven")
101+
###########################################

MODULE.bazel.lock

Lines changed: 2 additions & 91 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

language/dsl/kotlin/.editorconfig

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# EditorConfig for Kotlin code style
2+
# https://editorconfig.org/
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
indent_size = 4
10+
indent_style = space
11+
insert_final_newline = true
12+
max_line_length = 120
13+
trim_trailing_whitespace = true
14+
15+
[*.kt]
16+
# ktlint specific rules
17+
ktlint_standard_no-wildcard-imports = disabled
18+
ktlint_standard_package-name = disabled
19+
20+
# Allow trailing commas
21+
ktlint_standard_trailing-comma-on-call-site = disabled
22+
ktlint_standard_trailing-comma-on-declaration-site = disabled
23+
24+
# Function signature - allow multi-line
25+
ktlint_standard_function-signature = disabled
26+
27+
# Disable some strict rules for DSL-style code
28+
ktlint_standard_parameter-list-wrapping = disabled
29+
ktlint_standard_argument-list-wrapping = disabled
30+
31+
[*.kts]
32+
ktlint_standard_no-wildcard-imports = disabled

language/dsl/kotlin/BUILD.bazel

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library", "kt_jvm_test")
2+
load("@rules_kotlin//kotlin:lint.bzl", "ktlint_config", "ktlint_fix", "ktlint_test")
3+
4+
package(default_visibility = ["//visibility:public"])
5+
6+
ktlint_config(
7+
name = "ktlint_config",
8+
editorconfig = ".editorconfig",
9+
)
10+
11+
kt_jvm_library(
12+
name = "kotlin-dsl",
13+
srcs = glob(["src/main/kotlin/**/*.kt"]),
14+
kotlinc_opts = "//:kt_opts",
15+
deps = [
16+
"@maven//:org_jetbrains_kotlin_kotlin_stdlib",
17+
"@maven//:org_jetbrains_kotlinx_kotlinx_serialization_json",
18+
],
19+
)
20+
21+
kt_jvm_test(
22+
name = "kotlin-dsl-test",
23+
srcs = glob(["src/test/kotlin/**/*.kt"]),
24+
kotlinc_opts = "//:kt_opts",
25+
args = [
26+
"--select-class=com.intuit.playertools.fluent.IdGeneratorTest",
27+
"--select-class=com.intuit.playertools.fluent.FluentBuilderBaseTest",
28+
"--select-class=com.intuit.playertools.fluent.FlowTest",
29+
"--select-class=com.intuit.playertools.fluent.IntegrationTest",
30+
"--select-class=com.intuit.playertools.fluent.StandardExpressionsTest",
31+
],
32+
main_class = "org.junit.platform.console.ConsoleLauncher",
33+
deps = [
34+
":kotlin-dsl",
35+
"@maven//:io_kotest_kotest_assertions_core",
36+
"@maven//:io_kotest_kotest_assertions_json",
37+
"@maven//:io_kotest_kotest_runner_junit5",
38+
"@maven//:org_jetbrains_kotlin_kotlin_stdlib",
39+
"@maven//:org_junit_platform_junit_platform_console",
40+
],
41+
)
42+
43+
ktlint_test(
44+
name = "ktlint",
45+
srcs = glob([
46+
"src/main/kotlin/**/*.kt",
47+
"src/test/kotlin/**/*.kt",
48+
]),
49+
config = ":ktlint_config",
50+
)
51+
52+
ktlint_fix(
53+
name = "ktlint_fix",
54+
srcs = glob([
55+
"src/main/kotlin/**/*.kt",
56+
"src/test/kotlin/**/*.kt",
57+
]),
58+
config = ":ktlint_config",
59+
)

0 commit comments

Comments
 (0)