Skip to content

Commit 873a12f

Browse files
committed
Merge branch 'kotlin-support' into 'main'
Add support for Kotlin in build.gradle See merge request ExplorViz/code/span-service!25
2 parents 6f6a159 + c37242d commit 873a12f

File tree

2 files changed

+118
-0
lines changed

2 files changed

+118
-0
lines changed

.editorconfig

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,93 @@ ij_java_wrap_comments = true
273273
ij_java_wrap_first_method_in_call_chain = false
274274
ij_java_wrap_long_lines = false
275275

276+
[{*.kt,*.kts}]
277+
indent_style = space
278+
insert_final_newline = true
279+
max_line_length = 120
280+
indent_size = 4
281+
ij_continuation_indent_size = 4
282+
ij_java_names_count_to_use_import_on_demand = 9999
283+
ij_kotlin_align_in_columns_case_branch = false
284+
ij_kotlin_align_multiline_binary_operation = false
285+
ij_kotlin_align_multiline_extends_list = false
286+
ij_kotlin_align_multiline_method_parentheses = false
287+
ij_kotlin_align_multiline_parameters = true
288+
ij_kotlin_align_multiline_parameters_in_calls = false
289+
ij_kotlin_allow_trailing_comma = true
290+
ij_kotlin_allow_trailing_comma_on_call_site = true
291+
ij_kotlin_assignment_wrap = normal
292+
ij_kotlin_blank_lines_after_class_header = 0
293+
ij_kotlin_blank_lines_around_block_when_branches = 0
294+
ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1
295+
ij_kotlin_block_comment_at_first_column = true
296+
ij_kotlin_call_parameters_new_line_after_left_paren = true
297+
ij_kotlin_call_parameters_right_paren_on_new_line = false
298+
ij_kotlin_call_parameters_wrap = on_every_item
299+
ij_kotlin_catch_on_new_line = false
300+
ij_kotlin_class_annotation_wrap = split_into_lines
301+
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
302+
ij_kotlin_continuation_indent_for_chained_calls = true
303+
ij_kotlin_continuation_indent_for_expression_bodies = true
304+
ij_kotlin_continuation_indent_in_argument_lists = true
305+
ij_kotlin_continuation_indent_in_elvis = false
306+
ij_kotlin_continuation_indent_in_if_conditions = false
307+
ij_kotlin_continuation_indent_in_parameter_lists = false
308+
ij_kotlin_continuation_indent_in_supertype_lists = false
309+
ij_kotlin_else_on_new_line = false
310+
ij_kotlin_enum_constants_wrap = off
311+
ij_kotlin_extends_list_wrap = normal
312+
ij_kotlin_field_annotation_wrap = off
313+
ij_kotlin_finally_on_new_line = false
314+
ij_kotlin_if_rparen_on_new_line = false
315+
ij_kotlin_import_nested_classes = false
316+
ij_kotlin_imports_layout = *
317+
ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
318+
ij_kotlin_keep_blank_lines_before_right_brace = 2
319+
ij_kotlin_keep_blank_lines_in_code = 2
320+
ij_kotlin_keep_blank_lines_in_declarations = 2
321+
ij_kotlin_keep_first_column_comment = true
322+
ij_kotlin_keep_indents_on_empty_lines = false
323+
ij_kotlin_keep_line_breaks = true
324+
ij_kotlin_lbrace_on_next_line = false
325+
ij_kotlin_line_comment_add_space = false
326+
ij_kotlin_line_comment_at_first_column = true
327+
ij_kotlin_method_annotation_wrap = split_into_lines
328+
ij_kotlin_method_call_chain_wrap = normal
329+
ij_kotlin_method_parameters_new_line_after_left_paren = true
330+
ij_kotlin_method_parameters_right_paren_on_new_line = true
331+
ij_kotlin_method_parameters_wrap = on_every_item
332+
ij_kotlin_name_count_to_use_star_import = 9999
333+
ij_kotlin_name_count_to_use_star_import_for_members = 9999
334+
ij_kotlin_parameter_annotation_wrap = off
335+
ij_kotlin_space_after_comma = true
336+
ij_kotlin_space_after_extend_colon = true
337+
ij_kotlin_space_after_type_colon = true
338+
ij_kotlin_space_before_catch_parentheses = true
339+
ij_kotlin_space_before_comma = false
340+
ij_kotlin_space_before_extend_colon = true
341+
ij_kotlin_space_before_for_parentheses = true
342+
ij_kotlin_space_before_if_parentheses = true
343+
ij_kotlin_space_before_lambda_arrow = true
344+
ij_kotlin_space_before_type_colon = false
345+
ij_kotlin_space_before_when_parentheses = true
346+
ij_kotlin_space_before_while_parentheses = true
347+
ij_kotlin_spaces_around_additive_operators = true
348+
ij_kotlin_spaces_around_assignment_operators = true
349+
ij_kotlin_spaces_around_equality_operators = true
350+
ij_kotlin_spaces_around_function_type_arrow = true
351+
ij_kotlin_spaces_around_logical_operators = true
352+
ij_kotlin_spaces_around_multiplicative_operators = true
353+
ij_kotlin_spaces_around_range = false
354+
ij_kotlin_spaces_around_relational_operators = true
355+
ij_kotlin_spaces_around_unary_operator = false
356+
ij_kotlin_spaces_around_when_arrow = true
357+
ij_kotlin_variable_annotation_wrap = off
358+
ij_kotlin_while_on_new_line = false
359+
ij_kotlin_wrap_elvis_expressions = 1
360+
ij_kotlin_wrap_expression_body_functions = 1
361+
ij_kotlin_wrap_first_method_in_call_chain = false
362+
276363
[.editorconfig]
277364
ij_editorconfig_align_group_field_declarations = false
278365
ij_editorconfig_space_after_colon = false

