diff --git a/build.gradle.kts b/build.gradle.kts index dee159cc994..747d514a9f8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -270,6 +270,7 @@ extra["compilerModules"] = arrayOf( ":core:descriptors.jvm", ":core:descriptors.runtime", ":core:deserialization", + ":core:deserialization:deserialization.common", ":core:util.runtime", ":core:type-system", ":compiler:fir:cones", diff --git a/compiler/fir/tree/build.gradle.kts b/compiler/fir/tree/build.gradle.kts index 7f594994007..01fae5c1645 100644 --- a/compiler/fir/tree/build.gradle.kts +++ b/compiler/fir/tree/build.gradle.kts @@ -7,6 +7,7 @@ plugins { dependencies { api(project(":compiler:fir:cones")) + api(project(":core:deserialization:deserialization.common")) compile(project(":compiler:resolution")) compile(project(":compiler:frontend.common")) diff --git a/compiler/fir/tree/tree-generator/build.gradle.kts b/compiler/fir/tree/tree-generator/build.gradle.kts index 35f36631b4c..5405a865b6c 100644 --- a/compiler/fir/tree/tree-generator/build.gradle.kts +++ b/compiler/fir/tree/tree-generator/build.gradle.kts @@ -12,6 +12,7 @@ runtimeOnly.extendsFrom(compileOnly) dependencies { compile(project(":compiler:frontend.common")) + implementation(project(":core:deserialization:deserialization.common")) compile(project(":core:descriptors")) compile(project(":compiler:fir:cones")) compile(project(":compiler:resolution")) diff --git a/core/deserialization/build.gradle.kts b/core/deserialization/build.gradle.kts index e6c0e6dc127..9df80b4ae35 100644 --- a/core/deserialization/build.gradle.kts +++ b/core/deserialization/build.gradle.kts @@ -10,6 +10,7 @@ dependencies { compile(project(":core:metadata")) compile(project(":core:util.runtime")) compile(project(":core:descriptors")) + compile(project(":core:deserialization:deserialization.common")) compile(commonDep("javax.inject")) } diff --git a/core/deserialization/deserialization.common/build.gradle.kts b/core/deserialization/deserialization.common/build.gradle.kts new file mode 100644 index 00000000000..e6c0e6dc127 --- /dev/null +++ b/core/deserialization/deserialization.common/build.gradle.kts @@ -0,0 +1,24 @@ +plugins { + kotlin("jvm") + id("jps-compatible") +} + +jvmTarget = "1.6" +javaHome = rootProject.extra["JDK_16"] as String + +dependencies { + compile(project(":core:metadata")) + compile(project(":core:util.runtime")) + compile(project(":core:descriptors")) + compile(commonDep("javax.inject")) +} + +sourceSets { + "main" { projectDefault() } + "test" {} +} + +tasks.withType { + sourceCompatibility = "1.6" + targetCompatibility = "1.6" +} diff --git a/core/deserialization/deserialization.common/src/org/jetbrains/kotlin/serialization/deserialization/IncompatibleVersionErrorData.kt b/core/deserialization/deserialization.common/src/org/jetbrains/kotlin/serialization/deserialization/IncompatibleVersionErrorData.kt new file mode 100644 index 00000000000..dab27ed98c3 --- /dev/null +++ b/core/deserialization/deserialization.common/src/org/jetbrains/kotlin/serialization/deserialization/IncompatibleVersionErrorData.kt @@ -0,0 +1,16 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.serialization.deserialization + +import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion +import org.jetbrains.kotlin.name.ClassId + +data class IncompatibleVersionErrorData( + val actualVersion: T, + val expectedVersion: T, + val filePath: String, + val classId: ClassId +) diff --git a/core/deserialization/deserialization.common/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedContainerSource.kt b/core/deserialization/deserialization.common/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedContainerSource.kt new file mode 100644 index 00000000000..28748ed8c7e --- /dev/null +++ b/core/deserialization/deserialization.common/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedContainerSource.kt @@ -0,0 +1,25 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.serialization.deserialization.descriptors + +import org.jetbrains.kotlin.descriptors.SourceElement +import org.jetbrains.kotlin.serialization.deserialization.IncompatibleVersionErrorData + +interface DeserializedContainerSource : SourceElement { + // Non-null if this container is loaded from a class with an incompatible binary version + val incompatibility: IncompatibleVersionErrorData<*>? + + // True iff this is container is "invisible" because it's loaded from a pre-release class and this compiler is a release + val isPreReleaseInvisible: Boolean + + // True iff this container was compiled by the new IR backend, this compiler is not using the IR backend right now, + // and no additional flags to override this behavior were specified. + val isInvisibleIrDependency: Boolean + + // This string should only be used in error messages + val presentableString: String +} + diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/IncompatibleVersionErrorData.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/IncompatibleVersionErrorData.kt deleted file mode 100644 index 999ad2a6119..00000000000 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/IncompatibleVersionErrorData.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.serialization.deserialization - -import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion -import org.jetbrains.kotlin.name.ClassId - -data class IncompatibleVersionErrorData( - val actualVersion: T, - val expectedVersion: T, - val filePath: String, - val classId: ClassId -) diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedMemberDescriptor.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedMemberDescriptor.kt index 71054f5e59b..8d9996edb1d 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedMemberDescriptor.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedMemberDescriptor.kt @@ -45,21 +45,6 @@ interface DeserializedMemberDescriptor : DeserializedDescriptor, MemberDescripto } } -interface DeserializedContainerSource : SourceElement { - // Non-null if this container is loaded from a class with an incompatible binary version - val incompatibility: IncompatibleVersionErrorData<*>? - - // True iff this is container is "invisible" because it's loaded from a pre-release class and this compiler is a release - val isPreReleaseInvisible: Boolean - - // True iff this container was compiled by the new IR backend, this compiler is not using the IR backend right now, - // and no additional flags to override this behavior were specified. - val isInvisibleIrDependency: Boolean - - // This string should only be used in error messages - val presentableString: String -} - interface DeserializedCallableMemberDescriptor : DeserializedMemberDescriptor, CallableMemberDescriptor class DeserializedSimpleFunctionDescriptor( diff --git a/libraries/reflect/build.gradle.kts b/libraries/reflect/build.gradle.kts index 90407f17d53..c61c5ef801e 100644 --- a/libraries/reflect/build.gradle.kts +++ b/libraries/reflect/build.gradle.kts @@ -52,6 +52,7 @@ dependencies { embedded(project(":core:descriptors.common")) embedded(project(":core:descriptors.jvm")) embedded(project(":core:deserialization")) + embedded(project(":core:deserialization:deserialization.common")) embedded(project(":core:descriptors.runtime")) embedded(project(":core:util.runtime")) embedded("javax.inject:javax.inject:1") @@ -163,6 +164,7 @@ val relocateCoreSources by task { from("$core/descriptors.jvm/src") from("$core/descriptors.runtime/src") from("$core/deserialization/src") + from("$core/deserialization/deserialization.common/src") from("$core/util.runtime/src") exclude("META-INF/services/**") diff --git a/settings.gradle b/settings.gradle index b2a39bd3965..190630ba84a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -85,22 +85,6 @@ include ":benchmarks", ":compiler:visualizer:common", ":compiler:visualizer:render-fir", ":compiler:visualizer:render-psi", - ":compiler:fir:cones", - ":compiler:fir:tree", - ":compiler:fir:tree:tree-generator", - ":compiler:fir:raw-fir:fir-common", - ":compiler:fir:raw-fir:psi2fir", - ":compiler:fir:raw-fir:light-tree2fir", - ":compiler:fir:fir2ir", - ":compiler:fir:fir2ir:jvm-backend", - ":compiler:fir:resolve", - ":compiler:fir:fir-serialization", - ":compiler:fir:java", - ":compiler:fir:modularized-tests", - ":compiler:fir:dump", - ":compiler:fir:jvm", - ":compiler:fir:checkers", - ":compiler:fir:analysis-tests", ":compiler:frontend", ":compiler:frontend.common", ":compiler:frontend.java", @@ -154,6 +138,7 @@ include ":benchmarks", ":core:type-system", ":core:descriptors.jvm", ":core:deserialization", + ":core:deserialization:deserialization.common", ":core:descriptors.runtime", ":core:metadata", ":core:metadata.jvm", @@ -312,6 +297,23 @@ include ":benchmarks", ":kotlin-serialization", ":kotlin-serialization-unshaded" +include ":compiler:fir:cones", + ":compiler:fir:tree", + ":compiler:fir:tree:tree-generator", + ":compiler:fir:raw-fir:fir-common", + ":compiler:fir:raw-fir:psi2fir", + ":compiler:fir:raw-fir:light-tree2fir", + ":compiler:fir:fir2ir", + ":compiler:fir:fir2ir:jvm-backend", + ":compiler:fir:resolve", + ":compiler:fir:fir-serialization", + ":compiler:fir:java", + ":compiler:fir:modularized-tests", + ":compiler:fir:dump", + ":compiler:fir:jvm", + ":compiler:fir:checkers", + ":compiler:fir:analysis-tests" + include ":idea:idea-frontend-fir:idea-fir-low-level-api" include ":prepare:ide-plugin-dependencies:android-extensions-compiler-plugin-for-ide",