Skip to content
Closed
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
14 changes: 7 additions & 7 deletions build-settings-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
rootProject.name = "build-settings-logic"

dependencyResolutionManagement {
apply(from = "src/main/kotlin/kotlin-compiler-server-version-catalog.settings.gradle.kts")

@Suppress("UnstableApiUsage")
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencyResolutionManagement {
// For buildSrc we need to declare a custom path to the toml file with versions' catalog.
// But for a root project we can't set `from` inside `versionCatalogs` catalog block for the default `libs` catalog.
// (see https://github.com/gradle/gradle/issues/21328)
// That is why it is not fully moved to the dependencyResolutionManagement block in the settings convention plugin.
versionCatalogs {
create("libs") {
getByName("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,51 @@
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()

val additionalRepositoryProperty = providers.gradleProperty("kotlin_repo_url")
if (additionalRepositoryProperty.isPresent) {
maven(additionalRepositoryProperty.get()) {
name = "KotlinDevRepo"
}
logger.info("A custom Kotlin repository ${additionalRepositoryProperty.get()} was added")
}

maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
}
}

dependencyResolutionManagement {
@Suppress("UnstableApiUsage")
repositories {
mavenCentral()
gradlePluginPortal()

val additionalRepositoryProperty = providers.gradleProperty("kotlin_repo_url")
if (additionalRepositoryProperty.isPresent) {
maven(additionalRepositoryProperty.get()) {
name = "KotlinDevRepo"
}
logger.info("A custom Kotlin repository ${additionalRepositoryProperty.get()} was added")
}

maven("https://repo.spring.io/snapshot")
maven("https://repo.spring.io/milestone")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
maven("https://cache-redirector.jetbrains.com/jetbrains.bintray.com/intellij-third-party-dependencies")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide-plugin-dependencies")
maven("https://www.myget.org/F/rd-snapshots/maven/")
maven("https://kotlin.jetbrains.space/p/kotlin/packages/maven/kotlin-ide")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap")
maven("https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental")
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}

versionCatalogs {
register("libs").configure {
val kotlinVersion = providers.gradleProperty("kotlinVersion")
val kotlinVersion = providers.gradleProperty("kotlin_version")
if (kotlinVersion.isPresent) {
version("kotlin", kotlinVersion.get())
}
Expand Down
22 changes: 1 addition & 21 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,13 @@ val propertyFile = "application.properties"
plugins {
alias(libs.plugins.spring.dependency.management)
alias(libs.plugins.spring.boot)
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.plugin.spring)
}

kotlin.jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(JvmVendorSpec.AMAZON)
id("base-kotlin-jvm-conventions")
}

apply<NodeJsRootPlugin>()

allprojects {
repositories {
mavenCentral()
gradlePluginPortal()
maven("https://repo.spring.io/snapshot")
maven("https://repo.spring.io/milestone")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
maven("https://cache-redirector.jetbrains.com/jetbrains.bintray.com/intellij-third-party-dependencies")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide-plugin-dependencies")
maven("https://www.myget.org/F/rd-snapshots/maven/")
maven("https://kotlin.jetbrains.space/p/kotlin/packages/maven/kotlin-ide")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap")
maven("https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental")
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
afterEvaluate {
dependencies {
dependencies {
Expand Down
5 changes: 1 addition & 4 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
}

// workaround to pass libs into conventions (see https://github.com/gradle/gradle/issues/15383)
dependencies {
implementation(libs.kotlin.gradlePlugin)
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
}
28 changes: 28 additions & 0 deletions buildSrc/src/main/kotlin/base-kotlin-jvm-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
plugins {
kotlin("jvm")
}

kotlin {

logger.info("For the ${project.name} we used $kotlinVersion kotlin version in this build.")

sourceSets.configureEach {
languageSettings {
val kotlinLanguageVersion = project.providers.gradleProperty("kotlin_language_version")
if (kotlinLanguageVersion.isPresent) {
languageVersion = kotlinLanguageVersion.get()
logger.info("An overriding Kotlin language version of $languageVersion was found for project ${project.name}")
}
val kotlinApiVersion = project.providers.gradleProperty("kotlin_api_version")
if (kotlinApiVersion.isPresent) {
apiVersion = kotlinApiVersion.get()
logger.info("An overriding Kotlin api version of $apiVersion was found for project ${project.name}")
}
}
}

jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(JvmVendorSpec.AMAZON)
}
}
2 changes: 1 addition & 1 deletion common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
kotlin("jvm")
id("base-kotlin-jvm-conventions")
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/kotlin/component/KotlinEnvironment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class KotlinEnvironment(
"-opt-in=kotlin.experimental.ExperimentalTypeInference",
"-opt-in=kotlin.uuid.ExperimentalUuidApi",
"-opt-in=kotlin.io.encoding.ExperimentalEncodingApi",
"-Xcontext-receivers",
"-Xcontext-parameters",
"-Xreport-all-warnings",
"-Wextra",
"-XXLanguage:+ExplicitBackingFields",
Expand Down
8 changes: 4 additions & 4 deletions dependencies/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsCompilerAttribute
import org.jetbrains.kotlin.gradle.targets.js.KotlinWasmTargetAttribute

plugins {
id("base-kotlin-jvm-conventions")
}

val kotlinDependency: Configuration by configurations.creating {
isTransitive = false
}
Expand Down Expand Up @@ -96,10 +100,6 @@ val copyComposeWasmCompilerPlugins by tasks.creating(Copy::class) {
into(libComposeWasmCompilerPluginsFolder)
}

plugins {
kotlin("jvm")
}

dependencies {
kotlinDependency(libs.junit)
kotlinDependency(libs.hamcrest)
Expand Down
7 changes: 1 addition & 6 deletions executors/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
plugins {
kotlin("jvm")
}

kotlin.jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(JvmVendorSpec.AMAZON)
id("base-kotlin-jvm-conventions")
}

dependencies {
Expand Down
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
kotlin = "2.1.10"
kotlin = "2.2.0-dev-800"
kotlinIdeVersion = "1.9.20-506"
kotlinIdeVersionWithSuffix = "231-1.9.20-506-IJ8109.175"
spring-boot = "2.7.10"
Expand Down Expand Up @@ -31,6 +31,7 @@ kotlin-stdlib-wasm-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-
kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin" }
kotlin-compiler = { group = "org.jetbrains.kotlin", name = "kotlin-compiler", 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-gradle-plugin-idea = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin-idea", version.ref = "kotlin" }
kotlin-dom-api-compat = { group = "org.jetbrains.kotlin", name = "kotlin-dom-api-compat", version.ref = "kotlin" }
kotlin-compose-compiler-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-compose-compiler-plugin", version.ref = "kotlin" }
Expand Down
2 changes: 1 addition & 1 deletion indexation/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
kotlin("jvm")
id("base-kotlin-jvm-conventions")
application
}

Expand Down
5 changes: 0 additions & 5 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
rootProject.name = "kotlin-compiler-server"
pluginManagement {
includeBuild("build-settings-logic")
repositories {
gradlePluginPortal()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap")
}
}
plugins {
id("kotlin-compiler-server-version-catalog")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import org.jetbrains.kotlin.cli.js.klib.TopDownAnalyzerFacadeForWasmJs
import org.jetbrains.kotlin.cli.jvm.compiler.CliBindingTrace
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl
import org.jetbrains.kotlin.container.*
Expand Down Expand Up @@ -114,13 +115,6 @@ class ErrorAnalyzer(

fun analyzeFileForJs(files: List<KtFile>, coreEnvironment: KotlinCoreEnvironment): Analysis {
val project = coreEnvironment.project
val configuration = JsConfig(
project,
kotlinEnvironment.jsConfiguration,
CompilerEnvironment,
kotlinEnvironment.JS_METADATA_CACHE,
kotlinEnvironment.JS_LIBRARIES.toSet()
)

val mainModule = MainModule.SourceFiles(files)
val sourceModule = ModulesStructure(
Expand Down Expand Up @@ -150,10 +144,11 @@ class ErrorAnalyzer(
customBuiltInsModule = builtInModuleDescriptor
)

val moduleName = kotlinEnvironment.jsConfiguration[CommonConfigurationKeys.MODULE_NAME]!!
val context = ContextForNewModule(
projectContext = ProjectContext(project, "COMPILER-SERVER-JS"),
moduleName = Name.special("<" + configuration.moduleId + ">"),
builtIns = JsPlatformAnalyzerServices.builtIns, platform = null
projectContext = ProjectContext(project, "COMPILER-SERVER-JS"),
moduleName = Name.special("<$moduleName>"),
builtIns = JsPlatformAnalyzerServices.builtIns, platform = null
)
val dependencies = mutableSetOf(context.module) + mds + JsPlatformAnalyzerServices.builtIns.builtInsModule
context.module.setDependencies(dependencies.toList())
Expand Down
6 changes: 3 additions & 3 deletions src/test/kotlin/com/compiler/server/HighlightTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,23 @@ class HighlightTest : BaseExecutorTest() {
fun `highlight Type inference failed`() {
val highlights = highlight("fun main() {\n \"sdf\".to\n}")
Assertions.assertEquals(highlights.size, 2)
errorContains(highlights, "Cannot infer type for this parameter. Please specify it explicitly.")
errorContains(highlights, "Cannot infer type for this parameter. Specify it explicitly.")
errorContains(highlights, "Function invocation 'to(...)' expected")
}

@Test
fun `highlight js Type inference failed`() {
val highlights = highlightJS("fun main() {\n \"sdf\".to\n}")
Assertions.assertEquals(highlights.size, 2)
errorContains(highlights, "Cannot infer type for this parameter. Please specify it explicitly.")
errorContains(highlights, "Cannot infer type for this parameter. Specify it explicitly.")
errorContains(highlights, "Function invocation 'to(...)' expected")
}

@Test
fun `highlight wasm Type inference failed`() {
val highlights = highlightWasm("fun main() {\n \"sdf\".to\n}")
Assertions.assertEquals(highlights.size, 2)
errorContains(highlights, "Cannot infer type for this parameter. Please specify it explicitly.")
errorContains(highlights, "Cannot infer type for this parameter. Specify it explicitly.")
errorContains(highlights, "Function invocation 'to(...)' expected")
}
}
12 changes: 2 additions & 10 deletions src/test/kotlin/com/compiler/server/KotlinFeatureSince160.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,13 @@ class KotlinFeatureSince160 : BaseExecutorTest() {
fun info(message: String) = println(message)
}

interface LoggingContext {
val log: Logger
}

context(LoggingContext)
context(log: Logger)
fun executeTask() {
log.info("Complete")
}

fun main() {
val loggingContext = object: LoggingContext {
override val log = Logger()
}

with(loggingContext) {
with(Logger()) {
executeTask()
}
}
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading