From 80271bce02871e670ceb4923cb8e9b68bcde040f Mon Sep 17 00:00:00 2001 From: Dmitrii Krasnov Date: Fri, 29 Aug 2025 13:45:47 +0200 Subject: [PATCH 1/4] Remove unnecessary version fields --- .../compiler/components/KotlinEnvironment.kt | 1 - .../compiler/server/model/bean/VersionInfo.kt | 2 -- versions.json | 27 ------------------- 3 files changed, 30 deletions(-) delete mode 100644 versions.json diff --git a/src/main/kotlin/com/compiler/server/compiler/components/KotlinEnvironment.kt b/src/main/kotlin/com/compiler/server/compiler/components/KotlinEnvironment.kt index 4858bb6c7..5c3ab5e11 100644 --- a/src/main/kotlin/com/compiler/server/compiler/components/KotlinEnvironment.kt +++ b/src/main/kotlin/com/compiler/server/compiler/components/KotlinEnvironment.kt @@ -1,7 +1,6 @@ package com.compiler.server.compiler.components import com.compiler.server.model.bean.LibrariesFile -import com.compiler.server.model.bean.VersionInfo import component.CompilerPluginOption import component.KotlinEnvironment import org.springframework.context.annotation.Bean diff --git a/src/main/kotlin/com/compiler/server/model/bean/VersionInfo.kt b/src/main/kotlin/com/compiler/server/model/bean/VersionInfo.kt index 8fd0f471c..57e798a6e 100644 --- a/src/main/kotlin/com/compiler/server/model/bean/VersionInfo.kt +++ b/src/main/kotlin/com/compiler/server/model/bean/VersionInfo.kt @@ -3,6 +3,4 @@ package com.compiler.server.model.bean data class VersionInfo( val version: String, val stdlibVersion: String, - val latestStable: Boolean = true, - val unstable: Boolean = false ) \ No newline at end of file diff --git a/versions.json b/versions.json deleted file mode 100644 index 119e6031c..000000000 --- a/versions.json +++ /dev/null @@ -1,27 +0,0 @@ -[ - { - "version": "1.2.71" - }, - { - "version": "1.3.72" - }, - { - "version": "1.4.30" - }, - { - "version": "1.5.31" - }, - { - "version": "1.6.21" - }, - { - "version": "1.7.21" - }, - { - "version": "1.8.21" - }, - { - "version": "1.9.23", - "latestStable": true - } -] From 4dd02f7daeda8e0a2646d1e34bf8765d8a43735b Mon Sep 17 00:00:00 2001 From: Dmitrii Krasnov Date: Fri, 29 Aug 2025 13:46:11 +0200 Subject: [PATCH 2/4] KTL-724 Added compiler arguments support We are using `kotlin-compiler-arguments-description` maven dependency for extracting all known compiler arguments for the current kotlin version. We've added an endpoint for getting all known compiler dependencies by the given platform. We've extended `run` and `translate` endpoints with the user's compiler args. --- ...server-version-catalog.settings.gradle.kts | 2 + build.gradle.kts | 23 +- gradle/libs.versions.toml | 11 +- .../server/api/CompilerArgumentResponse.kt | 18 + .../server/api/ProjectFileRequestDto.kt | 6 + .../com/compiler/server/api/RunRequest.kt | 13 + .../com/compiler/server/api/TestRequest.kt | 13 + .../server/api/TranslateComposeWasmRequest.kt | 15 + .../compiler/server/api/TranslateJsRequest.kt | 15 + .../server/api/TranslateWasmRequest.kt | 15 + .../compiler/components/KotlinCompiler.kt | 30 +- .../components/KotlinToJSTranslator.kt | 155 +- .../configuration/ApplicationConfiguration.kt | 1 + .../CompilerArgumentsConfiguration.kt | 82 + .../configuration/ControllersConverters.kt | 12 + .../controllers/CompilerRestController.kt | 181 +- .../controllers/VersionRestController.kt | 14 + .../server/model/ExtendedCompilerArgument.kt | 37 + .../server/model/JsCompilerArguments.kt | 6 + .../com/compiler/server/model/Project.kt | 6 +- .../service/CompilerArgumentsService.kt | 34 + .../server/service/KotlinProjectExecutor.kt | 22 +- .../server/utils/CompilerArgumentsUtil.kt | 549 +++++ .../AbstractCompilerArgumentsValidator.kt | 87 + .../validation/ProjectRequestValidation.kt | 51 + .../ComposeWasmCompilerArgumentsValidator.kt | 9 + .../impl/JsCompilerArgumentsValidator.kt | 9 + .../impl/JvmCompilerArgumentsValidator.kt | 9 + .../impl/WasmCompilerArgumentsValidator.kt | 9 + .../com/compiler/server/CompilerAPITest.kt | 5 +- .../CompilerArgumentsConfigurationTest.kt | 51 + .../server/CompilerArgumentsEndpointTest.kt | 77 + .../compiler/server/ResourceCompileTest.kt | 2 +- .../compiler/server/ResourceE2ECompileTest.kt | 23 +- .../compose-wasm-expected-compiler-args.json | 2022 ++++++++++++++++ .../js-expected-compiler-args.json | 2020 ++++++++++++++++ .../jvm-expected-compiler-args.json | 2116 +++++++++++++++++ .../wasm-expected-compiler-args.json | 2020 ++++++++++++++++ 38 files changed, 9600 insertions(+), 170 deletions(-) create mode 100644 src/main/kotlin/com/compiler/server/api/CompilerArgumentResponse.kt create mode 100644 src/main/kotlin/com/compiler/server/api/ProjectFileRequestDto.kt create mode 100644 src/main/kotlin/com/compiler/server/api/RunRequest.kt create mode 100644 src/main/kotlin/com/compiler/server/api/TestRequest.kt create mode 100644 src/main/kotlin/com/compiler/server/api/TranslateComposeWasmRequest.kt create mode 100644 src/main/kotlin/com/compiler/server/api/TranslateJsRequest.kt create mode 100644 src/main/kotlin/com/compiler/server/api/TranslateWasmRequest.kt create mode 100644 src/main/kotlin/com/compiler/server/configuration/CompilerArgumentsConfiguration.kt create mode 100644 src/main/kotlin/com/compiler/server/controllers/VersionRestController.kt create mode 100644 src/main/kotlin/com/compiler/server/model/ExtendedCompilerArgument.kt create mode 100644 src/main/kotlin/com/compiler/server/model/JsCompilerArguments.kt create mode 100644 src/main/kotlin/com/compiler/server/service/CompilerArgumentsService.kt create mode 100644 src/main/kotlin/com/compiler/server/utils/CompilerArgumentsUtil.kt create mode 100644 src/main/kotlin/com/compiler/server/validation/AbstractCompilerArgumentsValidator.kt create mode 100644 src/main/kotlin/com/compiler/server/validation/ProjectRequestValidation.kt create mode 100644 src/main/kotlin/com/compiler/server/validation/impl/ComposeWasmCompilerArgumentsValidator.kt create mode 100644 src/main/kotlin/com/compiler/server/validation/impl/JsCompilerArgumentsValidator.kt create mode 100644 src/main/kotlin/com/compiler/server/validation/impl/JvmCompilerArgumentsValidator.kt create mode 100644 src/main/kotlin/com/compiler/server/validation/impl/WasmCompilerArgumentsValidator.kt create mode 100644 src/test/kotlin/com/compiler/server/CompilerArgumentsConfigurationTest.kt create mode 100644 src/test/kotlin/com/compiler/server/CompilerArgumentsEndpointTest.kt create mode 100644 src/test/resources/compiler-arguments/compose-wasm-expected-compiler-args.json create mode 100644 src/test/resources/compiler-arguments/js-expected-compiler-args.json create mode 100644 src/test/resources/compiler-arguments/jvm-expected-compiler-args.json create mode 100644 src/test/resources/compiler-arguments/wasm-expected-compiler-args.json diff --git a/build-settings-logic/src/main/kotlin/kotlin-compiler-server-version-catalog.settings.gradle.kts b/build-settings-logic/src/main/kotlin/kotlin-compiler-server-version-catalog.settings.gradle.kts index 9e4b89e2e..ac18c14aa 100644 --- a/build-settings-logic/src/main/kotlin/kotlin-compiler-server-version-catalog.settings.gradle.kts +++ b/build-settings-logic/src/main/kotlin/kotlin-compiler-server-version-catalog.settings.gradle.kts @@ -11,6 +11,7 @@ pluginManagement { logger.info("A custom Kotlin repository ${additionalRepositoryProperty.get()} was added") } mavenLocal() + maven("https://redirector.kotlinlang.org/maven/dev") } } @@ -28,6 +29,7 @@ dependencyResolutionManagement { logger.info("A custom Kotlin repository ${additionalRepositoryProperty.get()} was added") } mavenLocal() + maven("https://redirector.kotlinlang.org/maven/dev") } versionCatalogs { diff --git a/build.gradle.kts b/build.gradle.kts index 0ee27b76f..7dea54376 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,8 +12,8 @@ version = "${libs.versions.kotlin.get()}-SNAPSHOT" val propertyFile = "application.properties" plugins { - alias(libs.plugins.spring.dependency.management) alias(libs.plugins.spring.boot) + alias(libs.plugins.spring.dependency.management) alias(libs.plugins.kotlin.plugin.spring) id("base-kotlin-jvm-conventions") } @@ -36,11 +36,15 @@ val resourceDependency: Configuration by configurations.creating { } dependencies { - annotationProcessor("org.springframework:spring-context-indexer") - implementation("com.google.code.gson:gson") + annotationProcessor(libs.spring.context.indexer) implementation("org.springframework.boot:spring-boot-starter-web") - implementation(libs.springdoc) + implementation("org.springframework.boot:spring-boot-starter-validation") implementation(libs.aws.springboot.container) + implementation(libs.springdoc) + implementation(libs.gson) + implementation(libs.kotlinx.serialization.json) + implementation(libs.kotlin.compiler.arguments.description) + implementation(libs.kotlin.tooling.core) implementation(libs.junit) implementation(libs.logback.logstash.encoder) implementation(libs.kotlin.reflect) @@ -70,6 +74,8 @@ fun buildPropertyFile() { fun generateProperties(prefix: String = "") = """ # this file is autogenerated by build.gradle.kts + server.error.include-message=always + server.error.include-binding-errors=always kotlin.version=${kotlinVersion} policy.file=${prefix + policy} libraries.folder.jvm=${prefix + libJVM} @@ -147,4 +153,13 @@ tasks.withType { doFirst { this@withType.environment("kotlin.wasm.node.path", executablePath) } + + // We disable this on TeamCity, because we don't want to fail this test, + // when compiler server's test run as a K2 user project. + // But for our pull requests we still need to run this test, so we add it to our GitHub action. + if (System.getenv("TEAMCITY_VERSION") != null) { + filter { + excludeTestsMatching("com.compiler.server.CompilerArguments*") + } + } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6328c835b..39c69e386 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -26,6 +26,8 @@ kotlin-stdlib-wasm-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib- kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin" } kotlin-test-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin" } kotlin-compiler = { group = "org.jetbrains.kotlin", name = "kotlin-compiler", version.ref = "kotlin" } +kotlin-tooling-core = { group = "org.jetbrains.kotlin", name = "kotlin-tooling-core", version.ref = "kotlin" } +kotlin-compiler-arguments-description = { group = "org.jetbrains.kotlin", name = "kotlin-compiler-arguments-description", version.ref = "kotlin" } kotlin-script-runtime = { group = "org.jetbrains.kotlin", name = "kotlin-script-runtime", version.ref = "kotlin" } kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" } kotlin-dom-api-compat = { group = "org.jetbrains.kotlin", name = "kotlin-dom-api-compat", version.ref = "kotlin" } @@ -35,10 +37,9 @@ kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-cor kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinx-datetime" } kotlinx-io-bytestring = { group = "org.jetbrains.kotlinx", name = "kotlinx-io-bytestring", version.ref = "kotlinx-io" } kotlinx-io-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-io-core", version.ref = "kotlinx-io" } +kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinx-serialization" } kotlinx-serialization-json-jvm = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json-jvm", version.ref = "kotlinx-serialization" } kotlinx-serialization-core-jvm = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-core-jvm", version.ref = "kotlinx-serialization" } -springdoc = { group = "org.springdoc", name = "springdoc-openapi-starter-webmvc-ui", version.ref = "springdoc" } -aws-springboot-container = { group = "com.amazonaws.serverless", name = "aws-serverless-java-container-springboot3", version.ref = "aws-serverless-java-container-springboot3" } junit = { group = "junit", name = "junit", version.ref = "junit" } logback-logstash-encoder = { group = "net.logstash.logback", name = "logstash-logback-encoder", version.ref = "logstash-logback-encoder" } skiko-js-wasm-runtime = { group = "org.jetbrains.skiko", name = "skiko-js-wasm-runtime", version.ref = "skiko" } @@ -57,6 +58,12 @@ compose-material3 = { group = "org.jetbrains.compose.material3", name = "materia compose-components-resources = { group = "org.jetbrains.compose.components", name = "components-resources", version.ref = "compose" } kotlin-serialization-plugin = {group= "org.jetbrains.kotlin", name="kotlin-serialization-compiler-plugin", version.ref = "kotlin"} gradle-develocity = {group = "com.gradle", name= "develocity-gradle-plugin", version.ref = "gradle-develocity"} +gson = { group = "com.google.code.gson", name = "gson"} + +#spring stack dependencies +aws-springboot-container = { group = "com.amazonaws.serverless", name = "aws-serverless-java-container-springboot3", version.ref = "aws-serverless-java-container-springboot3" } +spring-context-indexer = { group = "org.springframework", name = "spring-context-indexer"} +springdoc = { group = "org.springdoc", name = "springdoc-openapi-starter-webmvc-ui", version.ref = "springdoc" } [bundles] jackson = ["jackson-databind", "jackson-core", "jackson-annotations"] diff --git a/src/main/kotlin/com/compiler/server/api/CompilerArgumentResponse.kt b/src/main/kotlin/com/compiler/server/api/CompilerArgumentResponse.kt new file mode 100644 index 000000000..84e157cb5 --- /dev/null +++ b/src/main/kotlin/com/compiler/server/api/CompilerArgumentResponse.kt @@ -0,0 +1,18 @@ +package com.compiler.server.api + +import com.compiler.server.model.ExtendedCompilerArgumentValue +import com.fasterxml.jackson.annotation.JsonTypeInfo + +data class CompilerArgumentResponse(val compilerArguments: Set) { + + data class CompilerArgument( + val name: String, + val shortName: String?, + val description: String?, + @field:JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, property = "type") + val type: ExtendedCompilerArgumentValue<*>, + val disabled: Boolean, + val predefinedValues: Any? + ) +} + diff --git a/src/main/kotlin/com/compiler/server/api/ProjectFileRequestDto.kt b/src/main/kotlin/com/compiler/server/api/ProjectFileRequestDto.kt new file mode 100644 index 000000000..3619417f0 --- /dev/null +++ b/src/main/kotlin/com/compiler/server/api/ProjectFileRequestDto.kt @@ -0,0 +1,6 @@ +package com.compiler.server.api + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties + +@JsonIgnoreProperties(ignoreUnknown = true) +data class ProjectFileRequestDto(val text: String = "", val name: String = "") \ No newline at end of file diff --git a/src/main/kotlin/com/compiler/server/api/RunRequest.kt b/src/main/kotlin/com/compiler/server/api/RunRequest.kt new file mode 100644 index 000000000..5fb47f417 --- /dev/null +++ b/src/main/kotlin/com/compiler/server/api/RunRequest.kt @@ -0,0 +1,13 @@ +package com.compiler.server.api + +import com.compiler.server.model.ProjectType +import com.compiler.server.validation.CompilerArgumentsConstraint +import com.fasterxml.jackson.annotation.JsonIgnoreProperties + +@JsonIgnoreProperties(ignoreUnknown = true) +data class RunRequest( + val args: String = "", + val files: List = listOf(), + @CompilerArgumentsConstraint(ProjectType.JAVA) + val compilerArguments: Map = emptyMap() +) diff --git a/src/main/kotlin/com/compiler/server/api/TestRequest.kt b/src/main/kotlin/com/compiler/server/api/TestRequest.kt new file mode 100644 index 000000000..78859e103 --- /dev/null +++ b/src/main/kotlin/com/compiler/server/api/TestRequest.kt @@ -0,0 +1,13 @@ +package com.compiler.server.api + +import com.compiler.server.model.ProjectType +import com.compiler.server.validation.CompilerArgumentsConstraint +import com.fasterxml.jackson.annotation.JsonIgnoreProperties + +@JsonIgnoreProperties(ignoreUnknown = true) +data class TestRequest( + val args: String = "", + val files: List = listOf(), + @CompilerArgumentsConstraint(ProjectType.JAVA) + val compilerArguments: Map = emptyMap() +) diff --git a/src/main/kotlin/com/compiler/server/api/TranslateComposeWasmRequest.kt b/src/main/kotlin/com/compiler/server/api/TranslateComposeWasmRequest.kt new file mode 100644 index 000000000..7d92723f3 --- /dev/null +++ b/src/main/kotlin/com/compiler/server/api/TranslateComposeWasmRequest.kt @@ -0,0 +1,15 @@ +package com.compiler.server.api + +import com.compiler.server.model.ProjectType +import com.compiler.server.validation.CompilerArgumentsConstraint +import com.fasterxml.jackson.annotation.JsonIgnoreProperties + +@JsonIgnoreProperties(ignoreUnknown = true) +class TranslateComposeWasmRequest( + val args: String = "", + val files: List = listOf(), + @CompilerArgumentsConstraint(ProjectType.COMPOSE_WASM) + val firstPhaseCompilerArguments: Map = emptyMap(), + @CompilerArgumentsConstraint(ProjectType.COMPOSE_WASM) + val secondPhaseCompilerArguments: Map = emptyMap() +) \ No newline at end of file diff --git a/src/main/kotlin/com/compiler/server/api/TranslateJsRequest.kt b/src/main/kotlin/com/compiler/server/api/TranslateJsRequest.kt new file mode 100644 index 000000000..8f41c3272 --- /dev/null +++ b/src/main/kotlin/com/compiler/server/api/TranslateJsRequest.kt @@ -0,0 +1,15 @@ +package com.compiler.server.api + +import com.compiler.server.model.ProjectType +import com.compiler.server.validation.CompilerArgumentsConstraint +import com.fasterxml.jackson.annotation.JsonIgnoreProperties + +@JsonIgnoreProperties(ignoreUnknown = true) +data class TranslateJsRequest( + val args: String = "", + val files: List = listOf(), + @CompilerArgumentsConstraint(ProjectType.JS) + val firstPhaseCompilerArguments: Map = emptyMap(), + @CompilerArgumentsConstraint(ProjectType.JS) + val secondPhaseCompilerArguments: Map = emptyMap() +) diff --git a/src/main/kotlin/com/compiler/server/api/TranslateWasmRequest.kt b/src/main/kotlin/com/compiler/server/api/TranslateWasmRequest.kt new file mode 100644 index 000000000..61758f7bc --- /dev/null +++ b/src/main/kotlin/com/compiler/server/api/TranslateWasmRequest.kt @@ -0,0 +1,15 @@ +package com.compiler.server.api + +import com.compiler.server.model.ProjectType +import com.compiler.server.validation.CompilerArgumentsConstraint +import com.fasterxml.jackson.annotation.JsonIgnoreProperties + +@JsonIgnoreProperties(ignoreUnknown = true) +class TranslateWasmRequest( + val args: String = "", + val files: List = listOf(), + @CompilerArgumentsConstraint(ProjectType.WASM) + val firstPhaseCompilerArguments: Map = emptyMap(), + @CompilerArgumentsConstraint(ProjectType.WASM) + val secondPhaseCompilerArguments: Map = emptyMap() +) \ No newline at end of file diff --git a/src/main/kotlin/com/compiler/server/compiler/components/KotlinCompiler.kt b/src/main/kotlin/com/compiler/server/compiler/components/KotlinCompiler.kt index 3e7cb16f8..835282321 100644 --- a/src/main/kotlin/com/compiler/server/compiler/components/KotlinCompiler.kt +++ b/src/main/kotlin/com/compiler/server/compiler/components/KotlinCompiler.kt @@ -2,11 +2,13 @@ package com.compiler.server.compiler.components import com.compiler.server.executor.CommandLineArgument import com.compiler.server.executor.JavaExecutor +import com.compiler.server.model.ExtendedCompilerArgument import com.compiler.server.model.JvmExecutionResult import com.compiler.server.model.OutputDirectory import com.compiler.server.model.ProjectFile import com.compiler.server.model.bean.LibrariesFile import com.compiler.server.model.toExceptionDescriptor +import com.compiler.server.utils.CompilerArgumentsUtil import component.KotlinEnvironment import executors.JUnitExecutors import executors.JavaRunnerExecutor @@ -32,7 +34,9 @@ class KotlinCompiler( private val kotlinEnvironment: KotlinEnvironment, private val javaExecutor: JavaExecutor, private val librariesFile: LibrariesFile, - @Value("\${policy.file}") private val policyFileName: String + @Value("\${policy.file}") private val policyFileName: String, + private val compilerArgumentsUtil: CompilerArgumentsUtil, + private val jvmCompilerArguments: Set, ) { private val policyFile = File(policyFileName) @@ -59,8 +63,8 @@ class KotlinCompiler( ?.joinToString("\n\n") } - fun run(files: List, addByteCode: Boolean, args: String): JvmExecutionResult { - return execute(files, addByteCode) { output, compiled -> + fun run(files: List, addByteCode: Boolean, args: String, userCompilerArguments: Map): JvmExecutionResult { + return execute(files, addByteCode, userCompilerArguments) { output, compiled -> val mainClass = JavaRunnerExecutor::class.java.name val compiledMainClass = when (compiled.mainClasses.size) { 0 -> return@execute JvmExecutionResult( @@ -82,8 +86,8 @@ class KotlinCompiler( } } - fun test(files: List, addByteCode: Boolean): JvmExecutionResult { - return execute(files, addByteCode) { output, _ -> + fun test(files: List, addByteCode: Boolean, userCompilerArguments: Map): JvmExecutionResult { + return execute(files, addByteCode, userCompilerArguments) { output, _ -> val mainClass = JUnitExecutors::class.java.name javaExecutor.execute(argsFrom(mainClass, output, listOf(output.path.toString()))) .asJUnitExecutionResult() @@ -91,17 +95,12 @@ class KotlinCompiler( } @OptIn(ExperimentalPathApi::class) - fun compile(files: List): CompilationResult = usingTempDirectory { inputDir -> + fun compile(files: List, userCompilerArguments: Map): CompilationResult = usingTempDirectory { inputDir -> val ioFiles = files.writeToIoFiles(inputDir) usingTempDirectory { outputDir -> - val arguments = - ioFiles.map { it.absolutePathString() } + KotlinEnvironment.additionalCompilerArguments + listOf( - "-cp", kotlinEnvironment.classpath.joinToString(PATH_SEPARATOR) { it.absolutePath }, - "-module-name", "web-module", - "-no-stdlib", "-no-reflect", - "-progressive", - "-d", outputDir.absolutePathString(), - ) + kotlinEnvironment.compilerPlugins.map { plugin -> "-Xplugin=${plugin.absolutePath}" } + val arguments = ioFiles.map { it.absolutePathString() } + + compilerArgumentsUtil.convertCompilerArgumentsToCompilationString(jvmCompilerArguments, compilerArgumentsUtil.PREDEFINED_JVM_ARGUMENTS, userCompilerArguments) + + listOf("-d", outputDir.absolutePathString()) K2JVMCompiler().tryCompilation(inputDir, ioFiles, arguments) { val outputFiles = buildMap { outputDir.visitFileTree { @@ -142,9 +141,10 @@ class KotlinCompiler( private fun execute( files: List, addByteCode: Boolean, + userCompilerArguments: Map, block: (output: OutputDirectory, compilation: JvmClasses) -> JvmExecutionResult ): JvmExecutionResult = try { - when (val compilationResult = compile(files)) { + when (val compilationResult = compile(files, userCompilerArguments)) { is Compiled -> { usingTempDirectory { outputDir -> val output = write(compilationResult.result, outputDir) diff --git a/src/main/kotlin/com/compiler/server/compiler/components/KotlinToJSTranslator.kt b/src/main/kotlin/com/compiler/server/compiler/components/KotlinToJSTranslator.kt index d52f28899..33e38a5f5 100644 --- a/src/main/kotlin/com/compiler/server/compiler/components/KotlinToJSTranslator.kt +++ b/src/main/kotlin/com/compiler/server/compiler/components/KotlinToJSTranslator.kt @@ -1,8 +1,10 @@ package com.compiler.server.compiler.components import com.compiler.server.model.* +import com.compiler.server.utils.CompilerArgumentsUtil +import com.compiler.server.utils.JS_DEFAULT_MODULE_NAME +import com.compiler.server.utils.WASM_DEFAULT_MODULE_NAME import com.fasterxml.jackson.databind.ObjectMapper -import component.KotlinEnvironment import org.jetbrains.kotlin.cli.js.K2JSCompiler import org.springframework.stereotype.Service import kotlin.io.path.div @@ -11,7 +13,10 @@ import kotlin.io.path.readText @Service class KotlinToJSTranslator( - private val kotlinEnvironment: KotlinEnvironment, + private val compilerArgumentsUtil: CompilerArgumentsUtil, + private val jsCompilerArguments: Set, + private val wasmCompilerArguments: Set, + private val composeWasmCompilerArguments: Set ) { companion object { internal const val JS_IR_CODE_BUFFER = "playground.output?.buffer_1;\n" @@ -30,9 +35,10 @@ class KotlinToJSTranslator( fun translateJs( files: List, arguments: List, - translate: (List, List) -> CompilationResult + jsCompilerArguments: JsCompilerArguments, + translate: (List, List, JsCompilerArguments) -> CompilationResult ): TranslationJSResult = try { - val compilationResult = translate(files, arguments) + val compilationResult = translate(files, arguments, jsCompilerArguments) val jsCode = when (compilationResult) { is Compiled -> compilationResult.result is NotCompiled -> null @@ -46,30 +52,15 @@ class KotlinToJSTranslator( files: List, debugInfo: Boolean, projectType: ProjectType, - translate: (List, List, List, List, Boolean) -> CompilationResult + userCompilerArguments: JsCompilerArguments, + translate: (List, ProjectType, Boolean, JsCompilerArguments) -> CompilationResult ): TranslationResultWithJsCode { return try { - val (dependencies, compilerPlugins, compilerPluginOptions) = when (projectType) { - ProjectType.WASM -> listOf( - kotlinEnvironment.WASM_LIBRARIES, - emptyList(), - emptyList() - ) - - ProjectType.COMPOSE_WASM -> listOf( - kotlinEnvironment.COMPOSE_WASM_LIBRARIES, - kotlinEnvironment.COMPOSE_WASM_COMPILER_PLUGINS, - kotlinEnvironment.composeWasmCompilerPluginOptions - ) - - else -> throw IllegalStateException("Wasm should have wasm or compose-wasm project type") - } val compilationResult = translate( files, - dependencies, - compilerPlugins, - compilerPluginOptions, - debugInfo + projectType, + debugInfo, + userCompilerArguments ) val wasmCompilationOutput = when (compilationResult) { is Compiled -> compilationResult.result @@ -87,38 +78,33 @@ class KotlinToJSTranslator( } } - fun doTranslateWithIr(files: List, arguments: List): CompilationResult = + fun doTranslateWithIr( + files: List, + arguments: List, + userCompilerArguments: JsCompilerArguments): CompilationResult = usingTempDirectory { inputDir -> - val moduleName = "playground" usingTempDirectory { outputDir -> val ioFiles = files.writeToIoFiles(inputDir) val k2JSCompiler = K2JSCompiler() val filePaths = ioFiles.map { it.toFile().canonicalPath } val klibPath = (outputDir / "klib").toFile().canonicalPath - val additionalCompilerArgumentsForKLib = listOf( - "-Xreport-all-warnings", - "-Wextra", - "-Xir-produce-klib-dir", - "-libraries=${kotlinEnvironment.JS_LIBRARIES.joinToString(PATH_SEPARATOR)}", - "-ir-output-dir=$klibPath", - "-ir-output-name=$moduleName", - ) + val additionalCompilerArgumentsForKLib = + compilerArgumentsUtil.convertCompilerArgumentsToCompilationString( + jsCompilerArguments, + compilerArgumentsUtil.PREDEFINED_JS_FIRST_PHASE_ARGUMENTS, + userCompilerArguments.firstPhase + ) + "-ir-output-dir=$klibPath" k2JSCompiler.tryCompilation(inputDir, ioFiles, filePaths + additionalCompilerArgumentsForKLib) .flatMap { - k2JSCompiler.tryCompilation( - inputDir, ioFiles, listOf( - "-Xreport-all-warnings", - "-Wextra", - "-Xir-produce-js", - "-Xir-dce", - "-Xinclude=$klibPath", - "-libraries=${kotlinEnvironment.JS_LIBRARIES.joinToString(PATH_SEPARATOR)}", - "-ir-output-dir=${(outputDir / "js").toFile().canonicalPath}", - "-ir-output-name=$moduleName", - ) - ) + val secondPhaseArguments = + compilerArgumentsUtil.convertCompilerArgumentsToCompilationString( + jsCompilerArguments, + compilerArgumentsUtil.PREDEFINED_JS_SECOND_PHASE_ARGUMENTS, + userCompilerArguments.secondPhase + ) + "-ir-output-dir=${(outputDir / "js").toFile().canonicalPath}" + "-Xinclude=$klibPath" + k2JSCompiler.tryCompilation(inputDir, ioFiles, secondPhaseArguments) } - .map { (outputDir / "js" / "$moduleName.js").readText() } + .map { (outputDir / "js" / "$JS_DEFAULT_MODULE_NAME.js").readText() } .map { it.withMainArgumentsIr(arguments) } .map(::redirectOutput) } @@ -137,58 +123,57 @@ class KotlinToJSTranslator( fun doTranslateWithWasm( files: List, - dependencies: List, - compilerPlugins: List, - compilerPluginOptions: List, + projectType: ProjectType, debugInfo: Boolean, + userCompilerArguments: JsCompilerArguments ): CompilationResult = usingTempDirectory { inputDir -> - val moduleName = "playground" usingTempDirectory { outputDir -> + val (defaultCompilerArgs, firstPhasePredefinedArguments, secondPhasePredefinedArguments) = when (projectType) { + ProjectType.WASM -> Triple( + wasmCompilerArguments, + compilerArgumentsUtil.PREDEFINED_WASM_FIRST_PHASE_ARGUMENTS, + compilerArgumentsUtil.PREDEFINED_WASM_SECOND_PHASE_ARGUMENTS, + ) + + ProjectType.COMPOSE_WASM -> Triple( + composeWasmCompilerArguments, + compilerArgumentsUtil.PREDEFINED_COMPOSE_WASM_FIRST_PHASE_ARGUMENTS, + compilerArgumentsUtil.PREDEFINED_COMPOSE_WASM_SECOND_PHASE_ARGUMENTS + ) + + else -> throw IllegalStateException("Wasm should have wasm or compose-wasm project type") + } val ioFiles = files.writeToIoFiles(inputDir) val k2JSCompiler = K2JSCompiler() val filePaths = ioFiles.map { it.toFile().canonicalPath } val klibPath = (outputDir / "klib").toFile().canonicalPath - val compilerPluginsArgs: List = compilerPlugins - .takeIf { it.isNotEmpty() } - ?.let { plugins -> - plugins.map { - "-Xplugin=$it" - } + compilerPluginOptions.map { - "-P=$it" - } - } ?: emptyList() - val additionalCompilerArgumentsForKLib: List = listOf( - "-Xreport-all-warnings", - "-Wextra", - "-Xwasm", - "-Xir-produce-klib-dir", - "-libraries=${dependencies.joinToString(PATH_SEPARATOR)}", - "-ir-output-dir=$klibPath", - "-ir-output-name=$moduleName", - ) + compilerPluginsArgs + + val additionalCompilerArgumentsForKLib = + compilerArgumentsUtil.convertCompilerArgumentsToCompilationString( + defaultCompilerArgs, + firstPhasePredefinedArguments, + userCompilerArguments.firstPhase + ) + "-ir-output-dir=$klibPath" k2JSCompiler.tryCompilation(inputDir, ioFiles, filePaths + additionalCompilerArgumentsForKLib) .flatMap { - k2JSCompiler.tryCompilation( - inputDir, ioFiles, mutableListOf( - "-Xreport-all-warnings", - "-Wextra", - "-Xwasm", - "-Xir-produce-js", - "-Xir-dce", - "-Xinclude=$klibPath", - "-libraries=${dependencies.joinToString(PATH_SEPARATOR)}", - "-ir-output-dir=${(outputDir / "wasm").toFile().canonicalPath}", - "-ir-output-name=$moduleName", - ).also { if (debugInfo) it.add("-Xwasm-generate-wat") }) + val secondPhaseArguments = (compilerArgumentsUtil.convertCompilerArgumentsToCompilationString( + defaultCompilerArgs, + secondPhasePredefinedArguments, + userCompilerArguments.secondPhase + ) + "-ir-output-dir=${(outputDir / "wasm").toFile().canonicalPath}" + "-Xinclude=$klibPath").toMutableList() + + if (debugInfo) secondPhaseArguments.add("-Xwasm-generate-wat") + + k2JSCompiler.tryCompilation(inputDir, ioFiles, secondPhaseArguments) } .map { WasmTranslationSuccessfulOutput( - jsCode = (outputDir / "wasm" / "$moduleName.uninstantiated.mjs").readText(), - jsInstantiated = (outputDir / "wasm" / "$moduleName.mjs").readText(), - wasm = (outputDir / "wasm" / "$moduleName.wasm").readBytes(), - wat = if (debugInfo) (outputDir / "wasm" / "$moduleName.wat").readText() else null, + jsCode = (outputDir / "wasm" / "$WASM_DEFAULT_MODULE_NAME.uninstantiated.mjs").readText(), + jsInstantiated = (outputDir / "wasm" / "$WASM_DEFAULT_MODULE_NAME.mjs").readText(), + wasm = (outputDir / "wasm" / "$WASM_DEFAULT_MODULE_NAME.wasm").readBytes(), + wat = if (debugInfo) (outputDir / "wasm" / "$WASM_DEFAULT_MODULE_NAME.wat").readText() else null, ) } } diff --git a/src/main/kotlin/com/compiler/server/configuration/ApplicationConfiguration.kt b/src/main/kotlin/com/compiler/server/configuration/ApplicationConfiguration.kt index 0a3426694..6d752483d 100644 --- a/src/main/kotlin/com/compiler/server/configuration/ApplicationConfiguration.kt +++ b/src/main/kotlin/com/compiler/server/configuration/ApplicationConfiguration.kt @@ -19,6 +19,7 @@ class ApplicationConfiguration( ) : WebMvcConfigurer { override fun addFormatters(registry: FormatterRegistry) { registry.addConverter(ProjectConverter()) + registry.addConverter(ProjectTypeConverter()) } @Bean diff --git a/src/main/kotlin/com/compiler/server/configuration/CompilerArgumentsConfiguration.kt b/src/main/kotlin/com/compiler/server/configuration/CompilerArgumentsConfiguration.kt new file mode 100644 index 000000000..694455c15 --- /dev/null +++ b/src/main/kotlin/com/compiler/server/configuration/CompilerArgumentsConfiguration.kt @@ -0,0 +1,82 @@ +package com.compiler.server.configuration + +import com.compiler.server.model.ExtendedCompilerArgument +import com.compiler.server.model.ProjectType +import com.compiler.server.utils.COMPILER_ARGUMENTS_JSON +import com.compiler.server.utils.CompilerArgumentsUtil +import com.compiler.server.validation.AbstractCompilerArgumentsValidator +import kotlinx.serialization.json.Json +import org.jetbrains.kotlin.arguments.dsl.base.KotlinCompilerArguments +import org.jetbrains.kotlin.utils.keysToMap +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration + +@Configuration +class CompilerArgumentsConfiguration { + + @Bean + fun kotlinCompilerArguments() = collectCompilerArguments() + + @Bean + fun jvmCompilerArguments( + kotlinCompilerArguments: KotlinCompilerArguments, + compilerArgumentsUtil: CompilerArgumentsUtil + ): Set { + return compilerArgumentsUtil.collectJvmArguments(kotlinCompilerArguments) + } + + @Bean + fun jsCompilerArguments( + kotlinCompilerArguments: KotlinCompilerArguments, + compilerArgumentsUtil: CompilerArgumentsUtil + ): Set { + return compilerArgumentsUtil.collectJsArguments(kotlinCompilerArguments) + } + + @Bean + fun wasmCompilerArguments( + kotlinCompilerArguments: KotlinCompilerArguments, + compilerArgumentsUtil: CompilerArgumentsUtil + ): Set { + return compilerArgumentsUtil.collectWasmArguments(kotlinCompilerArguments) + } + + @Bean + fun composeWasmCompilerArguments( + kotlinCompilerArguments: KotlinCompilerArguments, + compilerArgumentsUtil: CompilerArgumentsUtil + ): Set { + return compilerArgumentsUtil.collectComposeWasmArguments(kotlinCompilerArguments) + } + + @Bean + fun compilerArgumentsValidators( + jvmCompilerArgumentsValidator: AbstractCompilerArgumentsValidator, + jsCompilerArgumentsValidator: AbstractCompilerArgumentsValidator, + wasmCompilerArgumentsValidator: AbstractCompilerArgumentsValidator, + composeWasmCompilerArgumentsValidator: AbstractCompilerArgumentsValidator + ): Map { + return ProjectType.entries.keysToMap { + when (it) { + ProjectType.JAVA, ProjectType.JUNIT -> jvmCompilerArgumentsValidator + ProjectType.JS, ProjectType.JS_IR, ProjectType.CANVAS -> jsCompilerArgumentsValidator + ProjectType.WASM -> wasmCompilerArgumentsValidator + ProjectType.COMPOSE_WASM -> composeWasmCompilerArgumentsValidator + } + } + } + + private fun collectCompilerArguments(): KotlinCompilerArguments { + val jsonConverter = Json { + prettyPrint = true + encodeDefaults = true + } + + val compilerArgumentsJsonString = + KotlinCompilerArguments::class.java.classLoader + .getResource(COMPILER_ARGUMENTS_JSON)?.readText() + ?: error("Can't find $COMPILER_ARGUMENTS_JSON in the classpath") + + return jsonConverter.decodeFromString(compilerArgumentsJsonString) + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/compiler/server/configuration/ControllersConverters.kt b/src/main/kotlin/com/compiler/server/configuration/ControllersConverters.kt index 05c42addc..b27025a33 100644 --- a/src/main/kotlin/com/compiler/server/configuration/ControllersConverters.kt +++ b/src/main/kotlin/com/compiler/server/configuration/ControllersConverters.kt @@ -1,9 +1,21 @@ package com.compiler.server.configuration import com.compiler.server.model.Project +import com.compiler.server.model.ProjectType import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import org.springframework.core.convert.converter.Converter +import org.springframework.http.HttpStatus +import org.springframework.web.server.ResponseStatusException class ProjectConverter : Converter { override fun convert(source: String): Project = jacksonObjectMapper().readValue(source, Project::class.java) +} + +class ProjectTypeConverter : Converter { + override fun convert(source: String): ProjectType = + ProjectType.entries.firstOrNull { it.id == source } + ?: throw ResponseStatusException( + HttpStatus.BAD_REQUEST, + "Unknown projectType '$source'" + ) } \ No newline at end of file diff --git a/src/main/kotlin/com/compiler/server/controllers/CompilerRestController.kt b/src/main/kotlin/com/compiler/server/controllers/CompilerRestController.kt index 92c219c54..e6f5e8f9c 100644 --- a/src/main/kotlin/com/compiler/server/controllers/CompilerRestController.kt +++ b/src/main/kotlin/com/compiler/server/controllers/CompilerRestController.kt @@ -1,56 +1,143 @@ package com.compiler.server.controllers -import com.compiler.server.model.* -import com.compiler.server.model.bean.VersionInfo +import com.compiler.server.api.CompilerArgumentResponse +import com.compiler.server.api.RunRequest +import com.compiler.server.api.TestRequest +import com.compiler.server.api.TranslateComposeWasmRequest +import com.compiler.server.api.TranslateJsRequest +import com.compiler.server.api.TranslateWasmRequest +import com.compiler.server.model.CompilerDiagnostics +import com.compiler.server.model.ExecutionResult +import com.compiler.server.model.KotlinTranslatableCompiler +import com.compiler.server.model.Project +import com.compiler.server.model.ProjectFile +import com.compiler.server.model.ProjectType +import com.compiler.server.model.TranslationResultWithJsCode +import com.compiler.server.service.CompilerArgumentsService import com.compiler.server.service.KotlinProjectExecutor -import org.springframework.web.bind.annotation.* +import jakarta.validation.Valid +import org.jetbrains.kotlin.utils.mapToSetOrEmpty +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.PostMapping +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.RestController @RestController @RequestMapping(value = ["/api/compiler", "/api/**/compiler"]) -class CompilerRestController(private val kotlinProjectExecutor: KotlinProjectExecutor) { - @PostMapping("/run") - fun executeKotlinProjectEndpoint( - @RequestBody project: Project, - @RequestParam(defaultValue = "false") addByteCode: Boolean, - ): ExecutionResult { - return kotlinProjectExecutor.run(project, addByteCode) - } - - @PostMapping("/test") - fun testKotlinProjectEndpoint( - @RequestBody project: Project, - @RequestParam(defaultValue = "false") addByteCode: Boolean, - ): ExecutionResult { - return kotlinProjectExecutor.test(project, addByteCode) - } - - @PostMapping("/translate") - fun translateKotlinProjectEndpoint( - @RequestBody project: Project, - @RequestParam(defaultValue = "js") compiler: String, - @RequestParam(defaultValue = "false") debugInfo: Boolean - ): TranslationResultWithJsCode { - return when (KotlinTranslatableCompiler.valueOf(compiler.uppercase().replace("-", "_"))) { - KotlinTranslatableCompiler.JS -> kotlinProjectExecutor.convertToJsIr(project) - KotlinTranslatableCompiler.WASM -> kotlinProjectExecutor.convertToWasm(project, debugInfo) - KotlinTranslatableCompiler.COMPOSE_WASM -> kotlinProjectExecutor.convertToWasm(project, debugInfo) +class CompilerRestController( + private val kotlinProjectExecutor: KotlinProjectExecutor, + private val compilerArgumentsService: CompilerArgumentsService +) { + + @PostMapping("/run") + fun executeKotlinProjectEndpoint( + @RequestBody @Valid request: RunRequest, + @RequestParam(defaultValue = "false") addByteCode: Boolean, + ): ExecutionResult { + return kotlinProjectExecutor.run( + Project( + args = request.args, + files = request.files.map { ProjectFile(name = it.name, text = it.text) }, + compilerArguments = listOf(request.compilerArguments) + ), addByteCode + ) } - } - - @PostMapping("/complete") - fun getKotlinCompleteEndpoint( - @RequestBody project: Project, - @RequestParam line: Int, - @RequestParam ch: Int - ) = kotlinProjectExecutor.complete(project, line, ch) - - @PostMapping("/highlight") - fun highlightEndpoint(@RequestBody project: Project): CompilerDiagnostics = - kotlinProjectExecutor.highlight(project) -} -@RestController -class VersionRestController(private val kotlinProjectExecutor: KotlinProjectExecutor) { - @GetMapping("/versions") - fun getKotlinVersionEndpoint(): List = listOf(kotlinProjectExecutor.getVersion()) + @PostMapping("/test") + fun testKotlinProjectEndpoint( + @RequestBody @Valid request: TestRequest, + @RequestParam(defaultValue = "false") addByteCode: Boolean, + ): ExecutionResult { + return kotlinProjectExecutor.test( + Project( + args = request.args, + files = request.files.map { ProjectFile(name = it.name, text = it.text) }, + compilerArguments = listOf(request.compilerArguments) + ), addByteCode + ) + } + + @PostMapping("/translate/js") + fun translateJs(@RequestBody @Valid request: TranslateJsRequest): TranslationResultWithJsCode { + return kotlinProjectExecutor.convertToJsIr( + Project( + args = request.args, + files = request.files.map { ProjectFile(name = it.name, text = it.text) }, + compilerArguments = listOf(request.firstPhaseCompilerArguments, request.secondPhaseCompilerArguments) + ) + ) + } + + @PostMapping("/translate/wasm") + fun translateWasm( + @RequestBody @Valid request: TranslateWasmRequest, + ): TranslationResultWithJsCode { + return kotlinProjectExecutor.convertToWasm( + Project( + args = request.args, + files = request.files.map { ProjectFile(name = it.name, text = it.text) }, + confType = ProjectType.WASM, + compilerArguments = listOf(request.firstPhaseCompilerArguments, request.secondPhaseCompilerArguments)) + ) + } + + @PostMapping("/translate/compose-wasm") + fun translateWasmCompose( + @RequestBody @Valid request: TranslateComposeWasmRequest, + ): TranslationResultWithJsCode { + return kotlinProjectExecutor.convertToWasm( + Project( + args = request.args, + files = request.files.map { ProjectFile(name = it.name, text = it.text) }, + confType = ProjectType.COMPOSE_WASM, + compilerArguments = listOf(request.firstPhaseCompilerArguments, request.secondPhaseCompilerArguments)) + ) + } + + @PostMapping("/complete") + fun getKotlinCompleteEndpoint( + @RequestBody project: Project, + @RequestParam line: Int, + @RequestParam ch: Int + ) = kotlinProjectExecutor.complete(project, line, ch) + + @PostMapping("/highlight") + fun highlightEndpoint(@RequestBody project: Project): CompilerDiagnostics = + kotlinProjectExecutor.highlight(project) + + + @GetMapping("/compiler-arguments") + fun getCompilerArguments( + @RequestParam projectType: ProjectType, + ): CompilerArgumentResponse = + CompilerArgumentResponse( + compilerArgumentsService.getCompilerArguments(projectType) + .mapToSetOrEmpty { + CompilerArgumentResponse.CompilerArgument( + it.name, + it.shortName, + it.description, + it.type, + it.disabled, + it.predefinedValues + ) + } + ) + + @PostMapping("/translate") + @Deprecated("Use /translate/wasm or /translate/js instead") + fun translate( + @RequestBody @Valid project: Project, + @RequestParam(defaultValue = "js") compiler: String, + @RequestParam(defaultValue = "false") debugInfo: Boolean + ): TranslationResultWithJsCode { + return when (KotlinTranslatableCompiler.valueOf(compiler.uppercase().replace("-", "_"))) { + KotlinTranslatableCompiler.JS -> kotlinProjectExecutor.convertToJsIr(project) + KotlinTranslatableCompiler.WASM -> kotlinProjectExecutor.convertToWasm(project, debugInfo) + KotlinTranslatableCompiler.COMPOSE_WASM -> kotlinProjectExecutor.convertToWasm(project, debugInfo) + } + } } + diff --git a/src/main/kotlin/com/compiler/server/controllers/VersionRestController.kt b/src/main/kotlin/com/compiler/server/controllers/VersionRestController.kt new file mode 100644 index 000000000..84a633b0e --- /dev/null +++ b/src/main/kotlin/com/compiler/server/controllers/VersionRestController.kt @@ -0,0 +1,14 @@ +package com.compiler.server.controllers + +import com.compiler.server.model.bean.VersionInfo +import com.compiler.server.service.KotlinProjectExecutor +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController + +@RestController +@RequestMapping("/versions") +class VersionRestController(private val kotlinProjectExecutor: KotlinProjectExecutor) { + @GetMapping + fun getKotlinVersionEndpoint(): List = listOf(kotlinProjectExecutor.getVersion()) +} \ No newline at end of file diff --git a/src/main/kotlin/com/compiler/server/model/ExtendedCompilerArgument.kt b/src/main/kotlin/com/compiler/server/model/ExtendedCompilerArgument.kt new file mode 100644 index 000000000..ae09c0d1e --- /dev/null +++ b/src/main/kotlin/com/compiler/server/model/ExtendedCompilerArgument.kt @@ -0,0 +1,37 @@ +package com.compiler.server.model + +/** + * This is a service layer representation of kotlin compiler arguments. + */ +data class ExtendedCompilerArgument( + val name: String, + val shortName: String?, + val description: String?, + val type: ExtendedCompilerArgumentValue<*>, + val disabled: Boolean, + val predefinedValues: Any?, + val supportedOnCurrentVersion: Boolean +) + +/** + * This sealed interface represents all possible types of compiler arguments. + */ +sealed interface ExtendedCompilerArgumentValue { + val isNullable: Boolean + val defaultValue: T? +} + +data class BooleanExtendedCompilerArgumentValue( + override val isNullable: Boolean, + override val defaultValue: Boolean? +) : ExtendedCompilerArgumentValue + +data class StringExtendedCompilerArgumentValue( + override val isNullable: Boolean, + override val defaultValue: String? +) : ExtendedCompilerArgumentValue + +data class ListExtendedCompilerArgumentValue( + override val isNullable: Boolean, + override val defaultValue: List<*> +) : ExtendedCompilerArgumentValue> diff --git a/src/main/kotlin/com/compiler/server/model/JsCompilerArguments.kt b/src/main/kotlin/com/compiler/server/model/JsCompilerArguments.kt new file mode 100644 index 000000000..597da7d5e --- /dev/null +++ b/src/main/kotlin/com/compiler/server/model/JsCompilerArguments.kt @@ -0,0 +1,6 @@ +package com.compiler.server.model + +data class JsCompilerArguments( + val firstPhase: Map, + val secondPhase: Map +) \ No newline at end of file diff --git a/src/main/kotlin/com/compiler/server/model/Project.kt b/src/main/kotlin/com/compiler/server/model/Project.kt index ec259cf5c..3dc4f7d65 100644 --- a/src/main/kotlin/com/compiler/server/model/Project.kt +++ b/src/main/kotlin/com/compiler/server/model/Project.kt @@ -7,9 +7,13 @@ import com.fasterxml.jackson.annotation.JsonValue data class Project( val args: String = "", val files: List = listOf(), - val confType: ProjectType = ProjectType.JAVA + val confType: ProjectType = ProjectType.JAVA, + val compilerArguments: List> = emptyList() ) +@JsonIgnoreProperties(ignoreUnknown = true) +data class CompilerArgument(val name: String = "", val value: String = "") + @JsonIgnoreProperties(ignoreUnknown = true) data class ProjectFile(val text: String = "", val name: String = "") diff --git a/src/main/kotlin/com/compiler/server/service/CompilerArgumentsService.kt b/src/main/kotlin/com/compiler/server/service/CompilerArgumentsService.kt new file mode 100644 index 000000000..03d15d175 --- /dev/null +++ b/src/main/kotlin/com/compiler/server/service/CompilerArgumentsService.kt @@ -0,0 +1,34 @@ +package com.compiler.server.service + +import com.compiler.server.model.ExtendedCompilerArgument +import com.compiler.server.model.ProjectType +import org.jetbrains.kotlin.utils.filterToSetOrEmpty +import org.springframework.http.HttpStatus +import org.springframework.stereotype.Service +import org.springframework.web.server.ResponseStatusException +import java.util.concurrent.ConcurrentHashMap + +@Service +class CompilerArgumentsService( + private val jvmCompilerArguments: Set, + private val wasmCompilerArguments: Set, + private val composeWasmCompilerArguments: Set, + private val jsCompilerArguments: Set, +) { + private val cache = ConcurrentHashMap>() + + fun getCompilerArguments(projectType: ProjectType): Set { + return cache.computeIfAbsent(projectType) { + when (it) { + ProjectType.JAVA, ProjectType.JUNIT -> jvmCompilerArguments + ProjectType.WASM -> wasmCompilerArguments + ProjectType.COMPOSE_WASM -> composeWasmCompilerArguments + ProjectType.JS_IR -> jsCompilerArguments + else -> throw ResponseStatusException( + HttpStatus.BAD_REQUEST, + "Unsupported projectType '$projectType' for compiler arguments discovery" + ) + }.filterToSetOrEmpty { arg -> arg.supportedOnCurrentVersion } + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/compiler/server/service/KotlinProjectExecutor.kt b/src/main/kotlin/com/compiler/server/service/KotlinProjectExecutor.kt index 6f398b150..aba17d5c5 100644 --- a/src/main/kotlin/com/compiler/server/service/KotlinProjectExecutor.kt +++ b/src/main/kotlin/com/compiler/server/service/KotlinProjectExecutor.kt @@ -1,7 +1,9 @@ package com.compiler.server.service import com.compiler.server.compiler.components.* +import com.compiler.server.compiler.components.WasmTranslationSuccessfulOutput import com.compiler.server.model.* +import com.compiler.server.model.JsCompilerArguments import com.compiler.server.model.bean.VersionInfo import component.KotlinEnvironment import model.Completion @@ -21,12 +23,12 @@ class KotlinProjectExecutor( private val log = LoggerFactory.getLogger(KotlinProjectExecutor::class.java) fun run(project: Project, addByteCode: Boolean): ExecutionResult { - return environment.synchronize { kotlinCompiler.run(project.files, addByteCode, project.args) } + return environment.synchronize { kotlinCompiler.run(project.files, addByteCode, project.args, project.compilerArguments.getOrElse(0, { emptyMap() })) } .also { logExecutionResult(project, it) } } fun test(project: Project, addByteCode: Boolean): ExecutionResult { - return environment.synchronize { kotlinCompiler.test(project.files, addByteCode) } + return environment.synchronize { kotlinCompiler.test(project.files, addByteCode, project.compilerArguments.getOrElse(0, { emptyMap() })) } .also { logExecutionResult(project, it) } } @@ -35,10 +37,10 @@ class KotlinProjectExecutor( } fun compileToJvm(project: Project): CompilationResult { - return kotlinCompiler.compile(project.files) + return kotlinCompiler.compile(project.files, project.compilerArguments.getOrElse(0, { emptyMap() })) } - fun convertToWasm(project: Project, debugInfo: Boolean): TranslationResultWithJsCode { + fun convertToWasm(project: Project, debugInfo: Boolean = false): TranslationResultWithJsCode { return convertWasmWithConverter(project, debugInfo, kotlinToJSTranslator::doTranslateWithWasm) } @@ -71,12 +73,16 @@ class KotlinProjectExecutor( private fun convertJsWithConverter( project: Project, - converter: (List, List) -> CompilationResult + converter: (List, List, JsCompilerArguments) -> CompilationResult ): TranslationJSResult { return environment.synchronize { kotlinToJSTranslator.translateJs( project.files, project.args.split(" "), + JsCompilerArguments( + project.compilerArguments.getOrElse(0, { emptyMap() }), + project.compilerArguments.getOrElse(1, { emptyMap() }) + ), converter ) } @@ -86,7 +92,7 @@ class KotlinProjectExecutor( private fun convertWasmWithConverter( project: Project, debugInfo: Boolean, - converter: (List, List, List, List, Boolean) -> CompilationResult + converter: (List, ProjectType, Boolean, JsCompilerArguments) -> CompilationResult ): TranslationResultWithJsCode { return environment.synchronize { @@ -94,6 +100,10 @@ class KotlinProjectExecutor( project.files, debugInfo, project.confType, + JsCompilerArguments( + project.compilerArguments.getOrElse(0, { emptyMap() }), + project.compilerArguments.getOrElse(1, { emptyMap() }) + ), converter ) } diff --git a/src/main/kotlin/com/compiler/server/utils/CompilerArgumentsUtil.kt b/src/main/kotlin/com/compiler/server/utils/CompilerArgumentsUtil.kt new file mode 100644 index 000000000..6878c32e1 --- /dev/null +++ b/src/main/kotlin/com/compiler/server/utils/CompilerArgumentsUtil.kt @@ -0,0 +1,549 @@ +package com.compiler.server.utils + +import com.compiler.server.compiler.components.PATH_SEPARATOR +import com.compiler.server.model.BooleanExtendedCompilerArgumentValue +import com.compiler.server.model.ExtendedCompilerArgument +import com.compiler.server.model.ExtendedCompilerArgumentValue +import com.compiler.server.model.ListExtendedCompilerArgumentValue +import com.compiler.server.model.StringExtendedCompilerArgumentValue +import com.compiler.server.model.bean.VersionInfo +import component.KotlinEnvironment +import org.jetbrains.kotlin.arguments.dsl.base.KotlinCompilerArgument +import org.jetbrains.kotlin.arguments.dsl.base.KotlinCompilerArguments +import org.jetbrains.kotlin.arguments.dsl.base.KotlinCompilerArgumentsLevel +import org.jetbrains.kotlin.arguments.dsl.types.BooleanType +import org.jetbrains.kotlin.arguments.dsl.types.IntType +import org.jetbrains.kotlin.arguments.dsl.types.KlibIrInlinerModeType +import org.jetbrains.kotlin.arguments.dsl.types.KotlinArgumentValueType +import org.jetbrains.kotlin.arguments.dsl.types.KotlinExplicitApiModeType +import org.jetbrains.kotlin.arguments.dsl.types.KotlinJvmTargetType +import org.jetbrains.kotlin.arguments.dsl.types.KotlinVersionType +import org.jetbrains.kotlin.arguments.dsl.types.ReturnValueCheckerModeType +import org.jetbrains.kotlin.arguments.dsl.types.StringArrayType +import org.jetbrains.kotlin.arguments.dsl.types.StringType +import org.jetbrains.kotlin.tooling.core.KotlinToolingVersion +import org.springframework.stereotype.Component + +internal const val COMPILER_ARGUMENTS_JSON = "kotlin-compiler-arguments.json" +internal const val COMMON_ARGUMENTS_NAME = "commonCompilerArguments" +internal const val JVM_ARGUMENTS_NAME = "jvmCompilerArguments" +internal const val COMMON_KLIB_BASED_ARGUMENTS_NAME = "commonKlibBasedArguments" +internal const val JS_ARGUMENTS_NAME = "jsArguments" +internal const val WASM_ARGUMENTS_NAME = "wasmArguments" +internal const val METADATA_ARGUMENTS_NAME = "metadataArguments" + +internal const val JS_DEFAULT_MODULE_NAME = "playground" +internal const val WASM_DEFAULT_MODULE_NAME = "playground" + +@Component +class CompilerArgumentsUtil( + private val versionInfo: VersionInfo, + kotlinEnvironment: KotlinEnvironment +) { + + private val ALLOWED_COMMON_TOOL_ARGUMENTS = setOf( + "nowarn", + "Werror", + "Wextra" + ) + + private val ALLOWED_COMMON_ARGUMENTS = setOf( + "XXLanguage", + "Xexplicit-backing-fields", + "progressive", + "opt-in", + "Xno-inline", + "Xskip-metadata-version-check", + "Xskip-prerelease-check", + "Xallow-kotlin-package", + "Xstdlib-compilation", + "Xno-check-actual", + "Xnew-inference", + "Xinline-classes", + "Xverify-ir", + "Xverify-ir-visibility", + "Xcheck-phase-conditions", + "Xuse-k2", + "Xuse-fir-experimental-checkers", + "Xuse-fir-ic", + "Xuse-fir-lt", + "Xdisable-default-scripting-plugin", + "Xexplicit-api", + "XXexplicit-return-types", + "Xreturn-value-checker", + "Xsuppress-version-warnings", + "Xsuppress-api-version-greater-than-language-version-error", + "Xexpect-actual-classes", + "Xconsistent-data-class-copy-visibility", + "Xunrestricted-builder-inference", + "Xcontext-receivers", + "Xcontext-parameters", + "Xcontext-sensitive-resolution", + "Xnon-local-break-continue", + "Xdata-flow-based-exhaustiveness", + "Xdirect-java-actualization", + "Xmulti-dollar-interpolation", + "Xenable-incremental-compilation", + "Xrender-internal-diagnostic-names", + "Xreport-all-warnings", + "Xignore-const-optimization-errors", + "Xdont-warn-on-error-suppression", + "Xwhen-guards", + "Xnested-type-aliases", + "Xsuppress-warning", + "Xwarning-level", + "Xannotation-default-target", + "Xannotation-target-all", + "XXlenient-mode", + "Xallow-reified-type-in-catch", + "Xallow-contracts-on-more-functions", + "Xallow-condition-implies-returns-contracts", + "Xallow-holdsin-contract" + ) + + private val ALLOWED_JVM_ARGUMENTS = setOf( + // file paths and environment settings + "include-runtime", + "no-jdk", + "no-stdlib", + "no-reflect", + "module-name", + "jvm-target", + "java-parameters", + "jvm-default", + "Xallow-unstable-dependencies", + "Xabi-stability", + "Xir-do-not-clear-binding-context", + "Xno-call-assertions", + "Xno-receiver-assertions", + "Xno-param-assertions", + "Xno-optimize", + "Xassertions", + "Xuse-type-table", + "Xuse-fast-jar-file-system", + "Xsuppress-missing-builtins-error", + "Xjsr305", + "Xnullability-annotations", + "Xsupport-compatqual-checker-framework-annotations", + "Xjspecify-annotations", + "Xjvm-default", + "Xgenerate-strict-metadata-version", + "Xsanitize-parentheses", + "Xemit-jvm-type-annotations", + "Xjvm-expose-boxed", + "Xstring-concat", + "Xsam-conversions", + "Xlambdas", + "Xindy-allow-annotated-lambdas", + "Xno-reset-jar-timestamps", + "Xno-unified-null-checks", + "Xno-source-debug-extension", + "Xjvm-enable-preview", + "Xsuppress-deprecated-jvm-target-warning", + "Xserialize-ir", + "Xtype-enhancement-improvements-strict-mode", + "Xvalidate-bytecode", + "Xenhance-type-parameter-types-to-def-not-null", + "Xlink-via-signatures", + "Xno-new-java-annotation-targets", + "Xvalue-classes", + "Xir-inliner", + "Xuse-inline-scopes-numbers", + "Xuse-k2-kapt", + "Xcompile-builtins-as-part-of-stdlib", + "Xannotations-in-metadata", + "Xwhen-expressions" + ) + + private val ALLOWED_COMMON_KLIB_BASED_ARGUMENTS = setOf( + "Xklib-enable-signature-clash-checks", + "Xpartial-linkage", + "Xpartial-linkage-loglevel", + "Xklib-duplicated-unique-name-strategy", + "Xklib-ir-inliner" + ) + + private val ALLOWED_JS_ARGUMENTS = setOf( + // file paths and environment settings + "module-name", + "Xir-keep", + "module-kind", + "main", + "Xir-dce", + "Xir-dce-runtime-diagnostic", + "Xir-dce-print-reachability-info", + "Xir-property-lazy-initialization", + "Xir-minimized-member-names", + "Xir-module-name", + "Xir-generate-inline-anonymous-functions", + "Xgenerate-polyfills", + "Xes-classes", + "Xplatform-arguments-in-main-function", + "Xes-generators", + "Xes-arrow-functions", + "Xes-long-as-bigint", + "Xtyped-arrays", + "Xenable-extension-functions-in-externals", + "Xfake-override-validator", + "Xoptimize-generated-js" + ) + + private val ALLOWED_WASM_ARGUMENTS = setOf( + // file paths and environment settings + "Xwasm", + "Xwasm-target", + "Xwasm-debug-info", + "Xwasm-debug-friendly", + "Xwasm-kclass-fqn", + "Xwasm-enable-array-range-checks", + "Xwasm-enable-asserts", + "Xwasm-use-traps-instead-of-exceptions", + "Xwasm-use-new-exception-proposal", + "Xwasm-no-jstag", + "Xwasm-debugger-custom-formatters", + "Xwasm-source-map-include-mappings-from-unavailable-sources", + "Xwasm-ic-cache-readonly", + "Xwasm-generate-dwarf" + ) + + // Use Pair if you want to provide different values for user and for actual use. + // For example, with XPlugin users need to see only plugins, without an actual path, + // but for the compiler we need to pass a full path to the plugin jar. + // In declared Pair the first element is for the user, the second is for actual use. + val PREDEFINED_JVM_ARGUMENTS = mapOf( + "classpath" to Pair( + kotlinEnvironment.classpath.joinToString(PATH_SEPARATOR) { it.name }, + kotlinEnvironment.classpath.joinToString(PATH_SEPARATOR) { it.absolutePath }), + "module-name" to "web-module", + "no-stdlib" to true, + "no-reflect" to true, + "progressive" to true, + "Xplugin" to Pair( + kotlinEnvironment.compilerPlugins.map { it.name }, + kotlinEnvironment.compilerPlugins.map { it.absolutePath }), + "opt-in" to listOf( + "kotlin.ExperimentalStdlibApi", + "kotlin.time.ExperimentalTime", + "kotlin.RequiresOptIn", + "kotlin.ExperimentalUnsignedTypes", + "kotlin.contracts.ExperimentalContracts", + "kotlin.experimental.ExperimentalTypeInference", + "kotlin.uuid.ExperimentalUuidApi", + "kotlin.io.encoding.ExperimentalEncodingApi", + "kotlin.concurrent.atomics.ExperimentalAtomicApi" + ), + "Xcontext-parameters" to true, + "Xnested-type-aliases" to true, + "Xreport-all-warnings" to true, + "Wextra" to true, + "Xexplicit-backing-fields" to true, + "XXLanguage" to "+ExplicitBackingFields" + ) + + val PREDEFINED_WASM_FIRST_PHASE_ARGUMENTS = mapOf( + "Xreport-all-warnings" to true, + "Wextra" to true, + "Xwasm" to true, + "Xir-produce-klib-dir" to true, + "libraries" to Pair( + kotlinEnvironment.WASM_LIBRARIES.sorted().joinToString(PATH_SEPARATOR) { it.split("/").last() }, + kotlinEnvironment.WASM_LIBRARIES.joinToString(PATH_SEPARATOR) + ), + "ir-output-name" to WASM_DEFAULT_MODULE_NAME, + ) + + val PREDEFINED_WASM_SECOND_PHASE_ARGUMENTS = mapOf( + "Xreport-all-warnings" to true, + "Wextra" to true, + "Xwasm" to true, + "Xir-produce-js" to true, + "Xir-dce" to true, + "libraries" to Pair( + kotlinEnvironment.WASM_LIBRARIES.sorted().joinToString(PATH_SEPARATOR) { it.split("/").last() }, + kotlinEnvironment.WASM_LIBRARIES.joinToString(PATH_SEPARATOR) + ), + "ir-output-name" to WASM_DEFAULT_MODULE_NAME, + ) + + val PREDEFINED_COMPOSE_WASM_FIRST_PHASE_ARGUMENTS = mapOf( + "Xreport-all-warnings" to true, + "Wextra" to true, + "Xwasm" to true, + "Xir-produce-klib-dir" to true, + "libraries" to Pair( + kotlinEnvironment.COMPOSE_WASM_LIBRARIES.sorted().joinToString(PATH_SEPARATOR) { it.split("/").last() }, + kotlinEnvironment.COMPOSE_WASM_LIBRARIES.joinToString(PATH_SEPARATOR) + ), + "ir-output-name" to WASM_DEFAULT_MODULE_NAME, + "XPlugin" to Pair( + kotlinEnvironment.COMPOSE_WASM_COMPILER_PLUGINS.map { it.split("/").last() }, + kotlinEnvironment.COMPOSE_WASM_COMPILER_PLUGINS + ), + "P" to Pair( + kotlinEnvironment.composeWasmCompilerPluginOptions, + kotlinEnvironment.composeWasmCompilerPluginOptions + ) + ) + + val PREDEFINED_COMPOSE_WASM_SECOND_PHASE_ARGUMENTS = mapOf( + "Xreport-all-warnings" to true, + "Wextra" to true, + "Xwasm" to true, + "Xir-produce-js" to true, + "Xir-dce" to true, + "libraries" to Pair( + kotlinEnvironment.COMPOSE_WASM_LIBRARIES.sorted().joinToString(PATH_SEPARATOR) { it.split("/").last() }, + kotlinEnvironment.COMPOSE_WASM_LIBRARIES.joinToString(PATH_SEPARATOR) + ), + "ir-output-name" to WASM_DEFAULT_MODULE_NAME, + ) + + val PREDEFINED_JS_FIRST_PHASE_ARGUMENTS = mapOf( + "Xreport-all-warnings" to true, + "Wextra" to true, + "Xir-produce-klib-dir" to true, + "libraries" to Pair( + kotlinEnvironment.JS_LIBRARIES.sorted().joinToString(PATH_SEPARATOR) { it.split("/").last() }, + kotlinEnvironment.JS_LIBRARIES.joinToString(PATH_SEPARATOR) + ), + "ir-output-name" to JS_DEFAULT_MODULE_NAME, + ) + + val PREDEFINED_JS_SECOND_PHASE_ARGUMENTS = mapOf( + "Xreport-all-warnings" to true, + "Wextra" to true, + "Xir-produce-js" to true, + "Xir-dce" to true, + "libraries" to Pair( + kotlinEnvironment.JS_LIBRARIES.sorted().joinToString(PATH_SEPARATOR) { it.split("/").last() }, + kotlinEnvironment.JS_LIBRARIES.joinToString(PATH_SEPARATOR) + ), + "ir-output-name" to JS_DEFAULT_MODULE_NAME, + ) + + fun convertCompilerArgumentsToCompilationString( + allArguments: Set, + predefinedArguments: Map, + userArguments: Map + ): List { + return allArguments + .flatMap { + if (it.name in (predefinedArguments.keys + userArguments.keys)) + if (!it.disabled && it.name in userArguments.keys) { + convertToCompilerArgumentsStringList(it.name, userArguments[it.name]!!) + } else { + convertToCompilerArgumentsStringList( + it.name, + (predefinedArguments[it.name] as? Pair<*, *>)?.second ?: predefinedArguments[it.name] + ) + } + else emptyList() + } + .map { it.filterNot { it.isWhitespace() } } + + } + + fun convertToCompilerArgumentsStringList(argumentName: String, argumentValue: Any?): List { + return when (argumentValue) { + is Boolean -> if (argumentValue) listOf("-$argumentName") else emptyList() + + is String -> { + if (argumentName == "XXLanguage") listOf("-$argumentName:$argumentValue".filterNot { it.isWhitespace() }) + else listOf("-$argumentName", argumentValue) + } + + is List<*> -> argumentValue.map { "-$argumentName=$it" } + else -> throw IllegalArgumentException("Unknown type of argument value: ${argumentValue?.javaClass?.name}") + } + } + + fun collectJvmArguments( + kotlinCompilerArguments: KotlinCompilerArguments + ): Set { + val commonArgumentsLevel = kotlinCompilerArguments.getCommonArgumentsLevel() + val jvmLevel = commonArgumentsLevel + .nestedLevels + .first { nestedArguments -> nestedArguments.name == JVM_ARGUMENTS_NAME } + return (kotlinCompilerArguments.topLevel.arguments + + commonArgumentsLevel.arguments + + jvmLevel.arguments) + .processCompilerArgs( + predefinedArguments = PREDEFINED_JVM_ARGUMENTS, + allowedArguments = ALLOWED_COMMON_TOOL_ARGUMENTS + ALLOWED_COMMON_ARGUMENTS + ALLOWED_JVM_ARGUMENTS, + ) + } + + fun collectWasmArguments( + kotlinCompilerArguments: KotlinCompilerArguments + ): Set { + val commonArgumentsLevel = kotlinCompilerArguments.getCommonArgumentsLevel() + val commonKlibBasedArgumentsLevel = getCommonKlibBasedArgumentsLevel(kotlinCompilerArguments) + val wasmLevel = getWasmLevel(commonKlibBasedArgumentsLevel) + val jsLevel = wasmLevel.nestedLevels.first { nestedArguments -> nestedArguments.name == JS_ARGUMENTS_NAME } + return (kotlinCompilerArguments.topLevel.arguments + + commonArgumentsLevel.arguments + + commonKlibBasedArgumentsLevel.arguments + + wasmLevel.arguments+ + jsLevel.arguments) + .processCompilerArgs( + predefinedArguments = PREDEFINED_WASM_FIRST_PHASE_ARGUMENTS, + allowedArguments = + ALLOWED_COMMON_TOOL_ARGUMENTS + + ALLOWED_COMMON_ARGUMENTS + + ALLOWED_COMMON_KLIB_BASED_ARGUMENTS + + ALLOWED_WASM_ARGUMENTS + + ALLOWED_JS_ARGUMENTS + ) + + } + + fun collectComposeWasmArguments( + kotlinCompilerArguments: KotlinCompilerArguments + ): Set { + val commonArgumentsLevel = kotlinCompilerArguments.getCommonArgumentsLevel() + val commonKlibBasedArgumentsLevel = getCommonKlibBasedArgumentsLevel(kotlinCompilerArguments) + val wasmLevel = getWasmLevel(commonKlibBasedArgumentsLevel) + val jsLevel = wasmLevel.nestedLevels.first { nestedArguments -> nestedArguments.name == JS_ARGUMENTS_NAME } + return (kotlinCompilerArguments.topLevel.arguments + + commonArgumentsLevel.arguments + + commonKlibBasedArgumentsLevel.arguments + + wasmLevel.arguments + + jsLevel.arguments) + .processCompilerArgs( + predefinedArguments = PREDEFINED_COMPOSE_WASM_FIRST_PHASE_ARGUMENTS, + allowedArguments = + ALLOWED_COMMON_TOOL_ARGUMENTS + + ALLOWED_COMMON_ARGUMENTS + + ALLOWED_COMMON_KLIB_BASED_ARGUMENTS + + ALLOWED_WASM_ARGUMENTS + + ALLOWED_JS_ARGUMENTS + ) + + } + + fun collectJsArguments( + kotlinCompilerArguments: KotlinCompilerArguments + ): Set { + val commonArgumentsLevel = kotlinCompilerArguments.getCommonArgumentsLevel() + val commonKlibBasedArgumentsLevel = getCommonKlibBasedArgumentsLevel(kotlinCompilerArguments) + + val wasmLevel = getWasmLevel(commonKlibBasedArgumentsLevel) + + val jsLevel = wasmLevel.nestedLevels.first { nestedArguments -> nestedArguments.name == JS_ARGUMENTS_NAME } + + return (kotlinCompilerArguments.topLevel.arguments + + commonArgumentsLevel.arguments + + commonKlibBasedArgumentsLevel.arguments + + wasmLevel.arguments + + jsLevel.arguments + ) + .processCompilerArgs( + predefinedArguments = PREDEFINED_JS_FIRST_PHASE_ARGUMENTS, + allowedArguments = + ALLOWED_COMMON_TOOL_ARGUMENTS + + ALLOWED_COMMON_ARGUMENTS + + ALLOWED_COMMON_KLIB_BASED_ARGUMENTS + + ALLOWED_WASM_ARGUMENTS + + ALLOWED_JS_ARGUMENTS + ) + + } + + private fun getWasmLevel(commonKlibBasedArgumentsLevel: KotlinCompilerArgumentsLevel): KotlinCompilerArgumentsLevel = + commonKlibBasedArgumentsLevel + .nestedLevels + .first { nestedArguments -> nestedArguments.name == WASM_ARGUMENTS_NAME } + + private fun getCommonKlibBasedArgumentsLevel(kotlinCompilerArguments: KotlinCompilerArguments): KotlinCompilerArgumentsLevel { + val commonArgumentsLayer = kotlinCompilerArguments.getCommonArgumentsLevel() + val commonKlibBasedArgumentsLayer = + commonArgumentsLayer.nestedLevels.first { nestedArguments -> nestedArguments.name == COMMON_KLIB_BASED_ARGUMENTS_NAME } + return commonKlibBasedArgumentsLayer + } + + private fun KotlinCompilerArguments.getCommonArgumentsLevel() = this.topLevel.nestedLevels.first() + + private fun Collection.processCompilerArgs( + allowedArguments: Set = emptySet(), + predefinedArguments: Map = emptyMap() + ): Set = + map { arg -> + val disabled = arg.name !in allowedArguments + ExtendedCompilerArgument( + name = arg.name, + shortName = arg.shortName, + description = arg.description.current, + type = convertKotlinArgumentValueTypeToExtendedCompilerArgumentValue(arg.valueType), + disabled = disabled, + predefinedValues = (predefinedArguments[arg.name] as? Pair<*, *>)?.first + ?: predefinedArguments[arg.name] as? List<*>, + supportedOnCurrentVersion = arg.isSupportedOnCurrentVersion() + ) + }.toSet() + + private fun convertKotlinArgumentValueTypeToExtendedCompilerArgumentValue(type: KotlinArgumentValueType<*>): ExtendedCompilerArgumentValue<*> { + return when (type) { + is BooleanType -> { + BooleanExtendedCompilerArgumentValue( + isNullable = type.isNullable.current, + defaultValue = type.defaultValue.current + ) + } + + is StringType, is IntType -> { + StringExtendedCompilerArgumentValue( + isNullable = type.isNullable.current, + defaultValue = type.defaultValue.current?.toString() + ) + } + + is KotlinJvmTargetType -> { + StringExtendedCompilerArgumentValue( + isNullable = type.isNullable.current, + defaultValue = type.defaultValue.current?.targetName + ) + } + + is ReturnValueCheckerModeType -> { + StringExtendedCompilerArgumentValue( + isNullable = type.isNullable.current, + defaultValue = type.defaultValue.current?.modeState + ) + } + + is KotlinExplicitApiModeType -> { + StringExtendedCompilerArgumentValue( + isNullable = type.isNullable.current, + defaultValue = type.defaultValue.current?.modeName + ) + } + + is KotlinVersionType -> { + StringExtendedCompilerArgumentValue( + isNullable = type.isNullable.current, + defaultValue = type.defaultValue.current?.versionName + ) + } + + is KlibIrInlinerModeType -> { + StringExtendedCompilerArgumentValue( + isNullable = type.isNullable.current, + defaultValue = type.defaultValue.current?.modeState + ) + } + + is StringArrayType -> { + ListExtendedCompilerArgumentValue( + isNullable = type.isNullable.current, + defaultValue = type.defaultValue.current?.toList() ?: emptyList() + ) + } + } + } + + private fun KotlinCompilerArgument.isSupportedOnCurrentVersion(): Boolean { + return releaseVersionsMetadata.removedVersion?.releaseName?.let { releaseVersion -> + KotlinToolingVersion(versionInfo.version) < KotlinToolingVersion(releaseVersion) + } ?: true + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/compiler/server/validation/AbstractCompilerArgumentsValidator.kt b/src/main/kotlin/com/compiler/server/validation/AbstractCompilerArgumentsValidator.kt new file mode 100644 index 000000000..50e7e2e91 --- /dev/null +++ b/src/main/kotlin/com/compiler/server/validation/AbstractCompilerArgumentsValidator.kt @@ -0,0 +1,87 @@ +package com.compiler.server.validation + +import com.compiler.server.model.BooleanExtendedCompilerArgumentValue +import com.compiler.server.model.ExtendedCompilerArgument +import com.compiler.server.model.ExtendedCompilerArgumentValue +import com.compiler.server.model.ListExtendedCompilerArgumentValue +import com.compiler.server.model.StringExtendedCompilerArgumentValue +import jakarta.validation.ConstraintValidatorContext + +/** + * @param knownCompilerArguments The set of predefined compiler arguments that are + * recognized and supported. + */ +abstract class AbstractCompilerArgumentsValidator(private val knownCompilerArguments: Set) { + private val STRING_ARGUMENT_REGEX = Regex("^[}{A-Za-z0-9+-.,:=]+\$") + + fun validateCompilerArguments( + compilerArguments: Map, + ): Boolean { + if (compilerArguments.isEmpty()) return true + + if (isCompilerArgumentsKeysValid(compilerArguments.keys).not()) { + return false + } + if (isCompilerArgumentsValuesValid(compilerArguments).not()) { + return false + } + return true + } + + private fun isCompilerArgumentsValuesValid(compilerArguments: Map): Boolean { + for ((argumentName, argumentValue) in compilerArguments) { + if (isCompilerArgumentValueValid(argumentName, argumentValue).not()) { + return false + } + } + return true + } + + private fun isCompilerArgumentValueValid(argumentName: String, argumentValue: Any): Boolean { + val expectedArgumentType = knownCompilerArguments + .find { it.name == argumentName } + ?.type ?: throw IllegalArgumentException("Unknown compiler argument: $argumentName") + + return when (argumentValue) { + is Boolean -> expectedArgumentType is BooleanExtendedCompilerArgumentValue + + is List<*> -> expectedArgumentType is ListExtendedCompilerArgumentValue && + checkListJvmCompilerArgument(argumentName, argumentValue) + + is String -> expectedArgumentType is StringExtendedCompilerArgumentValue && + checkStringJvmCompilerArgument(argumentName, argumentValue) + + else -> false // unsupported type + } + } + + private fun isCompilerArgumentsKeysValid( + keys: Set, + ): Boolean { + for (argumentKey in keys) { + val knownCompilerArgument = knownCompilerArguments.find { it.name == argumentKey } + if (knownCompilerArgument == null) { + return false + } + if (knownCompilerArgument.disabled) { + return false + } + } + return true + } + + fun checkListJvmCompilerArgument(argumentName: String, argumentValues: List<*>): Boolean { + argumentValues.forEach { argumentValue -> + if (argumentValue !is String) return false + if (checkStringJvmCompilerArgument(argumentName, argumentValue).not()) return false + } + return true + } + + fun checkStringJvmCompilerArgument(argumentName: String, argumentValue: String): Boolean { + if (!STRING_ARGUMENT_REGEX.matches(argumentValue)) return false + if (argumentValue.any { it.isWhitespace() }) return false + if (argumentName != "XXLanguage" && argumentValue.startsWith("-")) return false + return true + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/compiler/server/validation/ProjectRequestValidation.kt b/src/main/kotlin/com/compiler/server/validation/ProjectRequestValidation.kt new file mode 100644 index 000000000..62492b896 --- /dev/null +++ b/src/main/kotlin/com/compiler/server/validation/ProjectRequestValidation.kt @@ -0,0 +1,51 @@ +package com.compiler.server.validation + +import com.compiler.server.model.ProjectType +import jakarta.validation.Constraint +import jakarta.validation.ConstraintValidator +import jakarta.validation.ConstraintValidatorContext +import jakarta.validation.Payload +import org.springframework.beans.factory.annotation.Autowired +import kotlin.reflect.KClass + +/** + * Annotation representing a validation constraint for a project run request. + * + * This constraint validates the compiler arguments associated with a project + * to ensure they meet specific validity requirements based on the project's configuration. + * The validation is performed using a custom validator, `ProjectRunRequestValidator`. + * + * Properties: + * @property message The error message returned when the validation fails. Defaults to a standard message. + * @property groups Associates this constraint with specific validation groups, if needed. + * @property payload Provides additional metadata about the constraint for advanced use cases. + */ +@Constraint(validatedBy = [ProjectRunRequestValidator::class]) +@Target(AnnotationTarget.FIELD) +annotation class CompilerArgumentsConstraint( + val projectType: ProjectType, + val message: String = "Invalid compiler arguments passed.", + val groups: Array> = [], + vararg val payload: KClass = [] +) + +class ProjectRunRequestValidator : ConstraintValidator> { + @Autowired + private lateinit var compilerArgumentsValidators: Map + + private var projectType: ProjectType = ProjectType.JAVA + + override fun initialize(constraintAnnotation: CompilerArgumentsConstraint?) { + projectType = constraintAnnotation?.projectType + ?: throw IllegalArgumentException("Project type must be provided for compiler args validation.") + } + + override fun isValid( + compilerArguments: Map, + cxt: ConstraintValidatorContext + ): Boolean { + return compilerArgumentsValidators[projectType] + ?.validateCompilerArguments(compilerArguments) + ?: false + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/compiler/server/validation/impl/ComposeWasmCompilerArgumentsValidator.kt b/src/main/kotlin/com/compiler/server/validation/impl/ComposeWasmCompilerArgumentsValidator.kt new file mode 100644 index 000000000..0c02facaf --- /dev/null +++ b/src/main/kotlin/com/compiler/server/validation/impl/ComposeWasmCompilerArgumentsValidator.kt @@ -0,0 +1,9 @@ +package com.compiler.server.validation.impl + +import com.compiler.server.model.ExtendedCompilerArgument +import com.compiler.server.validation.AbstractCompilerArgumentsValidator +import org.springframework.stereotype.Component + +@Component +class ComposeWasmCompilerArgumentsValidator(composeWasmCompilerArguments: Set) : + AbstractCompilerArgumentsValidator(composeWasmCompilerArguments) \ No newline at end of file diff --git a/src/main/kotlin/com/compiler/server/validation/impl/JsCompilerArgumentsValidator.kt b/src/main/kotlin/com/compiler/server/validation/impl/JsCompilerArgumentsValidator.kt new file mode 100644 index 000000000..1e0071e82 --- /dev/null +++ b/src/main/kotlin/com/compiler/server/validation/impl/JsCompilerArgumentsValidator.kt @@ -0,0 +1,9 @@ +package com.compiler.server.validation.impl + +import com.compiler.server.model.ExtendedCompilerArgument +import com.compiler.server.validation.AbstractCompilerArgumentsValidator +import org.springframework.stereotype.Component + +@Component +class JsCompilerArgumentsValidator(jsCompilerArguments: Set) : + AbstractCompilerArgumentsValidator(jsCompilerArguments) \ No newline at end of file diff --git a/src/main/kotlin/com/compiler/server/validation/impl/JvmCompilerArgumentsValidator.kt b/src/main/kotlin/com/compiler/server/validation/impl/JvmCompilerArgumentsValidator.kt new file mode 100644 index 000000000..ee08c7821 --- /dev/null +++ b/src/main/kotlin/com/compiler/server/validation/impl/JvmCompilerArgumentsValidator.kt @@ -0,0 +1,9 @@ +package com.compiler.server.validation.impl + +import com.compiler.server.model.ExtendedCompilerArgument +import com.compiler.server.validation.AbstractCompilerArgumentsValidator +import org.springframework.stereotype.Component + +@Component +class JvmCompilerArgumentsValidator(jvmCompilerArguments: Set) : + AbstractCompilerArgumentsValidator(jvmCompilerArguments) \ No newline at end of file diff --git a/src/main/kotlin/com/compiler/server/validation/impl/WasmCompilerArgumentsValidator.kt b/src/main/kotlin/com/compiler/server/validation/impl/WasmCompilerArgumentsValidator.kt new file mode 100644 index 000000000..acc9e8464 --- /dev/null +++ b/src/main/kotlin/com/compiler/server/validation/impl/WasmCompilerArgumentsValidator.kt @@ -0,0 +1,9 @@ +package com.compiler.server.validation.impl + +import com.compiler.server.model.ExtendedCompilerArgument +import com.compiler.server.validation.AbstractCompilerArgumentsValidator +import org.springframework.stereotype.Component + +@Component +class WasmCompilerArgumentsValidator(wasmCompilerArguments: Set) : + AbstractCompilerArgumentsValidator(wasmCompilerArguments) \ No newline at end of file diff --git a/src/test/kotlin/com/compiler/server/CompilerAPITest.kt b/src/test/kotlin/com/compiler/server/CompilerAPITest.kt index 9418ab395..d1781a94b 100644 --- a/src/test/kotlin/com/compiler/server/CompilerAPITest.kt +++ b/src/test/kotlin/com/compiler/server/CompilerAPITest.kt @@ -1,6 +1,7 @@ package com.compiler.server -import com.compiler.server.generator.generateSingleProject +import com.compiler.server.api.ProjectFileRequestDto +import com.compiler.server.api.RunRequest import com.compiler.server.model.JvmExecutionResult import com.compiler.server.model.bean.VersionInfo import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper @@ -47,7 +48,7 @@ class CompilerAPITest { getHost() + url, HttpEntity( jacksonObjectMapper().writeValueAsString( - generateSingleProject(PROGRAM_RUN) + RunRequest(files = listOf(ProjectFileRequestDto(text = PROGRAM_RUN, name = "File.kt")),) ), headers ), diff --git a/src/test/kotlin/com/compiler/server/CompilerArgumentsConfigurationTest.kt b/src/test/kotlin/com/compiler/server/CompilerArgumentsConfigurationTest.kt new file mode 100644 index 000000000..46b34f498 --- /dev/null +++ b/src/test/kotlin/com/compiler/server/CompilerArgumentsConfigurationTest.kt @@ -0,0 +1,51 @@ +package com.compiler.server + +import com.compiler.server.configuration.CompilerArgumentsConfiguration +import com.compiler.server.utils.COMMON_ARGUMENTS_NAME +import com.compiler.server.utils.COMMON_KLIB_BASED_ARGUMENTS_NAME +import com.compiler.server.utils.COMPILER_ARGUMENTS_JSON +import com.compiler.server.utils.JVM_ARGUMENTS_NAME +import com.compiler.server.utils.METADATA_ARGUMENTS_NAME +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertTrue + +class CompilerArgumentsConfigurationTest { + + private val compilerArgumentsConfiguration: CompilerArgumentsConfiguration = CompilerArgumentsConfiguration() + + + @Test + fun validateKotlinCompilerArgumentsJsonFile() { + val kotlinCompilerArguments = compilerArgumentsConfiguration.kotlinCompilerArguments() + + assertEquals( + 2, kotlinCompilerArguments.schemaVersion, + "Unsupported schema version of $COMPILER_ARGUMENTS_JSON" + ) + + assertEquals("commonToolArguments", kotlinCompilerArguments.topLevel.name) + + assertEquals( + 1, + kotlinCompilerArguments.topLevel.nestedLevels.size, + "Unexpected top-level's nested levels count" + ) + + val argumentsFirstLayer = kotlinCompilerArguments + .topLevel + .nestedLevels + .first() + assertEquals(COMMON_ARGUMENTS_NAME, argumentsFirstLayer.name) + + assertEquals(3, argumentsFirstLayer.nestedLevels.size) + + val actualSecondLevelArgumentNames = argumentsFirstLayer.nestedLevels.map { it.name } + val expectedSecondLevelArgumentNames = + listOf(JVM_ARGUMENTS_NAME, COMMON_KLIB_BASED_ARGUMENTS_NAME, METADATA_ARGUMENTS_NAME) + assertTrue( + actualSecondLevelArgumentNames.containsAll(expectedSecondLevelArgumentNames), + "Unexpected second-level's arguments names. Expected: $expectedSecondLevelArgumentNames, got: $actualSecondLevelArgumentNames" + ) + } +} \ No newline at end of file diff --git a/src/test/kotlin/com/compiler/server/CompilerArgumentsEndpointTest.kt b/src/test/kotlin/com/compiler/server/CompilerArgumentsEndpointTest.kt new file mode 100644 index 000000000..bdfa0bd93 --- /dev/null +++ b/src/test/kotlin/com/compiler/server/CompilerArgumentsEndpointTest.kt @@ -0,0 +1,77 @@ +package com.compiler.server + +import com.compiler.server.model.ProjectType +import com.compiler.server.model.bean.VersionInfo +import com.fasterxml.jackson.databind.ObjectMapper +import component.KotlinEnvironment +import org.junit.jupiter.api.Test +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.EnumSource +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.beans.factory.annotation.Value +import org.springframework.boot.test.context.SpringBootTest +import org.springframework.http.HttpMethod +import org.springframework.http.RequestEntity +import org.springframework.web.client.RestTemplate +import java.net.InetAddress +import java.net.URI +import java.nio.file.Paths +import kotlin.io.path.readText +import kotlin.test.assertEquals + +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +class CompilerArgumentsEndpointTest { + + @Autowired + private lateinit var versionInfo: VersionInfo + + @Autowired + private lateinit var kotlinEnvironment: KotlinEnvironment + + @Autowired + private lateinit var objectMapper: ObjectMapper + + @Value("\${local.server.port}") + private var port = 0 + + private val host: String = InetAddress.getLocalHost().hostAddress + + private fun baseUrl(): String = "http://$host:$port" + + @ParameterizedTest + @EnumSource(ProjectType::class, mode = EnumSource.Mode.EXCLUDE, names = ["JS", "CANVAS"]) + fun `compiler arguments endpoint returns flattened data without nested argument`(projectType: ProjectType) { + val version = versionInfo.version + val urls = listOf( + "/api/compiler/compiler-arguments?projectType=${projectType.id}", + "/api/$version/compiler/compiler-arguments?projectType=${projectType.id}" + ) + + val client = RestTemplate() + + val projectTypeId = when (projectType) { + ProjectType.JAVA, ProjectType.JUNIT -> "jvm" + ProjectType.JS_IR, ProjectType.JS, ProjectType.CANVAS -> "js" + ProjectType.WASM -> "wasm" + ProjectType.COMPOSE_WASM -> "compose-wasm" + } + + val expectedResponseBody = Paths.get("src/test/resources/compiler-arguments/$projectTypeId-expected-compiler-args.json").readText() + .replace( + "{{PLUGIN_PLACEHOLDER}}", + kotlinEnvironment.compilerPlugins.joinToString(",") { "\"" + it.name } + "\"") + .replace("{{CLASSPATH_PLACEHOLDER}}", kotlinEnvironment.classpath.joinToString(":") { it.name }) + .replace("{{KOTLIN_VERSION_PLACEHOLDER}}", version) + + urls.forEach { path -> + val response = client.exchange( + RequestEntity(HttpMethod.GET, URI.create(baseUrl() + path)), + String::class.java + ) + + val body = response.body + + assertEquals(objectMapper.readTree(expectedResponseBody), objectMapper.readTree(body)) + } + } +} diff --git a/src/test/kotlin/com/compiler/server/ResourceCompileTest.kt b/src/test/kotlin/com/compiler/server/ResourceCompileTest.kt index aad0a059b..a4fb4edac 100644 --- a/src/test/kotlin/com/compiler/server/ResourceCompileTest.kt +++ b/src/test/kotlin/com/compiler/server/ResourceCompileTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test class ResourceCompileTest : BaseExecutorTest(), BaseResourceCompileTest { override fun request(code: String, platform: ProjectType) = when (platform) { ProjectType.JAVA -> run(code, "") - ProjectType.JS_IR, ProjectType.JS -> translateToJsIr(code) + ProjectType.JS_IR -> translateToJsIr(code) else -> throw IllegalArgumentException("Unknown type $platform") } diff --git a/src/test/kotlin/com/compiler/server/ResourceE2ECompileTest.kt b/src/test/kotlin/com/compiler/server/ResourceE2ECompileTest.kt index b33e9de70..326487205 100644 --- a/src/test/kotlin/com/compiler/server/ResourceE2ECompileTest.kt +++ b/src/test/kotlin/com/compiler/server/ResourceE2ECompileTest.kt @@ -1,9 +1,11 @@ package com.compiler.server +import com.compiler.server.api.ProjectFileRequestDto +import com.compiler.server.api.RunRequest +import com.compiler.server.api.TranslateJsRequest import com.compiler.server.base.startNodeJsApp import com.compiler.server.compiler.components.KotlinToJSTranslator.Companion.JS_IR_CODE_BUFFER import com.compiler.server.compiler.components.KotlinToJSTranslator.Companion.JS_IR_OUTPUT_REWRITE -import com.compiler.server.generator.generateSingleProject import com.compiler.server.model.ExecutionResult import com.compiler.server.model.JunitExecutionResult import com.compiler.server.model.JvmExecutionResult @@ -38,16 +40,23 @@ class ResourceE2ECompileTest : BaseResourceCompileTest { private fun getHost(): String = "http://$host:$port" override fun request(code: String, platform: ProjectType): ExecutionResult { - val url = when (platform) { - ProjectType.JS, ProjectType.JS_IR -> "/api/compiler/translate?ir=true" - else -> "/api/compiler/run" + val (url, requestBody) = when (platform) { + ProjectType.JS_IR -> Pair( + "/api/compiler/translate?ir=true", + TranslateJsRequest(files = listOf(ProjectFileRequestDto(text = code, name = "File.kt"))) + ) + + ProjectType.JAVA -> Pair( + "/api/compiler/run", + RunRequest(files = listOf(ProjectFileRequestDto(text = code, name = "File.kt"))) + ) + + else -> throw IllegalArgumentException("Unsupported type $platform") } val headers = HttpHeaders().apply { contentType = MediaType.APPLICATION_JSON } - val body = jacksonObjectMapper().writeValueAsString( - generateSingleProject(code, projectType = platform) - ) + val body = jacksonObjectMapper().writeValueAsString(requestBody) val resultClass = when (platform) { ProjectType.JUNIT -> JunitExecutionResult::class.java diff --git a/src/test/resources/compiler-arguments/compose-wasm-expected-compiler-args.json b/src/test/resources/compiler-arguments/compose-wasm-expected-compiler-args.json new file mode 100644 index 000000000..3e8ab3356 --- /dev/null +++ b/src/test/resources/compiler-arguments/compose-wasm-expected-compiler-args.json @@ -0,0 +1,2022 @@ +{ + "compilerArguments": [ + { + "name": "help", + "shortName": "h", + "description": "Print a synopsis of standard options.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "X", + "shortName": null, + "description": "Print a synopsis of advanced options.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "version", + "shortName": null, + "description": "Display the compiler version.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "verbose", + "shortName": null, + "description": "Enable verbose logging output.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "nowarn", + "shortName": null, + "description": "Don't generate any warnings.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Werror", + "shortName": null, + "description": "Report an error if there are any warnings.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Wextra", + "shortName": null, + "description": "Enable extra checkers for K2.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "language-version", + "shortName": null, + "description": "Provide source compatibility with the specified version of Kotlin.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "api-version", + "shortName": null, + "description": "Allow using declarations from only the specified version of bundled libraries.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "kotlin-home", + "shortName": null, + "description": "Path to the Kotlin compiler home directory used for the discovery of runtime libraries.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "progressive", + "shortName": null, + "description": "Enable progressive compiler mode.\nIn this mode, deprecations and bug fixes for unstable code take effect immediately\ninstead of going through a graceful migration cycle.\nCode written in progressive mode is backward compatible; however, code written without\nprogressive mode enabled may cause compilation errors in progressive mode.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "script", + "shortName": null, + "description": "Evaluate the given Kotlin script (*.kts) file.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xrepl", + "shortName": null, + "description": "Run Kotlin REPL (deprecated)", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "opt-in", + "shortName": null, + "description": "Enable API usages that require opt-in with an opt-in requirement marker with the given fully qualified name.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xno-inline", + "shortName": null, + "description": "Disable method inlining.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xskip-metadata-version-check", + "shortName": null, + "description": "Allow loading classes with bad metadata versions and pre-release classes.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xskip-prerelease-check", + "shortName": null, + "description": "Allow loading pre-release classes.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-kotlin-package", + "shortName": null, + "description": "Allow compiling code in the 'kotlin' package, and allow not requiring 'kotlin.stdlib' in 'module-info'.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xstdlib-compilation", + "shortName": null, + "description": "Enables special features which are relevant only for stdlib compilation.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xreport-output-files", + "shortName": null, + "description": "Report the source-to-output file mapping.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xplugin", + "shortName": null, + "description": "Load plugins from the given classpath.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "P", + "shortName": null, + "description": "Pass an option to a plugin.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": [ + "plugin:androidx.compose.compiler.plugins.kotlin:generateDecoys=false" + ] + }, + { + "name": "Xcompiler-plugin", + "shortName": null, + "description": "Register a compiler plugin.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcompiler-plugin-order", + "shortName": null, + "description": "Specify an execution order constraint for compiler plugins.\nOrder constraint can be specified using the 'pluginId' of compiler plugins.\nThe first specified plugin will be executed before the second plugin.\nMultiple constraints can be specified by repeating this option. Cycles in constraints will cause an error.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xmulti-platform", + "shortName": null, + "description": "Enable language support for multiplatform projects.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xno-check-actual", + "shortName": null, + "description": "Do not check for the presence of the 'actual' modifier in multiplatform projects.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xintellij-plugin-root", + "shortName": null, + "description": "Path to 'kotlin-compiler.jar' or the directory where the IntelliJ IDEA configuration files can be found.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xnew-inference", + "shortName": null, + "description": "Enable the new experimental generic type inference algorithm.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xinline-classes", + "shortName": null, + "description": "Enable experimental inline classes.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xreport-perf", + "shortName": null, + "description": "Report detailed performance statistics.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdetailed-perf", + "shortName": null, + "description": "Enable more detailed performance statistics (Experimental).\nFor Native, the performance report includes execution time and lines processed per second for every individual lowering.\nFor WASM and JS, the performance report includes execution time and lines per second for each lowering of the first stage of compilation.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdump-perf", + "shortName": null, + "description": "Dump detailed performance statistics to the specified file in plain text, JSON or markdown format (it's detected by the file's extension).\nAlso, it supports the placeholder `*` and directory for generating file names based on the module being compiled and the current time stamp.\nExample: `path/to/dir/*.log` creates logs like `path/to/dir/my-module_2025-06-20-12-22-32.log` in plain text format, `path/to/dir/` creates logs like `path/to/dir/my-log_2025-06-20-12-22-32.json`.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "XXdump-model", + "shortName": null, + "description": "Dump compilation model to specified directory for use in modularized tests.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xmetadata-version", + "shortName": null, + "description": "Change the metadata version of the generated binary files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcommon-sources", + "shortName": null, + "description": "Sources of the common module that need to be compiled together with this module in multiplatform mode.\nThey should be a subset of sources passed as free arguments.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xlist-phases", + "shortName": null, + "description": "List backend phases.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdisable-phases", + "shortName": null, + "description": "Disable backend phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xverbose-phases", + "shortName": null, + "description": "Be verbose while performing the given backend phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-dump-before", + "shortName": null, + "description": "Dump the backend's state before these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-dump-after", + "shortName": null, + "description": "Dump the backend's state after these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-dump", + "shortName": null, + "description": "Dump the backend's state both before and after these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdump-directory", + "shortName": null, + "description": "Dump the backend state into this directory.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdump-fqname", + "shortName": null, + "description": "Dump the declaration with the given FqName.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-validate-before", + "shortName": null, + "description": "Validate the backend's state before these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-validate-after", + "shortName": null, + "description": "Validate the backend's state after these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-validate", + "shortName": null, + "description": "Validate the backend's state both before and after these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xverify-ir", + "shortName": null, + "description": "IR verification mode (no verification by default).", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xverify-ir-visibility", + "shortName": null, + "description": "Check for visibility violations in IR when validating it before running any lowerings. Only has effect if '-Xverify-ir' is not 'none'.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xprofile-phases", + "shortName": null, + "description": "Profile backend phases.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcheck-phase-conditions", + "shortName": null, + "description": "Check pre- and postconditions of IR lowering phases.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xuse-fir-experimental-checkers", + "shortName": null, + "description": "Enable experimental frontend IR checkers that are not yet ready for production.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xuse-fir-ic", + "shortName": null, + "description": "Compile using frontend IR internal incremental compilation.\nWarning: This feature is not yet production-ready.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xuse-fir-lt", + "shortName": null, + "description": "Compile using the LightTree parser with the frontend IR.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xmetadata-klib", + "shortName": null, + "description": "Produce a klib that only contains the metadata of declarations.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdisable-default-scripting-plugin", + "shortName": null, + "description": "Don't enable the scripting plugin by default.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xexplicit-api", + "shortName": null, + "description": "Force the compiler to report errors on all public API declarations without an explicit visibility or a return type.\nUse the 'warning' level to issue warnings instead of errors.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "disable" + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "XXexplicit-return-types", + "shortName": null, + "description": "Force the compiler to report errors on all public API declarations without an explicit return type.\nUse the 'warning' level to issue warnings instead of errors.\nThis flag partially enables functionality of `-Xexplicit-api` flag, so please don't use them altogether", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "disable" + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xreturn-value-checker", + "shortName": null, + "description": "Set improved unused return value checker mode. Use 'check' to run checker only and use 'full' to also enable automatic annotation insertion.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "disable" + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xsuppress-version-warnings", + "shortName": null, + "description": "Suppress warnings about outdated, inconsistent, or experimental language or API versions.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xsuppress-api-version-greater-than-language-version-error", + "shortName": null, + "description": "Suppress error about API version greater than language version.\nWarning: This is temporary solution (see KT-63712) intended to be used only for stdlib build.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xexpect-actual-classes", + "shortName": null, + "description": "'expect'/'actual' classes (including interfaces, objects, annotations, enums, and 'actual' typealiases) are in Beta.\nKotlin reports a warning every time you use one of them. You can use this flag to mute the warning.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xconsistent-data-class-copy-visibility", + "shortName": null, + "description": "The effect of this compiler flag is the same as applying @ConsistentCopyVisibility annotation to all data classes in the module. See https://youtrack.jetbrains.com/issue/KT-11914", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xunrestricted-builder-inference", + "shortName": null, + "description": "Eliminate builder inference restrictions, for example by allowing type variables to be returned from builder inference calls.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xcontext-receivers", + "shortName": null, + "description": "Enable experimental context receivers.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xcontext-parameters", + "shortName": null, + "description": "Enable experimental context parameters.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xcontext-sensitive-resolution", + "shortName": null, + "description": "Enable experimental context-sensitive resolution.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xnon-local-break-continue", + "shortName": null, + "description": "Enable experimental non-local break and continue.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xdata-flow-based-exhaustiveness", + "shortName": null, + "description": "Enable `when` exhaustiveness improvements that rely on data-flow analysis.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xexplicit-backing-fields", + "shortName": null, + "description": "Enable experimental language support for explicit backing fields.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xdirect-java-actualization", + "shortName": null, + "description": "Enable experimental direct Java actualization support.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xmulti-dollar-interpolation", + "shortName": null, + "description": "Enable experimental multi-dollar interpolation.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xenable-incremental-compilation", + "shortName": null, + "description": "Enable incremental compilation.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xrender-internal-diagnostic-names", + "shortName": null, + "description": "Render the internal names of warnings and errors.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-any-scripts-in-source-roots", + "shortName": null, + "description": "Allow compiling scripts along with regular Kotlin sources.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xreport-all-warnings", + "shortName": null, + "description": "Report all warnings even if errors are found.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xfragments", + "shortName": null, + "description": "Declare all known fragments of a multiplatform compilation.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfragment-sources", + "shortName": null, + "description": "Add sources to a specific fragment of a multiplatform compilation.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfragment-refines", + "shortName": null, + "description": "Declare that refines with the dependsOn/refines relation.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfragment-dependency", + "shortName": null, + "description": "Declare common klib dependencies for the specific fragment.\nThis argument is required for any HMPP module except the platform leaf module: it takes dependencies from -cp/-libraries.\nThe argument should be used only if the new compilation scheme is enabled with -Xseparate-kmp-compilation\n", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfragment-friend-dependency", + "shortName": null, + "description": "Declare common klib friend dependencies for the specific fragment.\nThis argument can be specified for any HMPP module except the platform leaf module: it takes dependencies from the platform specific friend module arguments.\nThe argument should be used only if the new compilation scheme is enabled with -Xseparate-kmp-compilation\n", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xseparate-kmp-compilation", + "shortName": null, + "description": "Enables the separated compilation scheme, in which common source sets are analyzed against their own dependencies", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xignore-const-optimization-errors", + "shortName": null, + "description": "Ignore all compilation exceptions while optimizing some constant expressions.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xdont-warn-on-error-suppression", + "shortName": null, + "description": "Don't report warnings when errors are suppressed. This only affects K2.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwhen-guards", + "shortName": null, + "description": "Enable experimental language support for when guards.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xnested-type-aliases", + "shortName": null, + "description": "Enable experimental language support for nested type aliases.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xsuppress-warning", + "shortName": null, + "description": "Suppress specified warning module-wide. This option is deprecated in favor of \"-Xwarning-level\" flag", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwarning-level", + "shortName": null, + "description": "Set the severity of the given warning.\n- `error` level raises the severity of a warning to error level (similar to -Werror but more granular)\n- `disabled` level suppresses reporting of a warning (similar to -nowarn but more granular)\n- `warning` level overrides -nowarn and -Werror for this specific warning (the warning will be reported/won't be considered as an error)", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xannotation-default-target", + "shortName": null, + "description": "Change the default annotation targets for constructor properties:\n-Xannotation-default-target=first-only: use the first of the following allowed targets: '@param:', '@property:', '@field:';\n-Xannotation-default-target=first-only-warn: same as first-only, and raise warnings when both '@param:' and either '@property:' or '@field:' are allowed;\n-Xannotation-default-target=param-property: use '@param:' target if applicable, and also use the first of either '@property:' or '@field:';\ndefault: 'first-only-warn' in language version 2.2+, 'first-only' in version 2.1 and before.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "XXdebug-level-compiler-checks", + "shortName": null, + "description": "Enable debug level compiler checks. ATTENTION: these checks can slow compiler down or even crash it.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xannotation-target-all", + "shortName": null, + "description": "Enable experimental language support for @all: annotation use-site target.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "XXlenient-mode", + "shortName": null, + "description": "Lenient compiler mode. When actuals are missing, placeholder declarations are generated.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-reified-type-in-catch", + "shortName": null, + "description": "Allow 'catch' parameters to have reified types.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-contracts-on-more-functions", + "shortName": null, + "description": "Allow contracts on some operators and accessors, and allow checks for erased types.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-condition-implies-returns-contracts", + "shortName": null, + "description": "Allow contracts that specify a limited conditional returns postcondition.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-holdsin-contract", + "shortName": null, + "description": "Allow contracts that specify a condition that holds true inside a lambda argument.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xname-based-destructuring", + "shortName": null, + "description": "Enables the following destructuring features:\n-Xname-based-destructuring=only-syntax: Enables syntax for positional destructuring with square brackets and the full form of name-based destructuring with parentheses;\n-Xname-based-destructuring=name-mismatch: Reports warnings when short form positional destructuring of data classes uses names that don't match the property names;\n-Xname-based-destructuring=complete: Enables short-form name-based destructuring with parentheses;", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "XXLanguage", + "shortName": null, + "description": "Enables/disables specified language feature.\nWarning: this flag is not intended for production use. If you want to configure the language behaviour use the\n-language-version or corresponding experimental feature flags.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xklib-relative-path-base", + "shortName": null, + "description": "Provide a base path to compute the source's relative paths in klib (default is empty).", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xklib-normalize-absolute-path", + "shortName": null, + "description": "Normalize absolute paths in klibs.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xklib-enable-signature-clash-checks", + "shortName": null, + "description": "Enable signature uniqueness checks.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xpartial-linkage", + "shortName": null, + "description": "Use partial linkage mode.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xpartial-linkage-loglevel", + "shortName": null, + "description": "Define the compile-time log level for partial linkage.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xklib-duplicated-unique-name-strategy", + "shortName": null, + "description": "Klib dependencies usage strategy when multiple KLIBs has same `unique_name` property value.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xklib-ir-inliner", + "shortName": null, + "description": "Set the mode of the experimental IR inliner on the first compilation stage.\n- `intra-module` mode enforces inlining of the functions only from the compiled module\n- `full` mode enforces inlining of all functions (from the compiled module and from all dependencies)\n Warning: This mode will trigger setting the `pre-release` flag for the compiled library.\n- `disabled` mode completely disables the IR inliner\n- `default` mode lets the IR inliner run in `intra-module`, `full` or `disabled` mode based on the current language version\n ", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "default" + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xklib-abi-version", + "shortName": null, + "description": "Specify the custom ABI version to be written in KLIB. This option is intended only for tests.\nWarning: This option does not affect KLIB ABI. Neither allows it making a KLIB backward-compatible with older ABI versions.\nThe only observable effect is that a custom ABI version is written to KLIB manifest file.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xklib-zip-file-accessor-cache-limit", + "shortName": null, + "description": "Maximum number of klibs that can be cached during compilation. Default is 64.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "64" + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xwasm", + "shortName": null, + "description": "Use the WebAssembly compiler backend.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-target", + "shortName": null, + "description": "Set up the Wasm target (wasm-js or wasm-wasi).", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-debug-info", + "shortName": null, + "description": "Add debug info to the compiled WebAssembly module.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-debug-friendly", + "shortName": null, + "description": "Avoid optimizations that can break debugging.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-generate-wat", + "shortName": null, + "description": "Generate a .wat file.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xwasm-kclass-fqn", + "shortName": null, + "description": "Enable support for 'KClass.qualifiedName'.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-enable-array-range-checks", + "shortName": null, + "description": "Turn on range checks for array access functions.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-enable-asserts", + "shortName": null, + "description": "Turn on asserts.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-use-traps-instead-of-exceptions", + "shortName": null, + "description": "Use traps instead of throwing exceptions.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-use-new-exception-proposal", + "shortName": null, + "description": "Use an updated version of the exception proposal with try_table.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-no-jstag", + "shortName": null, + "description": "Don't use WebAssembly.JSTag for throwing and catching exceptions", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-debugger-custom-formatters", + "shortName": null, + "description": "Generates devtools custom formatters (https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters) for Kotlin/Wasm values", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-source-map-include-mappings-from-unavailable-sources", + "shortName": null, + "description": "Insert source mappings from libraries even if their sources are unavailable on the end-user machine.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-preserve-ic-order", + "shortName": null, + "description": "Preserve wasm file structure between IC runs.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xwasm-ic-cache-readonly", + "shortName": null, + "description": "Do not commit IC cache updates.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-generate-dwarf", + "shortName": null, + "description": "Generate DWARF debug information.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-dce-dump-reachability-info-to-file", + "shortName": null, + "description": "Dump reachability information collected about declarations while performing DCE to a file. The format will be chosen automatically based on the file extension. Supported output formats include JSON for .json, a JS const initialized with a plain object containing information for .js, and plain text for all other file types.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-dump-declaration-ir-sizes-to-file", + "shortName": null, + "description": "Dump the IR size of each declaration into a file. The format will be chosen automatically depending on the file extension. Supported output formats include JSON for .json, a JS const initialized with a plain object containing information for .js, and plain text for all other file types.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "ir-output-dir", + "shortName": null, + "description": "Destination for generated files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "ir-output-name", + "shortName": null, + "description": "Base name of generated files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "libraries", + "shortName": null, + "description": "Paths to Kotlin libraries with .meta.js and .kjsm files, separated by the system path separator.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": "animation-core-wasm-js-1.7.0.klib:animation-graphics-wasm-js-1.7.0.klib:animation-wasm-js-1.7.0.klib:annotation-wasm-js-1.7.0.klib:atomicfu-wasm-js-0.23.2.klib:collection-wasm-js-1.7.0.klib:foundation-layout-wasm-js-1.7.0.klib:foundation-wasm-js-1.7.0.klib:kotlin-stdlib-wasm-js-{{KOTLIN_VERSION_PLACEHOLDER}}.klib:kotlinx-browser-wasm-js-0.1-javadoc.klib:kotlinx-coroutines-core-wasm-js-1.8.0.klib:kotlinx-datetime-wasm-js-0.6.0.klib:kotlinx-serialization-core-wasm-js-1.6.2.klib:library-wasm-js-1.7.0.klib:lifecycle-common-wasm-js-2.8.3.klib:lifecycle-runtime-compose-wasm-js-2.8.3.klib:lifecycle-runtime-wasm-js-2.8.3.klib:lifecycle-viewmodel-wasm-js-2.8.3.klib:material-icons-core-wasm-js-1.7.0.klib:material-ripple-wasm-js-1.7.0.klib:material-wasm-js-1.7.0.klib:material3-wasm-js-1.7.0.klib:runtime-saveable-wasm-js-1.7.0.klib:runtime-wasm-js-1.7.0.klib:skiko-wasm-js-0.8.15.klib:ui-geometry-wasm-js-1.7.0.klib:ui-graphics-wasm-js-1.7.0.klib:ui-text-wasm-js-1.7.0.klib:ui-unit-wasm-js-1.7.0.klib:ui-util-wasm-js-1.7.0.klib:ui-wasm-js-1.7.0.klib" + }, + { + "name": "source-map", + "shortName": null, + "description": "Generate a source map.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "source-map-prefix", + "shortName": null, + "description": "Add the specified prefix to the paths in the source map.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "source-map-base-dirs", + "shortName": null, + "description": "Base directories for calculating relative paths to source files in the source map.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "source-map-embed-sources", + "shortName": null, + "description": "Embed source files into the source map.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "source-map-names-policy", + "shortName": null, + "description": "Mode for mapping generated names to original names.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "target", + "shortName": null, + "description": "Generate JS files for the specified ECMA version.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-keep", + "shortName": null, + "description": "Comma-separated list of fully qualified names not to be eliminated by DCE (if it can be reached), and for which to keep non-minified names.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "module-kind", + "shortName": null, + "description": "The kind of JS module generated by the compiler. ES modules are enabled by default in case of ES2015 target usage", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "main", + "shortName": null, + "description": "Specify whether the 'main' function should be called upon execution.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-produce-klib-dir", + "shortName": null, + "description": "Generate an unpacked klib into the parent directory of the output JS file.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-produce-klib-file", + "shortName": null, + "description": "Generate a packed klib into the directory specified by '-ir-output-dir'.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-produce-js", + "shortName": null, + "description": "Generate a JS file using the IR backend.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-dce", + "shortName": null, + "description": "Perform experimental dead code elimination.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-dce-runtime-diagnostic", + "shortName": null, + "description": "Enable runtime diagnostics instead of removing declarations when performing DCE.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-dce-print-reachability-info", + "shortName": null, + "description": "Print reachability information about declarations to 'stdout' while performing DCE.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-property-lazy-initialization", + "shortName": null, + "description": "Perform lazy initialization for properties.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-minimized-member-names", + "shortName": null, + "description": "Minimize the names of members.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-module-name", + "shortName": null, + "description": "Specify the name of the compilation module for the IR backend.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-safe-external-boolean", + "shortName": null, + "description": "Wrap access to external 'Boolean' properties with an explicit conversion to 'Boolean'.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-safe-external-boolean-diagnostic", + "shortName": null, + "description": "Enable runtime diagnostics when accessing external 'Boolean' properties.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-per-module", + "shortName": null, + "description": "Generate one .js file per module.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-per-module-output-name", + "shortName": null, + "description": "Add a custom output name to the split .js files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-per-file", + "shortName": null, + "description": "Generate one .js file per source file.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-generate-inline-anonymous-functions", + "shortName": null, + "description": "Lambda expressions that capture values are translated into in-line anonymous JavaScript functions.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xinclude", + "shortName": null, + "description": "Path to an intermediate library that should be processed in the same manner as source files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcache-directory", + "shortName": null, + "description": "Path to the cache directory.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-build-cache", + "shortName": null, + "description": "Use the compiler to build the cache.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xgenerate-dts", + "shortName": null, + "description": "Generate a TypeScript declaration .d.ts file alongside the JS file.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xgenerate-polyfills", + "shortName": null, + "description": "Generate polyfills for features from the ES6+ standards.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xstrict-implicit-export-types", + "shortName": null, + "description": "Generate strict types for implicitly exported entities inside d.ts files.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xes-classes", + "shortName": null, + "description": "Let generated JavaScript code use ES2015 classes. Enabled by default in case of ES2015 target usage", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xplatform-arguments-in-main-function", + "shortName": null, + "description": "JS expression that will be executed in runtime and be put as an Array parameter of the main function", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xes-generators", + "shortName": null, + "description": "Enable ES2015 generator functions usage inside the compiled code. Enabled by default in case of ES2015 target usage", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xes-arrow-functions", + "shortName": null, + "description": "Use ES2015 arrow functions in the JavaScript code generated for Kotlin lambdas. Enabled by default in case of ES2015 target usage", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xes-long-as-bigint", + "shortName": null, + "description": "Compile Long values as ES2020 bigint instead of object.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xtyped-arrays", + "shortName": null, + "description": "This option does nothing and is left for compatibility with the legacy backend.\nIt is deprecated and will be removed in a future release.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xfriend-modules-disabled", + "shortName": null, + "description": "Disable internal declaration export.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfriend-modules", + "shortName": null, + "description": "Paths to friend modules.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xenable-extension-functions-in-externals", + "shortName": null, + "description": "Enable extension function members in external interfaces.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xfake-override-validator", + "shortName": null, + "description": "Enable the IR fake override validator.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xoptimize-generated-js", + "shortName": null, + "description": "Perform additional optimizations on the generated JS code.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + } + ] +} \ No newline at end of file diff --git a/src/test/resources/compiler-arguments/js-expected-compiler-args.json b/src/test/resources/compiler-arguments/js-expected-compiler-args.json new file mode 100644 index 000000000..73d87cf67 --- /dev/null +++ b/src/test/resources/compiler-arguments/js-expected-compiler-args.json @@ -0,0 +1,2020 @@ +{ + "compilerArguments": [ + { + "name": "help", + "shortName": "h", + "description": "Print a synopsis of standard options.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "X", + "shortName": null, + "description": "Print a synopsis of advanced options.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "version", + "shortName": null, + "description": "Display the compiler version.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "verbose", + "shortName": null, + "description": "Enable verbose logging output.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "nowarn", + "shortName": null, + "description": "Don't generate any warnings.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Werror", + "shortName": null, + "description": "Report an error if there are any warnings.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Wextra", + "shortName": null, + "description": "Enable extra checkers for K2.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "language-version", + "shortName": null, + "description": "Provide source compatibility with the specified version of Kotlin.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "api-version", + "shortName": null, + "description": "Allow using declarations from only the specified version of bundled libraries.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "kotlin-home", + "shortName": null, + "description": "Path to the Kotlin compiler home directory used for the discovery of runtime libraries.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "progressive", + "shortName": null, + "description": "Enable progressive compiler mode.\nIn this mode, deprecations and bug fixes for unstable code take effect immediately\ninstead of going through a graceful migration cycle.\nCode written in progressive mode is backward compatible; however, code written without\nprogressive mode enabled may cause compilation errors in progressive mode.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "script", + "shortName": null, + "description": "Evaluate the given Kotlin script (*.kts) file.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xrepl", + "shortName": null, + "description": "Run Kotlin REPL (deprecated)", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "opt-in", + "shortName": null, + "description": "Enable API usages that require opt-in with an opt-in requirement marker with the given fully qualified name.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xno-inline", + "shortName": null, + "description": "Disable method inlining.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xskip-metadata-version-check", + "shortName": null, + "description": "Allow loading classes with bad metadata versions and pre-release classes.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xskip-prerelease-check", + "shortName": null, + "description": "Allow loading pre-release classes.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-kotlin-package", + "shortName": null, + "description": "Allow compiling code in the 'kotlin' package, and allow not requiring 'kotlin.stdlib' in 'module-info'.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xstdlib-compilation", + "shortName": null, + "description": "Enables special features which are relevant only for stdlib compilation.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xreport-output-files", + "shortName": null, + "description": "Report the source-to-output file mapping.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xplugin", + "shortName": null, + "description": "Load plugins from the given classpath.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "P", + "shortName": null, + "description": "Pass an option to a plugin.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcompiler-plugin", + "shortName": null, + "description": "Register a compiler plugin.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcompiler-plugin-order", + "shortName": null, + "description": "Specify an execution order constraint for compiler plugins.\nOrder constraint can be specified using the 'pluginId' of compiler plugins.\nThe first specified plugin will be executed before the second plugin.\nMultiple constraints can be specified by repeating this option. Cycles in constraints will cause an error.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xmulti-platform", + "shortName": null, + "description": "Enable language support for multiplatform projects.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xno-check-actual", + "shortName": null, + "description": "Do not check for the presence of the 'actual' modifier in multiplatform projects.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xintellij-plugin-root", + "shortName": null, + "description": "Path to 'kotlin-compiler.jar' or the directory where the IntelliJ IDEA configuration files can be found.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xnew-inference", + "shortName": null, + "description": "Enable the new experimental generic type inference algorithm.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xinline-classes", + "shortName": null, + "description": "Enable experimental inline classes.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xreport-perf", + "shortName": null, + "description": "Report detailed performance statistics.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdetailed-perf", + "shortName": null, + "description": "Enable more detailed performance statistics (Experimental).\nFor Native, the performance report includes execution time and lines processed per second for every individual lowering.\nFor WASM and JS, the performance report includes execution time and lines per second for each lowering of the first stage of compilation.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdump-perf", + "shortName": null, + "description": "Dump detailed performance statistics to the specified file in plain text, JSON or markdown format (it's detected by the file's extension).\nAlso, it supports the placeholder `*` and directory for generating file names based on the module being compiled and the current time stamp.\nExample: `path/to/dir/*.log` creates logs like `path/to/dir/my-module_2025-06-20-12-22-32.log` in plain text format, `path/to/dir/` creates logs like `path/to/dir/my-log_2025-06-20-12-22-32.json`.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "XXdump-model", + "shortName": null, + "description": "Dump compilation model to specified directory for use in modularized tests.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xmetadata-version", + "shortName": null, + "description": "Change the metadata version of the generated binary files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcommon-sources", + "shortName": null, + "description": "Sources of the common module that need to be compiled together with this module in multiplatform mode.\nThey should be a subset of sources passed as free arguments.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xlist-phases", + "shortName": null, + "description": "List backend phases.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdisable-phases", + "shortName": null, + "description": "Disable backend phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xverbose-phases", + "shortName": null, + "description": "Be verbose while performing the given backend phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-dump-before", + "shortName": null, + "description": "Dump the backend's state before these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-dump-after", + "shortName": null, + "description": "Dump the backend's state after these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-dump", + "shortName": null, + "description": "Dump the backend's state both before and after these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdump-directory", + "shortName": null, + "description": "Dump the backend state into this directory.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdump-fqname", + "shortName": null, + "description": "Dump the declaration with the given FqName.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-validate-before", + "shortName": null, + "description": "Validate the backend's state before these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-validate-after", + "shortName": null, + "description": "Validate the backend's state after these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-validate", + "shortName": null, + "description": "Validate the backend's state both before and after these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xverify-ir", + "shortName": null, + "description": "IR verification mode (no verification by default).", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xverify-ir-visibility", + "shortName": null, + "description": "Check for visibility violations in IR when validating it before running any lowerings. Only has effect if '-Xverify-ir' is not 'none'.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xprofile-phases", + "shortName": null, + "description": "Profile backend phases.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcheck-phase-conditions", + "shortName": null, + "description": "Check pre- and postconditions of IR lowering phases.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xuse-fir-experimental-checkers", + "shortName": null, + "description": "Enable experimental frontend IR checkers that are not yet ready for production.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xuse-fir-ic", + "shortName": null, + "description": "Compile using frontend IR internal incremental compilation.\nWarning: This feature is not yet production-ready.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xuse-fir-lt", + "shortName": null, + "description": "Compile using the LightTree parser with the frontend IR.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xmetadata-klib", + "shortName": null, + "description": "Produce a klib that only contains the metadata of declarations.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdisable-default-scripting-plugin", + "shortName": null, + "description": "Don't enable the scripting plugin by default.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xexplicit-api", + "shortName": null, + "description": "Force the compiler to report errors on all public API declarations without an explicit visibility or a return type.\nUse the 'warning' level to issue warnings instead of errors.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "disable" + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "XXexplicit-return-types", + "shortName": null, + "description": "Force the compiler to report errors on all public API declarations without an explicit return type.\nUse the 'warning' level to issue warnings instead of errors.\nThis flag partially enables functionality of `-Xexplicit-api` flag, so please don't use them altogether", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "disable" + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xreturn-value-checker", + "shortName": null, + "description": "Set improved unused return value checker mode. Use 'check' to run checker only and use 'full' to also enable automatic annotation insertion.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "disable" + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xsuppress-version-warnings", + "shortName": null, + "description": "Suppress warnings about outdated, inconsistent, or experimental language or API versions.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xsuppress-api-version-greater-than-language-version-error", + "shortName": null, + "description": "Suppress error about API version greater than language version.\nWarning: This is temporary solution (see KT-63712) intended to be used only for stdlib build.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xexpect-actual-classes", + "shortName": null, + "description": "'expect'/'actual' classes (including interfaces, objects, annotations, enums, and 'actual' typealiases) are in Beta.\nKotlin reports a warning every time you use one of them. You can use this flag to mute the warning.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xconsistent-data-class-copy-visibility", + "shortName": null, + "description": "The effect of this compiler flag is the same as applying @ConsistentCopyVisibility annotation to all data classes in the module. See https://youtrack.jetbrains.com/issue/KT-11914", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xunrestricted-builder-inference", + "shortName": null, + "description": "Eliminate builder inference restrictions, for example by allowing type variables to be returned from builder inference calls.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xcontext-receivers", + "shortName": null, + "description": "Enable experimental context receivers.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xcontext-parameters", + "shortName": null, + "description": "Enable experimental context parameters.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xcontext-sensitive-resolution", + "shortName": null, + "description": "Enable experimental context-sensitive resolution.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xnon-local-break-continue", + "shortName": null, + "description": "Enable experimental non-local break and continue.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xdata-flow-based-exhaustiveness", + "shortName": null, + "description": "Enable `when` exhaustiveness improvements that rely on data-flow analysis.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xexplicit-backing-fields", + "shortName": null, + "description": "Enable experimental language support for explicit backing fields.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xdirect-java-actualization", + "shortName": null, + "description": "Enable experimental direct Java actualization support.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xmulti-dollar-interpolation", + "shortName": null, + "description": "Enable experimental multi-dollar interpolation.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xenable-incremental-compilation", + "shortName": null, + "description": "Enable incremental compilation.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xrender-internal-diagnostic-names", + "shortName": null, + "description": "Render the internal names of warnings and errors.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-any-scripts-in-source-roots", + "shortName": null, + "description": "Allow compiling scripts along with regular Kotlin sources.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xreport-all-warnings", + "shortName": null, + "description": "Report all warnings even if errors are found.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xfragments", + "shortName": null, + "description": "Declare all known fragments of a multiplatform compilation.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfragment-sources", + "shortName": null, + "description": "Add sources to a specific fragment of a multiplatform compilation.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfragment-refines", + "shortName": null, + "description": "Declare that refines with the dependsOn/refines relation.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfragment-dependency", + "shortName": null, + "description": "Declare common klib dependencies for the specific fragment.\nThis argument is required for any HMPP module except the platform leaf module: it takes dependencies from -cp/-libraries.\nThe argument should be used only if the new compilation scheme is enabled with -Xseparate-kmp-compilation\n", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfragment-friend-dependency", + "shortName": null, + "description": "Declare common klib friend dependencies for the specific fragment.\nThis argument can be specified for any HMPP module except the platform leaf module: it takes dependencies from the platform specific friend module arguments.\nThe argument should be used only if the new compilation scheme is enabled with -Xseparate-kmp-compilation\n", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xseparate-kmp-compilation", + "shortName": null, + "description": "Enables the separated compilation scheme, in which common source sets are analyzed against their own dependencies", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xignore-const-optimization-errors", + "shortName": null, + "description": "Ignore all compilation exceptions while optimizing some constant expressions.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xdont-warn-on-error-suppression", + "shortName": null, + "description": "Don't report warnings when errors are suppressed. This only affects K2.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwhen-guards", + "shortName": null, + "description": "Enable experimental language support for when guards.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xnested-type-aliases", + "shortName": null, + "description": "Enable experimental language support for nested type aliases.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xsuppress-warning", + "shortName": null, + "description": "Suppress specified warning module-wide. This option is deprecated in favor of \"-Xwarning-level\" flag", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwarning-level", + "shortName": null, + "description": "Set the severity of the given warning.\n- `error` level raises the severity of a warning to error level (similar to -Werror but more granular)\n- `disabled` level suppresses reporting of a warning (similar to -nowarn but more granular)\n- `warning` level overrides -nowarn and -Werror for this specific warning (the warning will be reported/won't be considered as an error)", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xannotation-default-target", + "shortName": null, + "description": "Change the default annotation targets for constructor properties:\n-Xannotation-default-target=first-only: use the first of the following allowed targets: '@param:', '@property:', '@field:';\n-Xannotation-default-target=first-only-warn: same as first-only, and raise warnings when both '@param:' and either '@property:' or '@field:' are allowed;\n-Xannotation-default-target=param-property: use '@param:' target if applicable, and also use the first of either '@property:' or '@field:';\ndefault: 'first-only-warn' in language version 2.2+, 'first-only' in version 2.1 and before.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "XXdebug-level-compiler-checks", + "shortName": null, + "description": "Enable debug level compiler checks. ATTENTION: these checks can slow compiler down or even crash it.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xannotation-target-all", + "shortName": null, + "description": "Enable experimental language support for @all: annotation use-site target.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "XXlenient-mode", + "shortName": null, + "description": "Lenient compiler mode. When actuals are missing, placeholder declarations are generated.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-reified-type-in-catch", + "shortName": null, + "description": "Allow 'catch' parameters to have reified types.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-contracts-on-more-functions", + "shortName": null, + "description": "Allow contracts on some operators and accessors, and allow checks for erased types.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-condition-implies-returns-contracts", + "shortName": null, + "description": "Allow contracts that specify a limited conditional returns postcondition.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-holdsin-contract", + "shortName": null, + "description": "Allow contracts that specify a condition that holds true inside a lambda argument.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xname-based-destructuring", + "shortName": null, + "description": "Enables the following destructuring features:\n-Xname-based-destructuring=only-syntax: Enables syntax for positional destructuring with square brackets and the full form of name-based destructuring with parentheses;\n-Xname-based-destructuring=name-mismatch: Reports warnings when short form positional destructuring of data classes uses names that don't match the property names;\n-Xname-based-destructuring=complete: Enables short-form name-based destructuring with parentheses;", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "XXLanguage", + "shortName": null, + "description": "Enables/disables specified language feature.\nWarning: this flag is not intended for production use. If you want to configure the language behaviour use the\n-language-version or corresponding experimental feature flags.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xklib-relative-path-base", + "shortName": null, + "description": "Provide a base path to compute the source's relative paths in klib (default is empty).", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xklib-normalize-absolute-path", + "shortName": null, + "description": "Normalize absolute paths in klibs.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xklib-enable-signature-clash-checks", + "shortName": null, + "description": "Enable signature uniqueness checks.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xpartial-linkage", + "shortName": null, + "description": "Use partial linkage mode.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xpartial-linkage-loglevel", + "shortName": null, + "description": "Define the compile-time log level for partial linkage.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xklib-duplicated-unique-name-strategy", + "shortName": null, + "description": "Klib dependencies usage strategy when multiple KLIBs has same `unique_name` property value.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xklib-ir-inliner", + "shortName": null, + "description": "Set the mode of the experimental IR inliner on the first compilation stage.\n- `intra-module` mode enforces inlining of the functions only from the compiled module\n- `full` mode enforces inlining of all functions (from the compiled module and from all dependencies)\n Warning: This mode will trigger setting the `pre-release` flag for the compiled library.\n- `disabled` mode completely disables the IR inliner\n- `default` mode lets the IR inliner run in `intra-module`, `full` or `disabled` mode based on the current language version\n ", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "default" + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xklib-abi-version", + "shortName": null, + "description": "Specify the custom ABI version to be written in KLIB. This option is intended only for tests.\nWarning: This option does not affect KLIB ABI. Neither allows it making a KLIB backward-compatible with older ABI versions.\nThe only observable effect is that a custom ABI version is written to KLIB manifest file.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xklib-zip-file-accessor-cache-limit", + "shortName": null, + "description": "Maximum number of klibs that can be cached during compilation. Default is 64.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "64" + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xwasm", + "shortName": null, + "description": "Use the WebAssembly compiler backend.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-target", + "shortName": null, + "description": "Set up the Wasm target (wasm-js or wasm-wasi).", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-debug-info", + "shortName": null, + "description": "Add debug info to the compiled WebAssembly module.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-debug-friendly", + "shortName": null, + "description": "Avoid optimizations that can break debugging.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-generate-wat", + "shortName": null, + "description": "Generate a .wat file.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xwasm-kclass-fqn", + "shortName": null, + "description": "Enable support for 'KClass.qualifiedName'.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-enable-array-range-checks", + "shortName": null, + "description": "Turn on range checks for array access functions.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-enable-asserts", + "shortName": null, + "description": "Turn on asserts.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-use-traps-instead-of-exceptions", + "shortName": null, + "description": "Use traps instead of throwing exceptions.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-use-new-exception-proposal", + "shortName": null, + "description": "Use an updated version of the exception proposal with try_table.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-no-jstag", + "shortName": null, + "description": "Don't use WebAssembly.JSTag for throwing and catching exceptions", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-debugger-custom-formatters", + "shortName": null, + "description": "Generates devtools custom formatters (https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters) for Kotlin/Wasm values", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-source-map-include-mappings-from-unavailable-sources", + "shortName": null, + "description": "Insert source mappings from libraries even if their sources are unavailable on the end-user machine.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-preserve-ic-order", + "shortName": null, + "description": "Preserve wasm file structure between IC runs.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xwasm-ic-cache-readonly", + "shortName": null, + "description": "Do not commit IC cache updates.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-generate-dwarf", + "shortName": null, + "description": "Generate DWARF debug information.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-dce-dump-reachability-info-to-file", + "shortName": null, + "description": "Dump reachability information collected about declarations while performing DCE to a file. The format will be chosen automatically based on the file extension. Supported output formats include JSON for .json, a JS const initialized with a plain object containing information for .js, and plain text for all other file types.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-dump-declaration-ir-sizes-to-file", + "shortName": null, + "description": "Dump the IR size of each declaration into a file. The format will be chosen automatically depending on the file extension. Supported output formats include JSON for .json, a JS const initialized with a plain object containing information for .js, and plain text for all other file types.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "ir-output-dir", + "shortName": null, + "description": "Destination for generated files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "ir-output-name", + "shortName": null, + "description": "Base name of generated files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "libraries", + "shortName": null, + "description": "Paths to Kotlin libraries with .meta.js and .kjsm files, separated by the system path separator.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": "kotlin-dom-api-compat-{{KOTLIN_VERSION_PLACEHOLDER}}.klib:kotlin-stdlib-js-{{KOTLIN_VERSION_PLACEHOLDER}}.klib" + }, + { + "name": "source-map", + "shortName": null, + "description": "Generate a source map.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "source-map-prefix", + "shortName": null, + "description": "Add the specified prefix to the paths in the source map.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "source-map-base-dirs", + "shortName": null, + "description": "Base directories for calculating relative paths to source files in the source map.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "source-map-embed-sources", + "shortName": null, + "description": "Embed source files into the source map.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "source-map-names-policy", + "shortName": null, + "description": "Mode for mapping generated names to original names.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "target", + "shortName": null, + "description": "Generate JS files for the specified ECMA version.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-keep", + "shortName": null, + "description": "Comma-separated list of fully qualified names not to be eliminated by DCE (if it can be reached), and for which to keep non-minified names.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "module-kind", + "shortName": null, + "description": "The kind of JS module generated by the compiler. ES modules are enabled by default in case of ES2015 target usage", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "main", + "shortName": null, + "description": "Specify whether the 'main' function should be called upon execution.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-produce-klib-dir", + "shortName": null, + "description": "Generate an unpacked klib into the parent directory of the output JS file.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-produce-klib-file", + "shortName": null, + "description": "Generate a packed klib into the directory specified by '-ir-output-dir'.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-produce-js", + "shortName": null, + "description": "Generate a JS file using the IR backend.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-dce", + "shortName": null, + "description": "Perform experimental dead code elimination.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-dce-runtime-diagnostic", + "shortName": null, + "description": "Enable runtime diagnostics instead of removing declarations when performing DCE.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-dce-print-reachability-info", + "shortName": null, + "description": "Print reachability information about declarations to 'stdout' while performing DCE.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-property-lazy-initialization", + "shortName": null, + "description": "Perform lazy initialization for properties.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-minimized-member-names", + "shortName": null, + "description": "Minimize the names of members.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-module-name", + "shortName": null, + "description": "Specify the name of the compilation module for the IR backend.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-safe-external-boolean", + "shortName": null, + "description": "Wrap access to external 'Boolean' properties with an explicit conversion to 'Boolean'.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-safe-external-boolean-diagnostic", + "shortName": null, + "description": "Enable runtime diagnostics when accessing external 'Boolean' properties.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-per-module", + "shortName": null, + "description": "Generate one .js file per module.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-per-module-output-name", + "shortName": null, + "description": "Add a custom output name to the split .js files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-per-file", + "shortName": null, + "description": "Generate one .js file per source file.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-generate-inline-anonymous-functions", + "shortName": null, + "description": "Lambda expressions that capture values are translated into in-line anonymous JavaScript functions.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xinclude", + "shortName": null, + "description": "Path to an intermediate library that should be processed in the same manner as source files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcache-directory", + "shortName": null, + "description": "Path to the cache directory.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-build-cache", + "shortName": null, + "description": "Use the compiler to build the cache.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xgenerate-dts", + "shortName": null, + "description": "Generate a TypeScript declaration .d.ts file alongside the JS file.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xgenerate-polyfills", + "shortName": null, + "description": "Generate polyfills for features from the ES6+ standards.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xstrict-implicit-export-types", + "shortName": null, + "description": "Generate strict types for implicitly exported entities inside d.ts files.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xes-classes", + "shortName": null, + "description": "Let generated JavaScript code use ES2015 classes. Enabled by default in case of ES2015 target usage", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xplatform-arguments-in-main-function", + "shortName": null, + "description": "JS expression that will be executed in runtime and be put as an Array parameter of the main function", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xes-generators", + "shortName": null, + "description": "Enable ES2015 generator functions usage inside the compiled code. Enabled by default in case of ES2015 target usage", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xes-arrow-functions", + "shortName": null, + "description": "Use ES2015 arrow functions in the JavaScript code generated for Kotlin lambdas. Enabled by default in case of ES2015 target usage", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xes-long-as-bigint", + "shortName": null, + "description": "Compile Long values as ES2020 bigint instead of object.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xtyped-arrays", + "shortName": null, + "description": "This option does nothing and is left for compatibility with the legacy backend.\nIt is deprecated and will be removed in a future release.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xfriend-modules-disabled", + "shortName": null, + "description": "Disable internal declaration export.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfriend-modules", + "shortName": null, + "description": "Paths to friend modules.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xenable-extension-functions-in-externals", + "shortName": null, + "description": "Enable extension function members in external interfaces.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xfake-override-validator", + "shortName": null, + "description": "Enable the IR fake override validator.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xoptimize-generated-js", + "shortName": null, + "description": "Perform additional optimizations on the generated JS code.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + } + ] +} \ No newline at end of file diff --git a/src/test/resources/compiler-arguments/jvm-expected-compiler-args.json b/src/test/resources/compiler-arguments/jvm-expected-compiler-args.json new file mode 100644 index 000000000..86620d64f --- /dev/null +++ b/src/test/resources/compiler-arguments/jvm-expected-compiler-args.json @@ -0,0 +1,2116 @@ +{ + "compilerArguments": [ + { + "name": "help", + "shortName": "h", + "description": "Print a synopsis of standard options.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "X", + "shortName": null, + "description": "Print a synopsis of advanced options.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "version", + "shortName": null, + "description": "Display the compiler version.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "verbose", + "shortName": null, + "description": "Enable verbose logging output.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "nowarn", + "shortName": null, + "description": "Don't generate any warnings.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Werror", + "shortName": null, + "description": "Report an error if there are any warnings.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Wextra", + "shortName": null, + "description": "Enable extra checkers for K2.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "language-version", + "shortName": null, + "description": "Provide source compatibility with the specified version of Kotlin.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "api-version", + "shortName": null, + "description": "Allow using declarations from only the specified version of bundled libraries.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "kotlin-home", + "shortName": null, + "description": "Path to the Kotlin compiler home directory used for the discovery of runtime libraries.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "progressive", + "shortName": null, + "description": "Enable progressive compiler mode.\nIn this mode, deprecations and bug fixes for unstable code take effect immediately\ninstead of going through a graceful migration cycle.\nCode written in progressive mode is backward compatible; however, code written without\nprogressive mode enabled may cause compilation errors in progressive mode.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "script", + "shortName": null, + "description": "Evaluate the given Kotlin script (*.kts) file.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xrepl", + "shortName": null, + "description": "Run Kotlin REPL (deprecated)", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "opt-in", + "shortName": null, + "description": "Enable API usages that require opt-in with an opt-in requirement marker with the given fully qualified name.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": false, + "predefinedValues": [ + "kotlin.ExperimentalStdlibApi", + "kotlin.time.ExperimentalTime", + "kotlin.RequiresOptIn", + "kotlin.ExperimentalUnsignedTypes", + "kotlin.contracts.ExperimentalContracts", + "kotlin.experimental.ExperimentalTypeInference", + "kotlin.uuid.ExperimentalUuidApi", + "kotlin.io.encoding.ExperimentalEncodingApi", + "kotlin.concurrent.atomics.ExperimentalAtomicApi" + ] + }, + { + "name": "Xno-inline", + "shortName": null, + "description": "Disable method inlining.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xskip-metadata-version-check", + "shortName": null, + "description": "Allow loading classes with bad metadata versions and pre-release classes.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xskip-prerelease-check", + "shortName": null, + "description": "Allow loading pre-release classes.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-kotlin-package", + "shortName": null, + "description": "Allow compiling code in the 'kotlin' package, and allow not requiring 'kotlin.stdlib' in 'module-info'.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xstdlib-compilation", + "shortName": null, + "description": "Enables special features which are relevant only for stdlib compilation.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xreport-output-files", + "shortName": null, + "description": "Report the source-to-output file mapping.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xplugin", + "shortName": null, + "description": "Load plugins from the given classpath.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": [ + {{PLUGIN_PLACEHOLDER}} + ] + }, + { + "name": "P", + "shortName": null, + "description": "Pass an option to a plugin.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcompiler-plugin", + "shortName": null, + "description": "Register a compiler plugin.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcompiler-plugin-order", + "shortName": null, + "description": "Specify an execution order constraint for compiler plugins.\nOrder constraint can be specified using the 'pluginId' of compiler plugins.\nThe first specified plugin will be executed before the second plugin.\nMultiple constraints can be specified by repeating this option. Cycles in constraints will cause an error.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xmulti-platform", + "shortName": null, + "description": "Enable language support for multiplatform projects.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xno-check-actual", + "shortName": null, + "description": "Do not check for the presence of the 'actual' modifier in multiplatform projects.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xintellij-plugin-root", + "shortName": null, + "description": "Path to 'kotlin-compiler.jar' or the directory where the IntelliJ IDEA configuration files can be found.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xnew-inference", + "shortName": null, + "description": "Enable the new experimental generic type inference algorithm.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xinline-classes", + "shortName": null, + "description": "Enable experimental inline classes.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xreport-perf", + "shortName": null, + "description": "Report detailed performance statistics.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdetailed-perf", + "shortName": null, + "description": "Enable more detailed performance statistics (Experimental).\nFor Native, the performance report includes execution time and lines processed per second for every individual lowering.\nFor WASM and JS, the performance report includes execution time and lines per second for each lowering of the first stage of compilation.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdump-perf", + "shortName": null, + "description": "Dump detailed performance statistics to the specified file in plain text, JSON or markdown format (it's detected by the file's extension).\nAlso, it supports the placeholder `*` and directory for generating file names based on the module being compiled and the current time stamp.\nExample: `path/to/dir/*.log` creates logs like `path/to/dir/my-module_2025-06-20-12-22-32.log` in plain text format, `path/to/dir/` creates logs like `path/to/dir/my-log_2025-06-20-12-22-32.json`.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "XXdump-model", + "shortName": null, + "description": "Dump compilation model to specified directory for use in modularized tests.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xmetadata-version", + "shortName": null, + "description": "Change the metadata version of the generated binary files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcommon-sources", + "shortName": null, + "description": "Sources of the common module that need to be compiled together with this module in multiplatform mode.\nThey should be a subset of sources passed as free arguments.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xlist-phases", + "shortName": null, + "description": "List backend phases.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdisable-phases", + "shortName": null, + "description": "Disable backend phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xverbose-phases", + "shortName": null, + "description": "Be verbose while performing the given backend phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-dump-before", + "shortName": null, + "description": "Dump the backend's state before these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-dump-after", + "shortName": null, + "description": "Dump the backend's state after these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-dump", + "shortName": null, + "description": "Dump the backend's state both before and after these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdump-directory", + "shortName": null, + "description": "Dump the backend state into this directory.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdump-fqname", + "shortName": null, + "description": "Dump the declaration with the given FqName.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-validate-before", + "shortName": null, + "description": "Validate the backend's state before these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-validate-after", + "shortName": null, + "description": "Validate the backend's state after these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-validate", + "shortName": null, + "description": "Validate the backend's state both before and after these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xverify-ir", + "shortName": null, + "description": "IR verification mode (no verification by default).", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xverify-ir-visibility", + "shortName": null, + "description": "Check for visibility violations in IR when validating it before running any lowerings. Only has effect if '-Xverify-ir' is not 'none'.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xprofile-phases", + "shortName": null, + "description": "Profile backend phases.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcheck-phase-conditions", + "shortName": null, + "description": "Check pre- and postconditions of IR lowering phases.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xuse-fir-experimental-checkers", + "shortName": null, + "description": "Enable experimental frontend IR checkers that are not yet ready for production.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xuse-fir-ic", + "shortName": null, + "description": "Compile using frontend IR internal incremental compilation.\nWarning: This feature is not yet production-ready.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xuse-fir-lt", + "shortName": null, + "description": "Compile using the LightTree parser with the frontend IR.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xmetadata-klib", + "shortName": null, + "description": "Produce a klib that only contains the metadata of declarations.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdisable-default-scripting-plugin", + "shortName": null, + "description": "Don't enable the scripting plugin by default.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xexplicit-api", + "shortName": null, + "description": "Force the compiler to report errors on all public API declarations without an explicit visibility or a return type.\nUse the 'warning' level to issue warnings instead of errors.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "disable" + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "XXexplicit-return-types", + "shortName": null, + "description": "Force the compiler to report errors on all public API declarations without an explicit return type.\nUse the 'warning' level to issue warnings instead of errors.\nThis flag partially enables functionality of `-Xexplicit-api` flag, so please don't use them altogether", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "disable" + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xreturn-value-checker", + "shortName": null, + "description": "Set improved unused return value checker mode. Use 'check' to run checker only and use 'full' to also enable automatic annotation insertion.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "disable" + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xsuppress-version-warnings", + "shortName": null, + "description": "Suppress warnings about outdated, inconsistent, or experimental language or API versions.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xsuppress-api-version-greater-than-language-version-error", + "shortName": null, + "description": "Suppress error about API version greater than language version.\nWarning: This is temporary solution (see KT-63712) intended to be used only for stdlib build.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xexpect-actual-classes", + "shortName": null, + "description": "'expect'/'actual' classes (including interfaces, objects, annotations, enums, and 'actual' typealiases) are in Beta.\nKotlin reports a warning every time you use one of them. You can use this flag to mute the warning.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xconsistent-data-class-copy-visibility", + "shortName": null, + "description": "The effect of this compiler flag is the same as applying @ConsistentCopyVisibility annotation to all data classes in the module. See https://youtrack.jetbrains.com/issue/KT-11914", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xunrestricted-builder-inference", + "shortName": null, + "description": "Eliminate builder inference restrictions, for example by allowing type variables to be returned from builder inference calls.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xcontext-receivers", + "shortName": null, + "description": "Enable experimental context receivers.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xcontext-parameters", + "shortName": null, + "description": "Enable experimental context parameters.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xcontext-sensitive-resolution", + "shortName": null, + "description": "Enable experimental context-sensitive resolution.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xnon-local-break-continue", + "shortName": null, + "description": "Enable experimental non-local break and continue.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xdata-flow-based-exhaustiveness", + "shortName": null, + "description": "Enable `when` exhaustiveness improvements that rely on data-flow analysis.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xexplicit-backing-fields", + "shortName": null, + "description": "Enable experimental language support for explicit backing fields.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xdirect-java-actualization", + "shortName": null, + "description": "Enable experimental direct Java actualization support.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xmulti-dollar-interpolation", + "shortName": null, + "description": "Enable experimental multi-dollar interpolation.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xenable-incremental-compilation", + "shortName": null, + "description": "Enable incremental compilation.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xrender-internal-diagnostic-names", + "shortName": null, + "description": "Render the internal names of warnings and errors.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-any-scripts-in-source-roots", + "shortName": null, + "description": "Allow compiling scripts along with regular Kotlin sources.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xreport-all-warnings", + "shortName": null, + "description": "Report all warnings even if errors are found.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xfragments", + "shortName": null, + "description": "Declare all known fragments of a multiplatform compilation.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfragment-sources", + "shortName": null, + "description": "Add sources to a specific fragment of a multiplatform compilation.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfragment-refines", + "shortName": null, + "description": "Declare that refines with the dependsOn/refines relation.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfragment-dependency", + "shortName": null, + "description": "Declare common klib dependencies for the specific fragment.\nThis argument is required for any HMPP module except the platform leaf module: it takes dependencies from -cp/-libraries.\nThe argument should be used only if the new compilation scheme is enabled with -Xseparate-kmp-compilation\n", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfragment-friend-dependency", + "shortName": null, + "description": "Declare common klib friend dependencies for the specific fragment.\nThis argument can be specified for any HMPP module except the platform leaf module: it takes dependencies from the platform specific friend module arguments.\nThe argument should be used only if the new compilation scheme is enabled with -Xseparate-kmp-compilation\n", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xseparate-kmp-compilation", + "shortName": null, + "description": "Enables the separated compilation scheme, in which common source sets are analyzed against their own dependencies", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xignore-const-optimization-errors", + "shortName": null, + "description": "Ignore all compilation exceptions while optimizing some constant expressions.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xdont-warn-on-error-suppression", + "shortName": null, + "description": "Don't report warnings when errors are suppressed. This only affects K2.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwhen-guards", + "shortName": null, + "description": "Enable experimental language support for when guards.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xnested-type-aliases", + "shortName": null, + "description": "Enable experimental language support for nested type aliases.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xsuppress-warning", + "shortName": null, + "description": "Suppress specified warning module-wide. This option is deprecated in favor of \"-Xwarning-level\" flag", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwarning-level", + "shortName": null, + "description": "Set the severity of the given warning.\n- `error` level raises the severity of a warning to error level (similar to -Werror but more granular)\n- `disabled` level suppresses reporting of a warning (similar to -nowarn but more granular)\n- `warning` level overrides -nowarn and -Werror for this specific warning (the warning will be reported/won't be considered as an error)", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xannotation-default-target", + "shortName": null, + "description": "Change the default annotation targets for constructor properties:\n-Xannotation-default-target=first-only: use the first of the following allowed targets: '@param:', '@property:', '@field:';\n-Xannotation-default-target=first-only-warn: same as first-only, and raise warnings when both '@param:' and either '@property:' or '@field:' are allowed;\n-Xannotation-default-target=param-property: use '@param:' target if applicable, and also use the first of either '@property:' or '@field:';\ndefault: 'first-only-warn' in language version 2.2+, 'first-only' in version 2.1 and before.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "XXdebug-level-compiler-checks", + "shortName": null, + "description": "Enable debug level compiler checks. ATTENTION: these checks can slow compiler down or even crash it.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xannotation-target-all", + "shortName": null, + "description": "Enable experimental language support for @all: annotation use-site target.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "XXlenient-mode", + "shortName": null, + "description": "Lenient compiler mode. When actuals are missing, placeholder declarations are generated.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-reified-type-in-catch", + "shortName": null, + "description": "Allow 'catch' parameters to have reified types.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-contracts-on-more-functions", + "shortName": null, + "description": "Allow contracts on some operators and accessors, and allow checks for erased types.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-condition-implies-returns-contracts", + "shortName": null, + "description": "Allow contracts that specify a limited conditional returns postcondition.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-holdsin-contract", + "shortName": null, + "description": "Allow contracts that specify a condition that holds true inside a lambda argument.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xname-based-destructuring", + "shortName": null, + "description": "Enables the following destructuring features:\n-Xname-based-destructuring=only-syntax: Enables syntax for positional destructuring with square brackets and the full form of name-based destructuring with parentheses;\n-Xname-based-destructuring=name-mismatch: Reports warnings when short form positional destructuring of data classes uses names that don't match the property names;\n-Xname-based-destructuring=complete: Enables short-form name-based destructuring with parentheses;", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "XXLanguage", + "shortName": null, + "description": "Enables/disables specified language feature.\nWarning: this flag is not intended for production use. If you want to configure the language behaviour use the\n-language-version or corresponding experimental feature flags.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "d", + "shortName": null, + "description": "Destination for generated class files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "classpath", + "shortName": "cp", + "description": "List of directories and JAR/ZIP archives to search for user class files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": "{{CLASSPATH_PLACEHOLDER}}" + }, + { + "name": "include-runtime", + "shortName": null, + "description": "Include the Kotlin runtime in the resulting JAR.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "jdk-home", + "shortName": null, + "description": "Include a custom JDK from the specified location in the classpath instead of the default 'JAVA_HOME'.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "no-jdk", + "shortName": null, + "description": "Don't automatically include the Java runtime in the classpath.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "no-stdlib", + "shortName": null, + "description": "Don't automatically include the Kotlin/JVM stdlib and Kotlin reflection dependencies in the classpath.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "no-reflect", + "shortName": null, + "description": "Don't automatically include the Kotlin reflection dependency in the classpath.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "expression", + "shortName": "e", + "description": "Evaluate the given string as a Kotlin script.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "script-templates", + "shortName": null, + "description": "Script definition template classes.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "module-name", + "shortName": null, + "description": "Name of the generated '.kotlin_module' file.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "jvm-target", + "shortName": null, + "description": "The target version of the generated JVM bytecode (1.8 and 9–24), with 1.8 as the default.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "java-parameters", + "shortName": null, + "description": "Generate metadata for Java 1.8 reflection on method parameters.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "jvm-default", + "shortName": null, + "description": "Emit JVM default methods for interface declarations with bodies. The default is 'enable'.\n-jvm-default=enable Generate default methods for non-abstract interface declarations, as well as 'DefaultImpls' classes with\n static methods for compatibility with code compiled in the 'disable' mode.\n This is the default behavior since language version 2.2.\n-jvm-default=no-compatibility Generate default methods for non-abstract interface declarations. Do not generate 'DefaultImpls' classes.\n-jvm-default=disable Do not generate JVM default methods. This is the default behavior up to language version 2.1.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-unstable-dependencies", + "shortName": null, + "description": "Do not report errors on classes in dependencies that were compiled by an unstable version of the Kotlin compiler.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xabi-stability", + "shortName": null, + "description": "When using unstable compiler features such as FIR, use 'stable' to mark generated class files as stable\nto prevent diagnostics from being reported when using stable compilers at the call site.\nWhen using the JVM IR backend, conversely, use 'unstable' to mark generated class files as unstable\nto force diagnostics to be reported.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-do-not-clear-binding-context", + "shortName": null, + "description": "When using the IR backend, do not clear BindingContext between 'psi2ir' and lowerings.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xbackend-threads", + "shortName": null, + "description": "Run codegen phase in N parallel threads.\n0 means use one thread per processor core.\nThe default value is 1.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "1" + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xmodule-path", + "shortName": null, + "description": "Paths to Java 9+ modules.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xadd-modules", + "shortName": null, + "description": "Root modules to resolve in addition to the initial modules, or all modules on the module path if is ALL-MODULE-PATH.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xno-call-assertions", + "shortName": null, + "description": "Don't generate not-null assertions for arguments of platform types.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xno-receiver-assertions", + "shortName": null, + "description": "Don't generate not-null assertions for extension receiver arguments of platform types.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xno-param-assertions", + "shortName": null, + "description": "Don't generate not-null assertions on parameters of methods accessible from Java.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xno-optimize", + "shortName": null, + "description": "Disable optimizations.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xassertions", + "shortName": null, + "description": "'kotlin.assert' call behavior:\n-Xassertions=always-enable: enable, ignore JVM assertion settings;\n-Xassertions=always-disable: disable, ignore JVM assertion settings;\n-Xassertions=jvm: enable, depend on JVM assertion settings;\n-Xassertions=legacy: calculate the condition on each call, the behavior depends on JVM assertion settings in the kotlin package;\ndefault: legacy", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": "legacy" + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xbuild-file", + "shortName": null, + "description": "Path to the .xml build file to compile.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xmultifile-parts-inherit", + "shortName": null, + "description": "Compile multifile classes as a hierarchy of parts and a facade.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xuse-type-table", + "shortName": null, + "description": "Use a type table in metadata serialization.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xuse-old-class-files-reading", + "shortName": null, + "description": "Use the old implementation for reading class files. This may slow down the compilation and cause problems with Groovy interop.\nThis can be used in the event of problems with the new implementation.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xuse-fast-jar-file-system", + "shortName": null, + "description": "Use the fast implementation of Jar FS. This may speed up compilation time, but it is experimental.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xsuppress-missing-builtins-error", + "shortName": null, + "description": "Suppress the \"cannot access built-in declaration\" error (useful with '-no-stdlib').", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xscript-resolver-environment", + "shortName": null, + "description": "Set the script resolver environment in key-value pairs (the value can be quoted and escaped).", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xuse-javac", + "shortName": null, + "description": "Use javac for Java source and class file analysis.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcompile-java", + "shortName": null, + "description": "Reuse 'javac' analysis and compile Java source files.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xjavac-arguments", + "shortName": null, + "description": "Java compiler arguments.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xjava-source-roots", + "shortName": null, + "description": "Paths to directories with Java source files.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xjava-package-prefix", + "shortName": null, + "description": "Package prefix for Java files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xjsr305", + "shortName": null, + "description": "Specify the behavior of 'JSR-305' nullability annotations:\n-Xjsr305={ignore/strict/warn} global (all non-@UnderMigration annotations)\n-Xjsr305=under-migration:{ignore/strict/warn} all @UnderMigration annotations\n-Xjsr305=@:{ignore/strict/warn} annotation with the given fully qualified class name\nModes:\n* ignore\n* strict (experimental; treat like other supported nullability annotations)\n* warn (report a warning)", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xnullability-annotations", + "shortName": null, + "description": "Specify the behavior for specific Java nullability annotations (provided with fully qualified package name).\nModes:\n* ignore\n* strict\n* warn (report a warning)", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xsupport-compatqual-checker-framework-annotations", + "shortName": null, + "description": "Specify the behavior for Checker Framework 'compatqual' annotations ('NullableDecl'/'NonNullDecl').\nThe default value is 'enable'.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xjspecify-annotations", + "shortName": null, + "description": "Specify the behavior of 'jspecify' annotations.\nThe default value is 'strict'.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xjvm-default", + "shortName": null, + "description": "This option is deprecated. Migrate to -jvm-default as follows:\n-Xjvm-default=disable -> -jvm-default=disable\n-Xjvm-default=all-compatibility -> -jvm-default=enable\n-Xjvm-default=all -> -jvm-default=no-compatibility", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xdefault-script-extension", + "shortName": null, + "description": "Compile expressions and unrecognized scripts passed with the -script argument as scripts with the given filename extension.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdisable-standard-script", + "shortName": null, + "description": "Disable standard Kotlin scripting support.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xgenerate-strict-metadata-version", + "shortName": null, + "description": "Generate metadata with strict version semantics (see the KDoc entry on 'Metadata.extraInt').", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xsanitize-parentheses", + "shortName": null, + "description": "Transform '(' and ')' in method names to some other character sequence.\nThis mode can BREAK BINARY COMPATIBILITY and should only be used as a workaround for\nproblems with parentheses in identifiers on certain platforms.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xfriend-paths", + "shortName": null, + "description": "Paths to output directories for friend modules (modules whose internals should be visible).", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xallow-no-source-files", + "shortName": null, + "description": "Allow the set of source files to be empty.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xemit-jvm-type-annotations", + "shortName": null, + "description": "Emit JVM type annotations in bytecode.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xjvm-expose-boxed", + "shortName": null, + "description": "Expose inline classes and functions, accepting and returning them, to Java.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xstring-concat", + "shortName": null, + "description": "Select the code generation scheme for string concatenation:\n-Xstring-concat=indy-with-constants Concatenate strings using 'invokedynamic' and 'makeConcatWithConstants'. This requires '-jvm-target 9' or greater.\n-Xstring-concat=indy Concatenate strings using 'invokedynamic' and 'makeConcat'. This requires '-jvm-target 9' or greater.\n-Xstring-concat=inline Concatenate strings using 'StringBuilder'\ndefault: 'indy-with-constants' for JVM targets 9 or greater, 'inline' otherwise.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xjdk-release", + "shortName": null, + "description": "Compile against the specified JDK API version, similarly to javac's '-release'. This requires JDK 9 or newer.\nThe supported versions depend on the JDK used; for JDK 17+, the supported versions are 1.8 and 9–24.\nThis also sets the value of '-jvm-target' to be equal to the selected JDK version.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xsam-conversions", + "shortName": null, + "description": "Select the code generation scheme for SAM conversions.\n-Xsam-conversions=indy Generate SAM conversions using 'invokedynamic' with 'LambdaMetafactory.metafactory'.\n-Xsam-conversions=class Generate SAM conversions as explicit classes.\nThe default value is 'indy'.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xlambdas", + "shortName": null, + "description": "Select the code generation scheme for lambdas.\n-Xlambdas=indy Generate lambdas using 'invokedynamic' with 'LambdaMetafactory.metafactory'.\n A lambda object created using 'LambdaMetafactory.metafactory' will have a different 'toString()'.\n-Xlambdas=class Generate lambdas as explicit classes.\nThe default value is 'indy' if language version is 2.0+, and 'class' otherwise.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xindy-allow-annotated-lambdas", + "shortName": null, + "description": "Allow using 'invokedynamic' for lambda expressions with annotations", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xklib", + "shortName": null, + "description": "Paths to cross-platform libraries in the .klib format.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xno-reset-jar-timestamps", + "shortName": null, + "description": "Don't reset jar entry timestamps to a fixed date.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xno-unified-null-checks", + "shortName": null, + "description": "Use pre-1.4 exception types instead of 'java.lang.NPE' in null checks. See KT-22275 for more details.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xno-source-debug-extension", + "shortName": null, + "description": "Don't generate the '@kotlin.jvm.internal.SourceDebugExtension' annotation with an SMAP copy on classes.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xprofile", + "shortName": null, + "description": "Debug option: Run the compiler with the async profiler and save snapshots to `outputDir`; `command` is passed to the async profiler on start.\n`profilerPath` is the path to libasyncProfiler.so; async-profiler.jar should be on the compiler classpath.\nIf it's not on the classpath, the compiler will attempt to load async-profiler.jar from the containing directory of profilerPath.\nExample: -Xprofile=/async-profiler/build/libasyncProfiler.so:event=cpu,interval=1ms,threads,start:", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xuse-14-inline-classes-mangling-scheme", + "shortName": null, + "description": "Use the scheme for inline class mangling from version 1.4 instead of the one from 1.4.30.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xjvm-enable-preview", + "shortName": null, + "description": "Allow using Java features that are in the preview phase.\nThis works like '--enable-preview' in Java. All class files are marked as compiled with preview features, meaning it won't be possible to use them in release environments.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xsuppress-deprecated-jvm-target-warning", + "shortName": null, + "description": "Suppress warnings about deprecated JVM target versions.\nThis option has no effect and will be deleted in a future version.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xtype-enhancement-improvements-strict-mode", + "shortName": null, + "description": "Enable strict mode for improvements to type enhancement for loaded Java types based on nullability annotations,\nincluding the ability to read type-use annotations from class files.\nSee KT-45671 for more details.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xserialize-ir", + "shortName": null, + "description": "Save the IR to metadata (Experimental).", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "none" + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xvalidate-bytecode", + "shortName": null, + "description": "Validate generated JVM bytecode before and after optimizations.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xenhance-type-parameter-types-to-def-not-null", + "shortName": null, + "description": "Enhance not-null-annotated type parameter types to definitely-non-nullable types ('@NotNull T' => 'T & Any').", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xlink-via-signatures", + "shortName": null, + "description": "Link JVM IR symbols via signatures instead of descriptors.\nThis mode is slower, but it can be useful for troubleshooting problems with the JVM IR backend.\nThis option is deprecated and will be deleted in future versions.\nIt has no effect when -language-version is 2.0 or higher.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xdebug", + "shortName": null, + "description": "Enable debug mode for compilation.\nCurrently this includes spilling all variables in a suspending context regardless of whether they are alive.\nIf API Level >= 2.2 -- no-op.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xenhanced-coroutines-debugging", + "shortName": null, + "description": "Generate additional linenumber instruction for compiler-generated code\ninside suspend functions and lambdas to distinguish them from user code by debugger.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xno-new-java-annotation-targets", + "shortName": null, + "description": "Don't generate Java 1.8+ targets for Kotlin annotation classes.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xvalue-classes", + "shortName": null, + "description": "Enable experimental value classes.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-inliner", + "shortName": null, + "description": "Inline functions using the IR inliner instead of the bytecode inliner.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xuse-inline-scopes-numbers", + "shortName": null, + "description": "Use inline scopes numbers for inline marker variables.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xuse-k2-kapt", + "shortName": null, + "description": "Enable the experimental support for K2 KAPT.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xcompile-builtins-as-part-of-stdlib", + "shortName": null, + "description": "Enable behaviour needed to compile builtins as part of JVM stdlib", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xoutput-builtins-metadata", + "shortName": null, + "description": "Output builtins metadata as .kotlin_builtins files", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xannotations-in-metadata", + "shortName": null, + "description": "Write annotations on declarations into the metadata (in addition to the JVM bytecode), and read annotations from the metadata if they are present.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwhen-expressions", + "shortName": null, + "description": "Select the code generation scheme for type-checking 'when' expressions:\n-Xwhen-expressions=indy Generate type-checking 'when' expressions using 'invokedynamic' with 'SwitchBootstraps.typeSwitch(..)' and \n following 'tableswitch' or 'lookupswitch'. This requires '-jvm-target 21' or greater.\n-Xwhen-expressions=inline Generate type-checking 'when' expressions as a chain of type checks.\nThe default value is 'inline'.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + } + ] +} \ No newline at end of file diff --git a/src/test/resources/compiler-arguments/wasm-expected-compiler-args.json b/src/test/resources/compiler-arguments/wasm-expected-compiler-args.json new file mode 100644 index 000000000..faf4ab12f --- /dev/null +++ b/src/test/resources/compiler-arguments/wasm-expected-compiler-args.json @@ -0,0 +1,2020 @@ +{ + "compilerArguments": [ + { + "name": "help", + "shortName": "h", + "description": "Print a synopsis of standard options.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "X", + "shortName": null, + "description": "Print a synopsis of advanced options.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "version", + "shortName": null, + "description": "Display the compiler version.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "verbose", + "shortName": null, + "description": "Enable verbose logging output.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "nowarn", + "shortName": null, + "description": "Don't generate any warnings.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Werror", + "shortName": null, + "description": "Report an error if there are any warnings.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Wextra", + "shortName": null, + "description": "Enable extra checkers for K2.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "language-version", + "shortName": null, + "description": "Provide source compatibility with the specified version of Kotlin.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "api-version", + "shortName": null, + "description": "Allow using declarations from only the specified version of bundled libraries.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "kotlin-home", + "shortName": null, + "description": "Path to the Kotlin compiler home directory used for the discovery of runtime libraries.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "progressive", + "shortName": null, + "description": "Enable progressive compiler mode.\nIn this mode, deprecations and bug fixes for unstable code take effect immediately\ninstead of going through a graceful migration cycle.\nCode written in progressive mode is backward compatible; however, code written without\nprogressive mode enabled may cause compilation errors in progressive mode.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "script", + "shortName": null, + "description": "Evaluate the given Kotlin script (*.kts) file.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xrepl", + "shortName": null, + "description": "Run Kotlin REPL (deprecated)", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "opt-in", + "shortName": null, + "description": "Enable API usages that require opt-in with an opt-in requirement marker with the given fully qualified name.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xno-inline", + "shortName": null, + "description": "Disable method inlining.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xskip-metadata-version-check", + "shortName": null, + "description": "Allow loading classes with bad metadata versions and pre-release classes.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xskip-prerelease-check", + "shortName": null, + "description": "Allow loading pre-release classes.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-kotlin-package", + "shortName": null, + "description": "Allow compiling code in the 'kotlin' package, and allow not requiring 'kotlin.stdlib' in 'module-info'.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xstdlib-compilation", + "shortName": null, + "description": "Enables special features which are relevant only for stdlib compilation.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xreport-output-files", + "shortName": null, + "description": "Report the source-to-output file mapping.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xplugin", + "shortName": null, + "description": "Load plugins from the given classpath.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "P", + "shortName": null, + "description": "Pass an option to a plugin.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcompiler-plugin", + "shortName": null, + "description": "Register a compiler plugin.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcompiler-plugin-order", + "shortName": null, + "description": "Specify an execution order constraint for compiler plugins.\nOrder constraint can be specified using the 'pluginId' of compiler plugins.\nThe first specified plugin will be executed before the second plugin.\nMultiple constraints can be specified by repeating this option. Cycles in constraints will cause an error.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xmulti-platform", + "shortName": null, + "description": "Enable language support for multiplatform projects.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xno-check-actual", + "shortName": null, + "description": "Do not check for the presence of the 'actual' modifier in multiplatform projects.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xintellij-plugin-root", + "shortName": null, + "description": "Path to 'kotlin-compiler.jar' or the directory where the IntelliJ IDEA configuration files can be found.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xnew-inference", + "shortName": null, + "description": "Enable the new experimental generic type inference algorithm.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xinline-classes", + "shortName": null, + "description": "Enable experimental inline classes.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xreport-perf", + "shortName": null, + "description": "Report detailed performance statistics.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdetailed-perf", + "shortName": null, + "description": "Enable more detailed performance statistics (Experimental).\nFor Native, the performance report includes execution time and lines processed per second for every individual lowering.\nFor WASM and JS, the performance report includes execution time and lines per second for each lowering of the first stage of compilation.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdump-perf", + "shortName": null, + "description": "Dump detailed performance statistics to the specified file in plain text, JSON or markdown format (it's detected by the file's extension).\nAlso, it supports the placeholder `*` and directory for generating file names based on the module being compiled and the current time stamp.\nExample: `path/to/dir/*.log` creates logs like `path/to/dir/my-module_2025-06-20-12-22-32.log` in plain text format, `path/to/dir/` creates logs like `path/to/dir/my-log_2025-06-20-12-22-32.json`.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "XXdump-model", + "shortName": null, + "description": "Dump compilation model to specified directory for use in modularized tests.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xmetadata-version", + "shortName": null, + "description": "Change the metadata version of the generated binary files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcommon-sources", + "shortName": null, + "description": "Sources of the common module that need to be compiled together with this module in multiplatform mode.\nThey should be a subset of sources passed as free arguments.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xlist-phases", + "shortName": null, + "description": "List backend phases.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdisable-phases", + "shortName": null, + "description": "Disable backend phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xverbose-phases", + "shortName": null, + "description": "Be verbose while performing the given backend phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-dump-before", + "shortName": null, + "description": "Dump the backend's state before these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-dump-after", + "shortName": null, + "description": "Dump the backend's state after these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-dump", + "shortName": null, + "description": "Dump the backend's state both before and after these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdump-directory", + "shortName": null, + "description": "Dump the backend state into this directory.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdump-fqname", + "shortName": null, + "description": "Dump the declaration with the given FqName.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-validate-before", + "shortName": null, + "description": "Validate the backend's state before these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-validate-after", + "shortName": null, + "description": "Validate the backend's state after these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xphases-to-validate", + "shortName": null, + "description": "Validate the backend's state both before and after these phases.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xverify-ir", + "shortName": null, + "description": "IR verification mode (no verification by default).", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xverify-ir-visibility", + "shortName": null, + "description": "Check for visibility violations in IR when validating it before running any lowerings. Only has effect if '-Xverify-ir' is not 'none'.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xprofile-phases", + "shortName": null, + "description": "Profile backend phases.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcheck-phase-conditions", + "shortName": null, + "description": "Check pre- and postconditions of IR lowering phases.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xuse-fir-experimental-checkers", + "shortName": null, + "description": "Enable experimental frontend IR checkers that are not yet ready for production.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xuse-fir-ic", + "shortName": null, + "description": "Compile using frontend IR internal incremental compilation.\nWarning: This feature is not yet production-ready.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xuse-fir-lt", + "shortName": null, + "description": "Compile using the LightTree parser with the frontend IR.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xmetadata-klib", + "shortName": null, + "description": "Produce a klib that only contains the metadata of declarations.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xdisable-default-scripting-plugin", + "shortName": null, + "description": "Don't enable the scripting plugin by default.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xexplicit-api", + "shortName": null, + "description": "Force the compiler to report errors on all public API declarations without an explicit visibility or a return type.\nUse the 'warning' level to issue warnings instead of errors.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "disable" + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "XXexplicit-return-types", + "shortName": null, + "description": "Force the compiler to report errors on all public API declarations without an explicit return type.\nUse the 'warning' level to issue warnings instead of errors.\nThis flag partially enables functionality of `-Xexplicit-api` flag, so please don't use them altogether", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "disable" + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xreturn-value-checker", + "shortName": null, + "description": "Set improved unused return value checker mode. Use 'check' to run checker only and use 'full' to also enable automatic annotation insertion.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "disable" + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xsuppress-version-warnings", + "shortName": null, + "description": "Suppress warnings about outdated, inconsistent, or experimental language or API versions.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xsuppress-api-version-greater-than-language-version-error", + "shortName": null, + "description": "Suppress error about API version greater than language version.\nWarning: This is temporary solution (see KT-63712) intended to be used only for stdlib build.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xexpect-actual-classes", + "shortName": null, + "description": "'expect'/'actual' classes (including interfaces, objects, annotations, enums, and 'actual' typealiases) are in Beta.\nKotlin reports a warning every time you use one of them. You can use this flag to mute the warning.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xconsistent-data-class-copy-visibility", + "shortName": null, + "description": "The effect of this compiler flag is the same as applying @ConsistentCopyVisibility annotation to all data classes in the module. See https://youtrack.jetbrains.com/issue/KT-11914", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xunrestricted-builder-inference", + "shortName": null, + "description": "Eliminate builder inference restrictions, for example by allowing type variables to be returned from builder inference calls.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xcontext-receivers", + "shortName": null, + "description": "Enable experimental context receivers.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xcontext-parameters", + "shortName": null, + "description": "Enable experimental context parameters.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xcontext-sensitive-resolution", + "shortName": null, + "description": "Enable experimental context-sensitive resolution.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xnon-local-break-continue", + "shortName": null, + "description": "Enable experimental non-local break and continue.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xdata-flow-based-exhaustiveness", + "shortName": null, + "description": "Enable `when` exhaustiveness improvements that rely on data-flow analysis.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xexplicit-backing-fields", + "shortName": null, + "description": "Enable experimental language support for explicit backing fields.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xdirect-java-actualization", + "shortName": null, + "description": "Enable experimental direct Java actualization support.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xmulti-dollar-interpolation", + "shortName": null, + "description": "Enable experimental multi-dollar interpolation.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xenable-incremental-compilation", + "shortName": null, + "description": "Enable incremental compilation.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xrender-internal-diagnostic-names", + "shortName": null, + "description": "Render the internal names of warnings and errors.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-any-scripts-in-source-roots", + "shortName": null, + "description": "Allow compiling scripts along with regular Kotlin sources.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xreport-all-warnings", + "shortName": null, + "description": "Report all warnings even if errors are found.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xfragments", + "shortName": null, + "description": "Declare all known fragments of a multiplatform compilation.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfragment-sources", + "shortName": null, + "description": "Add sources to a specific fragment of a multiplatform compilation.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfragment-refines", + "shortName": null, + "description": "Declare that refines with the dependsOn/refines relation.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfragment-dependency", + "shortName": null, + "description": "Declare common klib dependencies for the specific fragment.\nThis argument is required for any HMPP module except the platform leaf module: it takes dependencies from -cp/-libraries.\nThe argument should be used only if the new compilation scheme is enabled with -Xseparate-kmp-compilation\n", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfragment-friend-dependency", + "shortName": null, + "description": "Declare common klib friend dependencies for the specific fragment.\nThis argument can be specified for any HMPP module except the platform leaf module: it takes dependencies from the platform specific friend module arguments.\nThe argument should be used only if the new compilation scheme is enabled with -Xseparate-kmp-compilation\n", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xseparate-kmp-compilation", + "shortName": null, + "description": "Enables the separated compilation scheme, in which common source sets are analyzed against their own dependencies", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xignore-const-optimization-errors", + "shortName": null, + "description": "Ignore all compilation exceptions while optimizing some constant expressions.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xdont-warn-on-error-suppression", + "shortName": null, + "description": "Don't report warnings when errors are suppressed. This only affects K2.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwhen-guards", + "shortName": null, + "description": "Enable experimental language support for when guards.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xnested-type-aliases", + "shortName": null, + "description": "Enable experimental language support for nested type aliases.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xsuppress-warning", + "shortName": null, + "description": "Suppress specified warning module-wide. This option is deprecated in favor of \"-Xwarning-level\" flag", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwarning-level", + "shortName": null, + "description": "Set the severity of the given warning.\n- `error` level raises the severity of a warning to error level (similar to -Werror but more granular)\n- `disabled` level suppresses reporting of a warning (similar to -nowarn but more granular)\n- `warning` level overrides -nowarn and -Werror for this specific warning (the warning will be reported/won't be considered as an error)", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xannotation-default-target", + "shortName": null, + "description": "Change the default annotation targets for constructor properties:\n-Xannotation-default-target=first-only: use the first of the following allowed targets: '@param:', '@property:', '@field:';\n-Xannotation-default-target=first-only-warn: same as first-only, and raise warnings when both '@param:' and either '@property:' or '@field:' are allowed;\n-Xannotation-default-target=param-property: use '@param:' target if applicable, and also use the first of either '@property:' or '@field:';\ndefault: 'first-only-warn' in language version 2.2+, 'first-only' in version 2.1 and before.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "XXdebug-level-compiler-checks", + "shortName": null, + "description": "Enable debug level compiler checks. ATTENTION: these checks can slow compiler down or even crash it.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xannotation-target-all", + "shortName": null, + "description": "Enable experimental language support for @all: annotation use-site target.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "XXlenient-mode", + "shortName": null, + "description": "Lenient compiler mode. When actuals are missing, placeholder declarations are generated.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-reified-type-in-catch", + "shortName": null, + "description": "Allow 'catch' parameters to have reified types.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-contracts-on-more-functions", + "shortName": null, + "description": "Allow contracts on some operators and accessors, and allow checks for erased types.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-condition-implies-returns-contracts", + "shortName": null, + "description": "Allow contracts that specify a limited conditional returns postcondition.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xallow-holdsin-contract", + "shortName": null, + "description": "Allow contracts that specify a condition that holds true inside a lambda argument.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xname-based-destructuring", + "shortName": null, + "description": "Enables the following destructuring features:\n-Xname-based-destructuring=only-syntax: Enables syntax for positional destructuring with square brackets and the full form of name-based destructuring with parentheses;\n-Xname-based-destructuring=name-mismatch: Reports warnings when short form positional destructuring of data classes uses names that don't match the property names;\n-Xname-based-destructuring=complete: Enables short-form name-based destructuring with parentheses;", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "XXLanguage", + "shortName": null, + "description": "Enables/disables specified language feature.\nWarning: this flag is not intended for production use. If you want to configure the language behaviour use the\n-language-version or corresponding experimental feature flags.", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xklib-relative-path-base", + "shortName": null, + "description": "Provide a base path to compute the source's relative paths in klib (default is empty).", + "type": { + "type": "com.compiler.server.model.ListExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": [] + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xklib-normalize-absolute-path", + "shortName": null, + "description": "Normalize absolute paths in klibs.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xklib-enable-signature-clash-checks", + "shortName": null, + "description": "Enable signature uniqueness checks.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xpartial-linkage", + "shortName": null, + "description": "Use partial linkage mode.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xpartial-linkage-loglevel", + "shortName": null, + "description": "Define the compile-time log level for partial linkage.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xklib-duplicated-unique-name-strategy", + "shortName": null, + "description": "Klib dependencies usage strategy when multiple KLIBs has same `unique_name` property value.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xklib-ir-inliner", + "shortName": null, + "description": "Set the mode of the experimental IR inliner on the first compilation stage.\n- `intra-module` mode enforces inlining of the functions only from the compiled module\n- `full` mode enforces inlining of all functions (from the compiled module and from all dependencies)\n Warning: This mode will trigger setting the `pre-release` flag for the compiled library.\n- `disabled` mode completely disables the IR inliner\n- `default` mode lets the IR inliner run in `intra-module`, `full` or `disabled` mode based on the current language version\n ", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "default" + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xklib-abi-version", + "shortName": null, + "description": "Specify the custom ABI version to be written in KLIB. This option is intended only for tests.\nWarning: This option does not affect KLIB ABI. Neither allows it making a KLIB backward-compatible with older ABI versions.\nThe only observable effect is that a custom ABI version is written to KLIB manifest file.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xklib-zip-file-accessor-cache-limit", + "shortName": null, + "description": "Maximum number of klibs that can be cached during compilation. Default is 64.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": "64" + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xwasm", + "shortName": null, + "description": "Use the WebAssembly compiler backend.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-target", + "shortName": null, + "description": "Set up the Wasm target (wasm-js or wasm-wasi).", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-debug-info", + "shortName": null, + "description": "Add debug info to the compiled WebAssembly module.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-debug-friendly", + "shortName": null, + "description": "Avoid optimizations that can break debugging.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-generate-wat", + "shortName": null, + "description": "Generate a .wat file.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xwasm-kclass-fqn", + "shortName": null, + "description": "Enable support for 'KClass.qualifiedName'.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-enable-array-range-checks", + "shortName": null, + "description": "Turn on range checks for array access functions.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-enable-asserts", + "shortName": null, + "description": "Turn on asserts.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-use-traps-instead-of-exceptions", + "shortName": null, + "description": "Use traps instead of throwing exceptions.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-use-new-exception-proposal", + "shortName": null, + "description": "Use an updated version of the exception proposal with try_table.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-no-jstag", + "shortName": null, + "description": "Don't use WebAssembly.JSTag for throwing and catching exceptions", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-debugger-custom-formatters", + "shortName": null, + "description": "Generates devtools custom formatters (https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters) for Kotlin/Wasm values", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-source-map-include-mappings-from-unavailable-sources", + "shortName": null, + "description": "Insert source mappings from libraries even if their sources are unavailable on the end-user machine.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-preserve-ic-order", + "shortName": null, + "description": "Preserve wasm file structure between IC runs.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xwasm-ic-cache-readonly", + "shortName": null, + "description": "Do not commit IC cache updates.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xwasm-generate-dwarf", + "shortName": null, + "description": "Generate DWARF debug information.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-dce-dump-reachability-info-to-file", + "shortName": null, + "description": "Dump reachability information collected about declarations while performing DCE to a file. The format will be chosen automatically based on the file extension. Supported output formats include JSON for .json, a JS const initialized with a plain object containing information for .js, and plain text for all other file types.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-dump-declaration-ir-sizes-to-file", + "shortName": null, + "description": "Dump the IR size of each declaration into a file. The format will be chosen automatically depending on the file extension. Supported output formats include JSON for .json, a JS const initialized with a plain object containing information for .js, and plain text for all other file types.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "ir-output-dir", + "shortName": null, + "description": "Destination for generated files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "ir-output-name", + "shortName": null, + "description": "Base name of generated files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "libraries", + "shortName": null, + "description": "Paths to Kotlin libraries with .meta.js and .kjsm files, separated by the system path separator.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": "kotlin-stdlib-wasm-js-{{KOTLIN_VERSION_PLACEHOLDER}}.klib" + }, + { + "name": "source-map", + "shortName": null, + "description": "Generate a source map.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "source-map-prefix", + "shortName": null, + "description": "Add the specified prefix to the paths in the source map.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "source-map-base-dirs", + "shortName": null, + "description": "Base directories for calculating relative paths to source files in the source map.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "source-map-embed-sources", + "shortName": null, + "description": "Embed source files into the source map.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "source-map-names-policy", + "shortName": null, + "description": "Mode for mapping generated names to original names.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "target", + "shortName": null, + "description": "Generate JS files for the specified ECMA version.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-keep", + "shortName": null, + "description": "Comma-separated list of fully qualified names not to be eliminated by DCE (if it can be reached), and for which to keep non-minified names.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "module-kind", + "shortName": null, + "description": "The kind of JS module generated by the compiler. ES modules are enabled by default in case of ES2015 target usage", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "main", + "shortName": null, + "description": "Specify whether the 'main' function should be called upon execution.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-produce-klib-dir", + "shortName": null, + "description": "Generate an unpacked klib into the parent directory of the output JS file.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-produce-klib-file", + "shortName": null, + "description": "Generate a packed klib into the directory specified by '-ir-output-dir'.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-produce-js", + "shortName": null, + "description": "Generate a JS file using the IR backend.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-dce", + "shortName": null, + "description": "Perform experimental dead code elimination.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-dce-runtime-diagnostic", + "shortName": null, + "description": "Enable runtime diagnostics instead of removing declarations when performing DCE.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-dce-print-reachability-info", + "shortName": null, + "description": "Print reachability information about declarations to 'stdout' while performing DCE.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-property-lazy-initialization", + "shortName": null, + "description": "Perform lazy initialization for properties.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-minimized-member-names", + "shortName": null, + "description": "Minimize the names of members.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-module-name", + "shortName": null, + "description": "Specify the name of the compilation module for the IR backend.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xir-safe-external-boolean", + "shortName": null, + "description": "Wrap access to external 'Boolean' properties with an explicit conversion to 'Boolean'.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-safe-external-boolean-diagnostic", + "shortName": null, + "description": "Enable runtime diagnostics when accessing external 'Boolean' properties.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-per-module", + "shortName": null, + "description": "Generate one .js file per module.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-per-module-output-name", + "shortName": null, + "description": "Add a custom output name to the split .js files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-per-file", + "shortName": null, + "description": "Generate one .js file per source file.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-generate-inline-anonymous-functions", + "shortName": null, + "description": "Lambda expressions that capture values are translated into in-line anonymous JavaScript functions.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xinclude", + "shortName": null, + "description": "Path to an intermediate library that should be processed in the same manner as source files.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xcache-directory", + "shortName": null, + "description": "Path to the cache directory.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xir-build-cache", + "shortName": null, + "description": "Use the compiler to build the cache.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xgenerate-dts", + "shortName": null, + "description": "Generate a TypeScript declaration .d.ts file alongside the JS file.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xgenerate-polyfills", + "shortName": null, + "description": "Generate polyfills for features from the ES6+ standards.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xstrict-implicit-export-types", + "shortName": null, + "description": "Generate strict types for implicitly exported entities inside d.ts files.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xes-classes", + "shortName": null, + "description": "Let generated JavaScript code use ES2015 classes. Enabled by default in case of ES2015 target usage", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xplatform-arguments-in-main-function", + "shortName": null, + "description": "JS expression that will be executed in runtime and be put as an Array parameter of the main function", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xes-generators", + "shortName": null, + "description": "Enable ES2015 generator functions usage inside the compiled code. Enabled by default in case of ES2015 target usage", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xes-arrow-functions", + "shortName": null, + "description": "Use ES2015 arrow functions in the JavaScript code generated for Kotlin lambdas. Enabled by default in case of ES2015 target usage", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xes-long-as-bigint", + "shortName": null, + "description": "Compile Long values as ES2020 bigint instead of object.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xtyped-arrays", + "shortName": null, + "description": "This option does nothing and is left for compatibility with the legacy backend.\nIt is deprecated and will be removed in a future release.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xfriend-modules-disabled", + "shortName": null, + "description": "Disable internal declaration export.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xfriend-modules", + "shortName": null, + "description": "Paths to friend modules.", + "type": { + "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", + "isNullable": true, + "defaultValue": null + }, + "disabled": true, + "predefinedValues": null + }, + { + "name": "Xenable-extension-functions-in-externals", + "shortName": null, + "description": "Enable extension function members in external interfaces.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xfake-override-validator", + "shortName": null, + "description": "Enable the IR fake override validator.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": false + }, + "disabled": false, + "predefinedValues": null + }, + { + "name": "Xoptimize-generated-js", + "shortName": null, + "description": "Perform additional optimizations on the generated JS code.", + "type": { + "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", + "isNullable": false, + "defaultValue": true + }, + "disabled": false, + "predefinedValues": null + } + ] +} \ No newline at end of file From d96c1aa3b935fc5ad528e946577459a06782c915 Mon Sep 17 00:00:00 2001 From: Zofia Wiora Date: Fri, 22 Aug 2025 16:09:31 +0200 Subject: [PATCH 3/4] KTL-2962 Compilation with BTA for JVM --- build.gradle.kts | 8 ++- common/build.gradle.kts | 4 +- dependencies/build.gradle.kts | 2 +- gradle/libs.versions.toml | 5 +- indexation/build.gradle.kts | 0 .../src/main/kotlin/DescriptorsUtils.kt | 0 .../compiler/server/compiler/KotlinFile.kt | 0 .../server/compiler/KotlinResolutionFacade.kt | 0 .../compiler/components/CompilationLogger.kt | 57 +++++++++++++++++ .../compiler/components/CompletionProvider.kt | 0 .../compiler/components/ErrorAnalyzer.kt | 0 .../compiler/components/KotlinCompiler.kt | 61 +++++++++++++++---- .../com/compiler/server/model/TextInterval.kt | 2 +- .../server/CompilerArgumentsEndpointTest.kt | 1 - .../compose-wasm-expected-compiler-args.json | 4 +- .../js-expected-compiler-args.json | 4 +- .../jvm-expected-compiler-args.json | 4 +- .../wasm-expected-compiler-args.json | 4 +- 18 files changed, 128 insertions(+), 28 deletions(-) create mode 100644 indexation/build.gradle.kts create mode 100644 indexation/src/main/kotlin/DescriptorsUtils.kt create mode 100644 src/main/kotlin/com/compiler/server/compiler/KotlinFile.kt create mode 100644 src/main/kotlin/com/compiler/server/compiler/KotlinResolutionFacade.kt create mode 100644 src/main/kotlin/com/compiler/server/compiler/components/CompilationLogger.kt create mode 100644 src/main/kotlin/com/compiler/server/compiler/components/CompletionProvider.kt create mode 100644 src/main/kotlin/com/compiler/server/compiler/components/ErrorAnalyzer.kt diff --git a/build.gradle.kts b/build.gradle.kts index 7dea54376..6d0fb6f7a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -44,16 +44,18 @@ dependencies { implementation(libs.gson) implementation(libs.kotlinx.serialization.json) implementation(libs.kotlin.compiler.arguments.description) - implementation(libs.kotlin.tooling.core) implementation(libs.junit) implementation(libs.logback.logstash.encoder) implementation(libs.kotlin.reflect) - implementation(libs.kotlin.stdlib) - implementation(libs.kotlin.compiler) + implementation(libs.bundles.kotlin.stdlib) implementation(libs.kotlin.script.runtime) implementation(project(":executors", configuration = "default")) implementation(project(":common", configuration = "default")) implementation(project(":dependencies")) + implementation("org.jetbrains.kotlin:kotlin-build-tools-api:${libs.versions.kotlin.get()}") + implementation("org.jetbrains.kotlin:kotlin-build-tools-impl:${libs.versions.kotlin.get()}") + implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable:${libs.versions.kotlin.get()}") + implementation("org.jetbrains.kotlin:kotlin-tooling-core:${libs.versions.kotlin.get()}") testImplementation(libs.kotlin.test) testImplementation("org.springframework.boot:spring-boot-starter-test") { diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 8ee7fd2b7..69bf210d3 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -3,5 +3,5 @@ plugins { } dependencies { - implementation(libs.kotlin.compiler) -} + implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable:${libs.versions.kotlin.get()}") +} \ No newline at end of file diff --git a/dependencies/build.gradle.kts b/dependencies/build.gradle.kts index bd58fc102..51f6cce57 100644 --- a/dependencies/build.gradle.kts +++ b/dependencies/build.gradle.kts @@ -103,7 +103,7 @@ dependencies { kotlinDependency(libs.hamcrest) kotlinDependency(libs.bundles.jackson) // Kotlin libraries - kotlinDependency(libs.kotlin.stdlib) + kotlinDependency(libs.bundles.kotlin.stdlib) kotlinDependency(libs.kotlin.test) kotlinDependency(libs.kotlin.test.junit) kotlinDependency(libs.kotlinx.coroutines.core.jvm) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 39c69e386..c8cda18df 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -kotlin = "2.3.0-dev-9317" +kotlin = "2.3.0-dev-9673" spring-boot = "3.5.6" spring-dependency-managment = "1.1.7" springdoc = "2.8.13" @@ -21,6 +21,8 @@ gradle-develocity = "3.17.5" [libraries] kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect", version.ref = "kotlin" } kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" } +kotlin-stdlib-jdk7 = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk7", version.ref = "kotlin" } +kotlin-stdlib-jdk8 = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version.ref = "kotlin" } kotlin-stdlib-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-js", version.ref = "kotlin" } kotlin-stdlib-wasm-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-wasm-js", version.ref = "kotlin" } kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin" } @@ -66,6 +68,7 @@ spring-context-indexer = { group = "org.springframework", name = "spring-context springdoc = { group = "org.springdoc", name = "springdoc-openapi-starter-webmvc-ui", version.ref = "springdoc" } [bundles] +kotlin-stdlib = ["kotlin-stdlib", "kotlin-stdlib-jdk7", "kotlin-stdlib-jdk8"] jackson = ["jackson-databind", "jackson-core", "jackson-annotations"] compose = [ "compose-runtime", diff --git a/indexation/build.gradle.kts b/indexation/build.gradle.kts new file mode 100644 index 000000000..e69de29bb diff --git a/indexation/src/main/kotlin/DescriptorsUtils.kt b/indexation/src/main/kotlin/DescriptorsUtils.kt new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/kotlin/com/compiler/server/compiler/KotlinFile.kt b/src/main/kotlin/com/compiler/server/compiler/KotlinFile.kt new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/kotlin/com/compiler/server/compiler/KotlinResolutionFacade.kt b/src/main/kotlin/com/compiler/server/compiler/KotlinResolutionFacade.kt new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/kotlin/com/compiler/server/compiler/components/CompilationLogger.kt b/src/main/kotlin/com/compiler/server/compiler/components/CompilationLogger.kt new file mode 100644 index 000000000..31e77e496 --- /dev/null +++ b/src/main/kotlin/com/compiler/server/compiler/components/CompilationLogger.kt @@ -0,0 +1,57 @@ +package com.compiler.server.compiler.components + +import com.compiler.server.model.ErrorDescriptor +import com.compiler.server.model.ProjectSeveriry +import com.compiler.server.model.TextInterval +import org.jetbrains.kotlin.buildtools.api.KotlinLogger + +class CompilationLogger( + override val isDebugEnabled: Boolean = false, +) : KotlinLogger { + + var compilationLogs: Map> = emptyMap() + + override fun debug(msg: String) { + if (isDebugEnabled) println("[DEBUG] $msg") + } + + override fun error(msg: String, throwable: Throwable?) { + if (isDebugEnabled) System.err.println("[ERROR] $msg" + (throwable?.let { ": ${it.message}" } ?: "")) + try { + addCompilationLog(msg, ProjectSeveriry.ERROR, classNameOverride = null) + } catch (_: Exception) {} + } + + override fun info(msg: String) { + if (isDebugEnabled) println("[INFO] $msg") + } + + override fun lifecycle(msg: String) { + if (isDebugEnabled) println("[LIFECYCLE] $msg") + } + + override fun warn(msg: String, throwable: Throwable?) { + if (isDebugEnabled) System.err.println("[WARN] $msg" + (throwable?.let { ": ${it.message}" } ?: "")) + try { + addCompilationLog(msg, ProjectSeveriry.WARNING, classNameOverride = "WARNING") + } catch (_: Exception) {} + } + + private fun addCompilationLog(msg: String, severity: ProjectSeveriry, classNameOverride: String?) { + val path = msg.split(" ")[0] + val className = path.split("/").last().split(".").first() + val message = msg.split(path)[1].drop(1) + val splitPath = path.split(":") + val line = splitPath[splitPath.size - 4].toInt() - 1 + val ch = splitPath[splitPath.size - 3].toInt() - 1 + val endLine = splitPath[splitPath.size - 2].toInt() - 1 + val endCh = splitPath[splitPath.size - 1].toInt() - 1 + val ed = ErrorDescriptor( + TextInterval(TextInterval.TextPosition(line, ch), TextInterval.TextPosition(endLine, endCh)), + message, + severity, + classNameOverride ?: className + ) + compilationLogs["$className.kt"]?.add(ed) + } +} diff --git a/src/main/kotlin/com/compiler/server/compiler/components/CompletionProvider.kt b/src/main/kotlin/com/compiler/server/compiler/components/CompletionProvider.kt new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/kotlin/com/compiler/server/compiler/components/ErrorAnalyzer.kt b/src/main/kotlin/com/compiler/server/compiler/components/ErrorAnalyzer.kt new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/kotlin/com/compiler/server/compiler/components/KotlinCompiler.kt b/src/main/kotlin/com/compiler/server/compiler/components/KotlinCompiler.kt index 835282321..c6ed569f1 100644 --- a/src/main/kotlin/com/compiler/server/compiler/components/KotlinCompiler.kt +++ b/src/main/kotlin/com/compiler/server/compiler/components/KotlinCompiler.kt @@ -2,6 +2,7 @@ package com.compiler.server.compiler.components import com.compiler.server.executor.CommandLineArgument import com.compiler.server.executor.JavaExecutor +import com.compiler.server.model.CompilerDiagnostics import com.compiler.server.model.ExtendedCompilerArgument import com.compiler.server.model.JvmExecutionResult import com.compiler.server.model.OutputDirectory @@ -12,7 +13,9 @@ import com.compiler.server.utils.CompilerArgumentsUtil import component.KotlinEnvironment import executors.JUnitExecutors import executors.JavaRunnerExecutor -import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler +import org.jetbrains.kotlin.buildtools.api.ExperimentalBuildToolsApi +import org.jetbrains.kotlin.buildtools.api.KotlinToolchains +import org.jetbrains.kotlin.buildtools.api.jvm.JvmPlatformToolchain import org.jetbrains.org.objectweb.asm.ClassReader import org.jetbrains.org.objectweb.asm.ClassReader.* import org.jetbrains.org.objectweb.asm.ClassVisitor @@ -74,9 +77,7 @@ class KotlinCompiler( 1 -> compiled.mainClasses.single() else -> return@execute JvmExecutionResult( exception = IllegalArgumentException( - "Multiple classes in project contain main methods found: ${ - compiled.mainClasses.sorted().joinToString() - }" + "Multiple classes in project contain main methods found: ${compiled.mainClasses.sorted().joinToString()}" ).toExceptionDescriptor() ) } @@ -99,9 +100,41 @@ class KotlinCompiler( val ioFiles = files.writeToIoFiles(inputDir) usingTempDirectory { outputDir -> val arguments = ioFiles.map { it.absolutePathString() } + - compilerArgumentsUtil.convertCompilerArgumentsToCompilationString(jvmCompilerArguments, compilerArgumentsUtil.PREDEFINED_JVM_ARGUMENTS, userCompilerArguments) + - listOf("-d", outputDir.absolutePathString()) - K2JVMCompiler().tryCompilation(inputDir, ioFiles, arguments) { + compilerArgumentsUtil.convertCompilerArgumentsToCompilationString(jvmCompilerArguments, compilerArgumentsUtil.PREDEFINED_JVM_ARGUMENTS, userCompilerArguments) + val result = compileWithToolchain(inputDir, outputDir, arguments) + return@usingTempDirectory result + } + } + + @OptIn(ExperimentalPathApi::class, ExperimentalBuildToolsApi::class, ExperimentalBuildToolsApi::class) + private fun compileWithToolchain( + inputDir: Path, + outputDir: Path, + arguments: List + ): CompilationResult { + System.setProperty("org.jetbrains.kotlin.buildtools.logger.extendedLocation", "true") + val sources = inputDir.listDirectoryEntries() + + val logger = CompilationLogger() + logger.compilationLogs = sources + .filter { it.name.endsWith(".kt") } + .associate { it.name to mutableListOf() } + + val toolchains = KotlinToolchains.loadImplementation(ClassLoader.getSystemClassLoader()) + val jvmToolchain = toolchains.getToolchain(JvmPlatformToolchain::class.java) + val operation = jvmToolchain.createJvmCompilationOperation(sources, outputDir) + operation.compilerArguments.applyArgumentStrings(arguments) + val session = toolchains.createBuildSession() + + val result = try { + session.executeOperation(operation, toolchains.createInProcessExecutionPolicy(), logger) + } catch (_: Exception) { + null + } + + try { + return if (result == org.jetbrains.kotlin.buildtools.api.CompilationResult.COMPILATION_SUCCESS) { + val cd = CompilerDiagnostics(logger.compilationLogs) val outputFiles = buildMap { outputDir.visitFileTree { onVisitFile { file, _ -> @@ -110,12 +143,18 @@ class KotlinCompiler( } } } - val mainClasses = findMainClasses(outputFiles) - JvmClasses( - files = outputFiles, - mainClasses = mainClasses, + Compiled( + compilerDiagnostics = cd, + result = JvmClasses( + files = outputFiles, + mainClasses = findMainClasses(outputFiles), + ) ) + } else { + NotCompiled(CompilerDiagnostics(logger.compilationLogs)) } + } finally { + session.close() } } diff --git a/src/main/kotlin/com/compiler/server/model/TextInterval.kt b/src/main/kotlin/com/compiler/server/model/TextInterval.kt index ecaff34f1..69e120835 100644 --- a/src/main/kotlin/com/compiler/server/model/TextInterval.kt +++ b/src/main/kotlin/com/compiler/server/model/TextInterval.kt @@ -1,6 +1,6 @@ package com.compiler.server.model -import com.intellij.openapi.editor.Document +import org.jetbrains.kotlin.com.intellij.openapi.editor.Document data class TextInterval(val start: TextPosition, val end: TextPosition) { data class TextPosition(val line: Int, val ch: Int) : Comparable { diff --git a/src/test/kotlin/com/compiler/server/CompilerArgumentsEndpointTest.kt b/src/test/kotlin/com/compiler/server/CompilerArgumentsEndpointTest.kt index bdfa0bd93..f2f6dcb61 100644 --- a/src/test/kotlin/com/compiler/server/CompilerArgumentsEndpointTest.kt +++ b/src/test/kotlin/com/compiler/server/CompilerArgumentsEndpointTest.kt @@ -4,7 +4,6 @@ import com.compiler.server.model.ProjectType import com.compiler.server.model.bean.VersionInfo import com.fasterxml.jackson.databind.ObjectMapper import component.KotlinEnvironment -import org.junit.jupiter.api.Test import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.EnumSource import org.springframework.beans.factory.annotation.Autowired diff --git a/src/test/resources/compiler-arguments/compose-wasm-expected-compiler-args.json b/src/test/resources/compiler-arguments/compose-wasm-expected-compiler-args.json index 3e8ab3356..1510f2924 100644 --- a/src/test/resources/compiler-arguments/compose-wasm-expected-compiler-args.json +++ b/src/test/resources/compiler-arguments/compose-wasm-expected-compiler-args.json @@ -1388,8 +1388,8 @@ "description": "Use an updated version of the exception proposal with try_table.", "type": { "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", - "isNullable": false, - "defaultValue": false + "isNullable": true, + "defaultValue": null }, "disabled": false, "predefinedValues": null diff --git a/src/test/resources/compiler-arguments/js-expected-compiler-args.json b/src/test/resources/compiler-arguments/js-expected-compiler-args.json index 73d87cf67..06834c01b 100644 --- a/src/test/resources/compiler-arguments/js-expected-compiler-args.json +++ b/src/test/resources/compiler-arguments/js-expected-compiler-args.json @@ -1386,8 +1386,8 @@ "description": "Use an updated version of the exception proposal with try_table.", "type": { "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", - "isNullable": false, - "defaultValue": false + "isNullable": true, + "defaultValue": null }, "disabled": false, "predefinedValues": null diff --git a/src/test/resources/compiler-arguments/jvm-expected-compiler-args.json b/src/test/resources/compiler-arguments/jvm-expected-compiler-args.json index 86620d64f..aff5fba50 100644 --- a/src/test/resources/compiler-arguments/jvm-expected-compiler-args.json +++ b/src/test/resources/compiler-arguments/jvm-expected-compiler-args.json @@ -1299,7 +1299,7 @@ { "name": "jvm-target", "shortName": null, - "description": "The target version of the generated JVM bytecode (1.8 and 9–24), with 1.8 as the default.", + "description": "The target version of the generated JVM bytecode (1.8 and 9–25), with 1.8 as the default.", "type": { "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", "isNullable": true, @@ -1779,7 +1779,7 @@ { "name": "Xjdk-release", "shortName": null, - "description": "Compile against the specified JDK API version, similarly to javac's '-release'. This requires JDK 9 or newer.\nThe supported versions depend on the JDK used; for JDK 17+, the supported versions are 1.8 and 9–24.\nThis also sets the value of '-jvm-target' to be equal to the selected JDK version.", + "description": "Compile against the specified JDK API version, similarly to javac's '-release'. This requires JDK 9 or newer.\nThe supported versions depend on the JDK used; for JDK 17+, the supported versions are 1.8 and 9–25.\nThis also sets the value of '-jvm-target' to be equal to the selected JDK version.", "type": { "type": "com.compiler.server.model.StringExtendedCompilerArgumentValue", "isNullable": true, diff --git a/src/test/resources/compiler-arguments/wasm-expected-compiler-args.json b/src/test/resources/compiler-arguments/wasm-expected-compiler-args.json index faf4ab12f..139e7d7ae 100644 --- a/src/test/resources/compiler-arguments/wasm-expected-compiler-args.json +++ b/src/test/resources/compiler-arguments/wasm-expected-compiler-args.json @@ -1386,8 +1386,8 @@ "description": "Use an updated version of the exception proposal with try_table.", "type": { "type": "com.compiler.server.model.BooleanExtendedCompilerArgumentValue", - "isNullable": false, - "defaultValue": false + "isNullable": true, + "defaultValue": null }, "disabled": false, "predefinedValues": null From ad71a95d7b4bf2afe30e2f131d6952398ed68ddc Mon Sep 17 00:00:00 2001 From: Zofia Wiora Date: Tue, 7 Oct 2025 15:18:58 +0200 Subject: [PATCH 4/4] Changes for pull request comments --- build.gradle.kts | 8 +- common/build.gradle.kts | 2 +- gradle/libs.versions.toml | 4 +- indexation/build.gradle.kts | 0 .../src/main/kotlin/DescriptorsUtils.kt | 0 .../compiler/server/compiler/KotlinFile.kt | 0 .../server/compiler/KotlinResolutionFacade.kt | 0 .../compiler/components/CompilationLogger.kt | 34 +++++++- .../compiler/components/CompletionProvider.kt | 0 .../compiler/components/ErrorAnalyzer.kt | 0 .../compiler/components/KotlinCompiler.kt | 77 +++++++++++-------- .../server/configuration/BuildToolsConfig.kt | 10 +++ .../server/service/KotlinProjectExecutor.kt | 3 - 13 files changed, 97 insertions(+), 41 deletions(-) delete mode 100644 indexation/build.gradle.kts delete mode 100644 indexation/src/main/kotlin/DescriptorsUtils.kt delete mode 100644 src/main/kotlin/com/compiler/server/compiler/KotlinFile.kt delete mode 100644 src/main/kotlin/com/compiler/server/compiler/KotlinResolutionFacade.kt delete mode 100644 src/main/kotlin/com/compiler/server/compiler/components/CompletionProvider.kt delete mode 100644 src/main/kotlin/com/compiler/server/compiler/components/ErrorAnalyzer.kt create mode 100644 src/main/kotlin/com/compiler/server/configuration/BuildToolsConfig.kt diff --git a/build.gradle.kts b/build.gradle.kts index 6d0fb6f7a..4dd7316d6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -49,13 +49,13 @@ dependencies { implementation(libs.kotlin.reflect) implementation(libs.bundles.kotlin.stdlib) implementation(libs.kotlin.script.runtime) + implementation(libs.kotlin.build.tools.api) + implementation(libs.kotlin.build.tools.impl) + implementation(libs.kotlin.compiler.embeddable) + implementation(libs.kotlin.tooling.core) implementation(project(":executors", configuration = "default")) implementation(project(":common", configuration = "default")) implementation(project(":dependencies")) - implementation("org.jetbrains.kotlin:kotlin-build-tools-api:${libs.versions.kotlin.get()}") - implementation("org.jetbrains.kotlin:kotlin-build-tools-impl:${libs.versions.kotlin.get()}") - implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable:${libs.versions.kotlin.get()}") - implementation("org.jetbrains.kotlin:kotlin-tooling-core:${libs.versions.kotlin.get()}") testImplementation(libs.kotlin.test) testImplementation("org.springframework.boot:spring-boot-starter-test") { diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 69bf210d3..7a5f934a9 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -3,5 +3,5 @@ plugins { } dependencies { - implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable:${libs.versions.kotlin.get()}") + implementation(libs.kotlin.compiler.embeddable) } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c8cda18df..f01300abb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -27,7 +27,9 @@ kotlin-stdlib-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-js", kotlin-stdlib-wasm-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-wasm-js", version.ref = "kotlin" } kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin" } kotlin-test-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin" } -kotlin-compiler = { group = "org.jetbrains.kotlin", name = "kotlin-compiler", version.ref = "kotlin" } +kotlin-build-tools-api = { group = "org.jetbrains.kotlin", name = "kotlin-build-tools-api", version.ref = "kotlin"} +kotlin-build-tools-impl = { group = "org.jetbrains.kotlin", name = "kotlin-build-tools-impl", version.ref = "kotlin"} +kotlin-compiler-embeddable = { group = "org.jetbrains.kotlin", name = "kotlin-compiler-embeddable", version.ref = "kotlin" } kotlin-tooling-core = { group = "org.jetbrains.kotlin", name = "kotlin-tooling-core", version.ref = "kotlin" } kotlin-compiler-arguments-description = { group = "org.jetbrains.kotlin", name = "kotlin-compiler-arguments-description", version.ref = "kotlin" } kotlin-script-runtime = { group = "org.jetbrains.kotlin", name = "kotlin-script-runtime", version.ref = "kotlin" } diff --git a/indexation/build.gradle.kts b/indexation/build.gradle.kts deleted file mode 100644 index e69de29bb..000000000 diff --git a/indexation/src/main/kotlin/DescriptorsUtils.kt b/indexation/src/main/kotlin/DescriptorsUtils.kt deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/main/kotlin/com/compiler/server/compiler/KotlinFile.kt b/src/main/kotlin/com/compiler/server/compiler/KotlinFile.kt deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/main/kotlin/com/compiler/server/compiler/KotlinResolutionFacade.kt b/src/main/kotlin/com/compiler/server/compiler/KotlinResolutionFacade.kt deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/main/kotlin/com/compiler/server/compiler/components/CompilationLogger.kt b/src/main/kotlin/com/compiler/server/compiler/components/CompilationLogger.kt index 31e77e496..4d5e0f492 100644 --- a/src/main/kotlin/com/compiler/server/compiler/components/CompilationLogger.kt +++ b/src/main/kotlin/com/compiler/server/compiler/components/CompilationLogger.kt @@ -5,10 +5,30 @@ import com.compiler.server.model.ProjectSeveriry import com.compiler.server.model.TextInterval import org.jetbrains.kotlin.buildtools.api.KotlinLogger + +/** + * CompilationLogger is used for collecting logs from compilation with kotlin-build-tools-api. + * It is passed as an argument while executing a compilation operation. It collects logs returned + * during compilation, interprets returned strings, and saves logs in the map based on their severity. + * The map is later used to provide information about warnings and errors in the user's code. + * + * KotlinLogger interface will be changed in the future to contain more log details. + * Implementation of the CompilationLogger should be therefore updated after KT-80963 is implemented. + * + * @property isDebugEnabled A flag to indicate whether debug-level logging is enabled for the logger. + * If true, all messages are printed to the standard output. + */ class CompilationLogger( override val isDebugEnabled: Boolean = false, ) : KotlinLogger { + /** + * Stores a collection of compilation logs organized by file paths. + * + * The map keys represent file paths as strings, and the associated values are mutable lists of + * `ErrorDescriptor` objects containing details about compilation issues, such as error messages, + * intervals, severity, and optional class names. + */ var compilationLogs: Map> = emptyMap() override fun debug(msg: String) { @@ -16,7 +36,7 @@ class CompilationLogger( } override fun error(msg: String, throwable: Throwable?) { - if (isDebugEnabled) System.err.println("[ERROR] $msg" + (throwable?.let { ": ${it.message}" } ?: "")) + if (isDebugEnabled) println("[ERROR] $msg" + (throwable?.let { ": ${it.message}" } ?: "")) try { addCompilationLog(msg, ProjectSeveriry.ERROR, classNameOverride = null) } catch (_: Exception) {} @@ -31,12 +51,22 @@ class CompilationLogger( } override fun warn(msg: String, throwable: Throwable?) { - if (isDebugEnabled) System.err.println("[WARN] $msg" + (throwable?.let { ": ${it.message}" } ?: "")) + if (isDebugEnabled) println("[WARN] $msg" + (throwable?.let { ": ${it.message}" } ?: "")) try { addCompilationLog(msg, ProjectSeveriry.WARNING, classNameOverride = "WARNING") } catch (_: Exception) {} } + + /** + * Adds a compilation log entry to the `compilationLogs` map based on the sting log. + * + * @param msg The raw log message containing information about the compilation event, + * including the file path and error details. + * @param severity The severity level of the compilation event, represented by the `ProjectSeveriry` enum. + * @param classNameOverride An optional override for the class name that will be recorded in the log. + * If null, it will be derived from the file path in the message. + */ private fun addCompilationLog(msg: String, severity: ProjectSeveriry, classNameOverride: String?) { val path = msg.split(" ")[0] val className = path.split("/").last().split(".").first() diff --git a/src/main/kotlin/com/compiler/server/compiler/components/CompletionProvider.kt b/src/main/kotlin/com/compiler/server/compiler/components/CompletionProvider.kt deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/main/kotlin/com/compiler/server/compiler/components/ErrorAnalyzer.kt b/src/main/kotlin/com/compiler/server/compiler/components/ErrorAnalyzer.kt deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/main/kotlin/com/compiler/server/compiler/components/KotlinCompiler.kt b/src/main/kotlin/com/compiler/server/compiler/components/KotlinCompiler.kt index c6ed569f1..2e0331ed3 100644 --- a/src/main/kotlin/com/compiler/server/compiler/components/KotlinCompiler.kt +++ b/src/main/kotlin/com/compiler/server/compiler/components/KotlinCompiler.kt @@ -66,7 +66,12 @@ class KotlinCompiler( ?.joinToString("\n\n") } - fun run(files: List, addByteCode: Boolean, args: String, userCompilerArguments: Map): JvmExecutionResult { + fun run( + files: List, + addByteCode: Boolean, + args: String, + userCompilerArguments: Map + ): JvmExecutionResult { return execute(files, addByteCode, userCompilerArguments) { output, compiled -> val mainClass = JavaRunnerExecutor::class.java.name val compiledMainClass = when (compiled.mainClasses.size) { @@ -77,7 +82,9 @@ class KotlinCompiler( 1 -> compiled.mainClasses.single() else -> return@execute JvmExecutionResult( exception = IllegalArgumentException( - "Multiple classes in project contain main methods found: ${compiled.mainClasses.sorted().joinToString()}" + "Multiple classes in project contain main methods found: ${ + compiled.mainClasses.sorted().joinToString() + }" ).toExceptionDescriptor() ) } @@ -87,7 +94,11 @@ class KotlinCompiler( } } - fun test(files: List, addByteCode: Boolean, userCompilerArguments: Map): JvmExecutionResult { + fun test( + files: List, + addByteCode: Boolean, + userCompilerArguments: Map + ): JvmExecutionResult { return execute(files, addByteCode, userCompilerArguments) { output, _ -> val mainClass = JUnitExecutors::class.java.name javaExecutor.execute(argsFrom(mainClass, output, listOf(output.path.toString()))) @@ -96,15 +107,20 @@ class KotlinCompiler( } @OptIn(ExperimentalPathApi::class) - fun compile(files: List, userCompilerArguments: Map): CompilationResult = usingTempDirectory { inputDir -> - val ioFiles = files.writeToIoFiles(inputDir) - usingTempDirectory { outputDir -> - val arguments = ioFiles.map { it.absolutePathString() } + - compilerArgumentsUtil.convertCompilerArgumentsToCompilationString(jvmCompilerArguments, compilerArgumentsUtil.PREDEFINED_JVM_ARGUMENTS, userCompilerArguments) - val result = compileWithToolchain(inputDir, outputDir, arguments) - return@usingTempDirectory result + fun compile(files: List, userCompilerArguments: Map): CompilationResult = + usingTempDirectory { inputDir -> + val ioFiles = files.writeToIoFiles(inputDir) + usingTempDirectory { outputDir -> + val arguments = ioFiles.map { it.absolutePathString() } + + compilerArgumentsUtil.convertCompilerArgumentsToCompilationString( + jvmCompilerArguments, + compilerArgumentsUtil.PREDEFINED_JVM_ARGUMENTS, + userCompilerArguments + ) + val result = compileWithToolchain(inputDir, outputDir, arguments) + return@usingTempDirectory result + } } - } @OptIn(ExperimentalPathApi::class, ExperimentalBuildToolsApi::class, ExperimentalBuildToolsApi::class) private fun compileWithToolchain( @@ -112,7 +128,6 @@ class KotlinCompiler( outputDir: Path, arguments: List ): CompilationResult { - System.setProperty("org.jetbrains.kotlin.buildtools.logger.extendedLocation", "true") val sources = inputDir.listDirectoryEntries() val logger = CompilationLogger() @@ -128,30 +143,32 @@ class KotlinCompiler( val result = try { session.executeOperation(operation, toolchains.createInProcessExecutionPolicy(), logger) - } catch (_: Exception) { - null + } catch (e: Exception) { + throw Exception("Exception executing compilation operation", e) } try { - return if (result == org.jetbrains.kotlin.buildtools.api.CompilationResult.COMPILATION_SUCCESS) { - val cd = CompilerDiagnostics(logger.compilationLogs) - val outputFiles = buildMap { - outputDir.visitFileTree { - onVisitFile { file, _ -> - put(file.relativeTo(outputDir).pathString, file.readBytes()) - FileVisitResult.CONTINUE + return when (result) { + org.jetbrains.kotlin.buildtools.api.CompilationResult.COMPILATION_SUCCESS -> { + val compilerDiagnostics = CompilerDiagnostics(logger.compilationLogs) + val outputFiles = buildMap { + outputDir.visitFileTree { + onVisitFile { file, _ -> + put(file.relativeTo(outputDir).pathString, file.readBytes()) + FileVisitResult.CONTINUE + } } } - } - Compiled( - compilerDiagnostics = cd, - result = JvmClasses( - files = outputFiles, - mainClasses = findMainClasses(outputFiles), + Compiled( + compilerDiagnostics = compilerDiagnostics, + result = JvmClasses( + files = outputFiles, + mainClasses = findMainClasses(outputFiles), + ) ) - ) - } else { - NotCompiled(CompilerDiagnostics(logger.compilationLogs)) + } + + else -> NotCompiled(CompilerDiagnostics(logger.compilationLogs)) } } finally { session.close() diff --git a/src/main/kotlin/com/compiler/server/configuration/BuildToolsConfig.kt b/src/main/kotlin/com/compiler/server/configuration/BuildToolsConfig.kt new file mode 100644 index 000000000..5188dc083 --- /dev/null +++ b/src/main/kotlin/com/compiler/server/configuration/BuildToolsConfig.kt @@ -0,0 +1,10 @@ +package com.compiler.server.configuration + +import org.springframework.context.annotation.Configuration + +@Configuration +class BuildToolsConfig { + init { + System.setProperty("org.jetbrains.kotlin.buildtools.logger.extendedLocation", "true") + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/compiler/server/service/KotlinProjectExecutor.kt b/src/main/kotlin/com/compiler/server/service/KotlinProjectExecutor.kt index aba17d5c5..ebb6e3e73 100644 --- a/src/main/kotlin/com/compiler/server/service/KotlinProjectExecutor.kt +++ b/src/main/kotlin/com/compiler/server/service/KotlinProjectExecutor.kt @@ -7,7 +7,6 @@ import com.compiler.server.model.JsCompilerArguments import com.compiler.server.model.bean.VersionInfo import component.KotlinEnvironment import model.Completion -import org.junit.Ignore import org.slf4j.LoggerFactory import org.springframework.stereotype.Component @@ -45,7 +44,6 @@ class KotlinProjectExecutor( } // TODO(Dmitrii Krasnov): implement this method in KTL-2807 - @Ignore fun complete(project: Project, line: Int, character: Int): List { return emptyList() } @@ -117,5 +115,4 @@ class KotlinProjectExecutor( getVersion().version ) } - }