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 4c2fe1ced..54664d948 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 @@ -12,7 +12,6 @@ pluginManagement { } maven("https://redirector.kotlinlang.org/maven/dev") mavenLocal() - maven("https://redirector.kotlinlang.org/maven/dev") } } @@ -31,7 +30,6 @@ dependencyResolutionManagement { } maven("https://redirector.kotlinlang.org/maven/dev") mavenLocal() - maven("https://redirector.kotlinlang.org/maven/dev") } versionCatalogs { diff --git a/src/main/kotlin/com/compiler/server/controllers/KotlinPlaygroundRestController.kt b/src/main/kotlin/com/compiler/server/controllers/KotlinPlaygroundRestController.kt index ffcc3d6f2..3fafecaf0 100644 --- a/src/main/kotlin/com/compiler/server/controllers/KotlinPlaygroundRestController.kt +++ b/src/main/kotlin/com/compiler/server/controllers/KotlinPlaygroundRestController.kt @@ -12,59 +12,36 @@ import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.bind.annotation.RestController @RestController -class KotlinPlaygroundRestController(private val kotlinProjectExecutor: KotlinProjectExecutor) { +@Deprecated( + "Use only for old kotlin playground widget. " + + "Should be removed in KTL-2974 around 2.5.0" +) +class KotlinPlaygroundRestController() { - /** - * Endpoint for support requests from kotlin playground client. - * Kotlin Playground component see: https://github.com/JetBrains/kotlin-playground - * Old server see: https://github.com/JetBrains/kotlin-web-demo - */ - @RequestMapping( - value = ["/kotlinServer"], - method = [RequestMethod.GET, RequestMethod.POST], - consumes = [MediaType.ALL_VALUE], - produces = [MediaType.APPLICATION_JSON_VALUE] - ) - @Suppress("IMPLICIT_CAST_TO_ANY") - fun tryKotlinLangObsoleteEndpoint( - @RequestParam type: String, - @RequestParam(required = false) line: Int?, - @RequestParam(required = false) ch: Int?, - @RequestParam(required = false) project: Project?, - @RequestParam(defaultValue = "false") addByteCode: Boolean, - ): ResponseEntity<*> { - val result = when (type) { - "getKotlinVersions" -> listOf(kotlinProjectExecutor.getVersion()) - else -> { - if (project == null) error("No parameter 'project' found") - when (type) { - "run" -> { - when (project.confType) { - ProjectType.JAVA -> kotlinProjectExecutor.run(project, addByteCode) - ProjectType.JS -> throw LegacyJsException() - ProjectType.JS_IR, ProjectType.CANVAS -> - kotlinProjectExecutor.convertToJsIr( - project, - ) - ProjectType.WASM, ProjectType.COMPOSE_WASM -> kotlinProjectExecutor.convertToWasm( - project, - debugInfo = false, - ) - ProjectType.JUNIT -> kotlinProjectExecutor.test(project, addByteCode) - } - } - - "highlight" -> kotlinProjectExecutor.highlight(project) - "complete" -> { - if (line != null && ch != null) { - kotlinProjectExecutor.complete(project, line, ch) - } else error("No parameters 'line' or 'ch'") - } - - else -> error("No parameter 'type' found") - } - } - } - return ResponseEntity.ok(result) - } -} \ No newline at end of file + /** + * Endpoint for support requests from kotlin playground client. + * Kotlin Playground component see: https://github.com/JetBrains/kotlin-playground + * Old server see: https://github.com/JetBrains/kotlin-web-demo + */ + @RequestMapping( + value = ["/kotlinServer"], + method = [RequestMethod.GET, RequestMethod.POST], + consumes = [MediaType.ALL_VALUE], + ) + @Suppress("IMPLICIT_CAST_TO_ANY") + fun tryKotlinLangObsoleteEndpoint( + @RequestParam type: String, + @RequestParam(required = false) line: Int?, + @RequestParam(required = false) ch: Int?, + @RequestParam(required = false) project: Project?, + @RequestParam(defaultValue = "false") addByteCode: Boolean, + ): ResponseEntity = + ResponseEntity + .badRequest() + .body( + "This endpoint is not available anymore.\n" + + "And will be soon removed from the Kotlin Playground.\n" + + "If you are using playground widget, then update to the new version: https://github.com/JetBrains/kotlin-playground \n" + + "Otherwise, use the new api available at: https://api.kotlinlang.org/api//compiler/run .\n" + ) +}