Skip to content

Commit 1bec395

Browse files
committed
- Enabled incremental Kotlin compilationboth build configuration and KotlinCompilationProvider.
- Adjusted JVM options to add module opens for compatibility and reordered existing JVM settings for better clarity - Added (commented) compiler flags to consider
1 parent c179291 commit 1bec395

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

.mvn/jvm.config

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120
2-
-Dmaven.wagon.http.retryHandler.requestSentEnabled=true
1+
--add-opens=java.base/java.io=ALL-UNNAMED
2+
--add-opens=java.base/java.lang=ALL-UNNAMED
33
-Dmaven.wagon.http.retryHandler.count=10
4-
-Xmx5g
4+
-Dmaven.wagon.http.retryHandler.requestSentEnabled=true
5+
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120
6+
-Xmx5g

build-parent/pom.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020

2121
<!-- These properties are needed in order for them to be resolvable by the generated projects -->
2222
<compiler-plugin.version>${version.compiler.plugin}</compiler-plugin.version>
23+
<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
2324
<kotlin.version>2.1.21</kotlin.version>
2425
<dokka.version>2.0.0</dokka.version>
2526
<scala.version>2.13.12</scala.version>
2627
<scala-maven-plugin.version>4.9.5</scala-maven-plugin.version>
27-
<!-- not pretty but this is used in the codestarts and we don't want to break compatibility -->
28+
<!-- not pretty, but this is used in the codestarts and we don't want to break compatibility -->
2829
<scala-plugin.version>${scala-maven-plugin.version}</scala-plugin.version>
2930
<jboss-bridger-plugin.version>1.6.Final</jboss-bridger-plugin.version>
3031

@@ -601,6 +602,8 @@
601602
<configuration>
602603
<javaParameters>true</javaParameters>
603604
<jvmTarget>${maven.compiler.release}</jvmTarget>
605+
<languageVersion>2.1</languageVersion>
606+
<apiVersion>2.1</apiVersion>
604607
</configuration>
605608
</plugin>
606609
<plugin>

extensions/kotlin/deployment/src/main/java/io/quarkus/kotlin/deployment/KotlinCompilationProvider.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
package io.quarkus.kotlin.deployment;
22

33
import java.io.File;
4-
import java.util.ArrayList;
5-
import java.util.Collection;
6-
import java.util.Collections;
7-
import java.util.List;
8-
import java.util.Set;
9-
import java.util.StringJoiner;
4+
import java.util.*;
105
import java.util.regex.Matcher;
116
import java.util.regex.Pattern;
127
import java.util.stream.Collectors;
@@ -48,6 +43,17 @@ public void compile(Set<File> filesToCompile, Context context) {
4843
compilerArguments.setJavaParameters(true);
4944
compilerArguments.setSuppressWarnings(true);
5045

46+
compilerArguments.setIncrementalCompilation(true);
47+
48+
// use javac or koltinc to compile java
49+
// compilerArguments.setUseJavac(true); // Kotlinc can compile java sources too
50+
// compilerArguments.setCompileJava(true);
51+
52+
// optional
53+
// compilerArguments.setNoReflect(true); // be careful
54+
// compilerArguments.setNoOptimize(true); // safe for hot reload/dev mode
55+
// compilerArguments.setUseFastJarFileSystem(true);
56+
5157
if (context.getCompilePluginArtifacts() != null && !context.getCompilePluginArtifacts().isEmpty()) {
5258
compilerArguments.setPluginClasspaths(context.getCompilePluginArtifacts().toArray(new String[0]));
5359
}
@@ -68,6 +74,7 @@ public void compile(Set<File> filesToCompile, Context context) {
6874
final String key = matcher.group(2);
6975
final String value = matcher.group(3);
7076
sanitizedOptions.add("plugin:" + pluginId + ":" + key + "=" + value);
77+
log.error("Sanitized option: " + sanitizedOptions);
7178
compilerArguments.setPluginOptions(sanitizedOptions.toArray(new String[0]));
7279
}
7380
}

0 commit comments

Comments
 (0)