Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pluginManagement {
}
maven("https://redirector.kotlinlang.org/maven/dev")
mavenLocal()
maven("https://redirector.kotlinlang.org/maven/dev")
}
}

Expand All @@ -31,7 +30,6 @@ dependencyResolutionManagement {
}
maven("https://redirector.kotlinlang.org/maven/dev")
mavenLocal()
maven("https://redirector.kotlinlang.org/maven/dev")
}

versionCatalogs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
/**
* 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<String> =
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/<kotlin_version>/compiler/run .\n"
)
}