build.gradle

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
plugins {
22
id 'java'
33
id 'io.quarkus'
4+
45
id 'com.adarshr.test-logger' version '3.2.0'
56
id "org.kordamp.gradle.jandex" version "2.0.0"
7+
8+
id "org.jetbrains.kotlin.jvm" version "2.0.21"
9+
id "org.jetbrains.kotlin.plugin.allopen" version "2.0.21"
10+
11+
id "io.gitlab.arturbosch.detekt" version "1.23.7"
12+
id "com.diffplug.spotless" version "6.25.0"
613
}
714

815
apply from: 'code-analysis/code-analysis.gradle'
@@ -20,6 +27,9 @@ dependencies {
2027

2128
implementation 'io.quarkus:quarkus-container-image-jib'
2229

30+
implementation "io.quarkus:quarkus-kotlin"
31+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
32+
2333
// Needed for scheduled jobs
2434
implementation 'io.quarkus:quarkus-scheduler'
2535

@@ -67,6 +77,10 @@ compileTestJava {
6777
options.encoding = 'UTF-8'
6878
}
6979

80+
kotlin {
81+
jvmToolchain(21)
82+
}
83+
7084
java {
7185
sourceCompatibility = JavaVersion.VERSION_21
7286
targetCompatibility = JavaVersion.VERSION_21
@@ -138,6 +152,15 @@ tasks.named('quarkusDependenciesBuild') {
138152
dependsOn 'jandex'
139153
}
140154

155+
spotless {
156+
kotlin {
157+
ktfmt().kotlinlangStyle().configure {
158+
it.setMaxWidth(120)
159+
}
160+
}
161+
}
162+
163+
141164
tasks.withType(JavaCompile).configureEach {
142165
// Turn on all javac warnings except classfile and processing, which produces many false-positives about annotations
143166
options.compilerArgs << "-Xlint:all" << "-Xlint:-classfile" << "-Xlint:-processing"
@@ -148,6 +171,14 @@ test {
148171
testLogging.showStandardStreams = true
149172
}
150173

174+
// Needed by Mockito since closed Kotlin classes cannot be mocked
175+
allOpen {
176+
annotation("jakarta.ws.rs.Path")
177+
annotation("jakarta.enterprise.context.ApplicationScoped")
178+
annotation("jakarta.persistence.Entity")
179+
annotation("io.quarkus.test.junit.QuarkusTest")
180+
}
181+
151182
integrationTest {
152183
useJUnitPlatform()
153184
testLogging.showStandardStreams = true

0 commit comments

Comments
 (0)