JVM IR: remove dependency of 'backend.jvm' on 'psi2ir', 'ir.serialization.jvm'
Add a new module 'backend.jvm.entrypoint' which depends on psi2ir and contains code that runs psi2ir + JVM IR backend with serialization implementations. Hopefully this will allow to compile these modules in parallel and reduce the build time.
This commit is contained in:
@@ -242,6 +242,7 @@ extra["compilerModules"] = arrayOf(
|
||||
":compiler:ir.psi2ir",
|
||||
":compiler:ir.backend.common",
|
||||
":compiler:backend.jvm",
|
||||
":compiler:backend.jvm:backend.jvm.entrypoint",
|
||||
":compiler:backend.js",
|
||||
":compiler:backend.wasm",
|
||||
":compiler:ir.serialization.common",
|
||||
|
||||
@@ -12,6 +12,7 @@ dependencies {
|
||||
compile(project(":compiler:backend-common"))
|
||||
compile(project(":compiler:backend"))
|
||||
compile(project(":compiler:backend.jvm"))
|
||||
implementation(project(":compiler:backend.jvm:backend.jvm.entrypoint"))
|
||||
compile(project(":compiler:ir.backend.common"))
|
||||
compile(project(":compiler:light-classes"))
|
||||
compile(project(":compiler:serialization"))
|
||||
|
||||
@@ -12,6 +12,9 @@ dependencies {
|
||||
api(project(":compiler:fir:fir2ir"))
|
||||
api(project(":compiler:fir:checkers"))
|
||||
|
||||
// TODO: do not use GeneratorExtensions in `FirAnalyzerFacade.convertToIr`, and make this an 'implementation' dependency.
|
||||
api(project(":compiler:ir.psi2ir"))
|
||||
|
||||
implementation(project(":compiler:fir:resolve"))
|
||||
implementation(project(":compiler:fir:fir2ir:jvm-backend"))
|
||||
implementation(project(":compiler:backend.jvm"))
|
||||
|
||||
@@ -15,6 +15,7 @@ dependencies {
|
||||
compileOnly(project(":compiler:ir.tree"))
|
||||
compileOnly(project(":compiler:backend"))
|
||||
compileOnly(project(":compiler:backend.jvm"))
|
||||
api(project(":compiler:ir.serialization.common"))
|
||||
|
||||
compileOnly(intellijCoreDep()) { includeJars("intellij-core", "asm-all", rootProject = rootProject) }
|
||||
}
|
||||
|
||||
@@ -7,9 +7,7 @@ dependencies {
|
||||
compile(project(":kotlin-annotations-jvm"))
|
||||
compile(project(":compiler:backend"))
|
||||
compile(project(":compiler:ir.tree"))
|
||||
compile(project(":compiler:ir.psi2ir"))
|
||||
compile(project(":compiler:ir.backend.common"))
|
||||
compile(project(":compiler:ir.serialization.jvm"))
|
||||
api(project(":compiler:backend.common.jvm"))
|
||||
compileOnly(project(":compiler:ir.tree.impl"))
|
||||
compileOnly(intellijCoreDep()) { includeJars("intellij-core", "asm-all", "guava", rootProject = rootProject) }
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(project(":compiler:ir.psi2ir"))
|
||||
api(project(":compiler:backend.jvm"))
|
||||
api(project(":compiler:ir.tree.impl"))
|
||||
api(project(":compiler:ir.serialization.jvm"))
|
||||
compileOnly(intellijCoreDep()) { includeJars("intellij-core", rootProject = rootProject) }
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
"main" {
|
||||
projectDefault()
|
||||
}
|
||||
"test" {}
|
||||
}
|
||||
+1
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2021 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.
|
||||
*/
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
|
||||
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
|
||||
import org.jetbrains.kotlin.ir.descriptors.IrFunctionFactory
|
||||
import org.jetbrains.kotlin.ir.linkage.IrProvider
|
||||
import org.jetbrains.kotlin.ir.types.defaultType
|
||||
import org.jetbrains.kotlin.ir.util.*
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi2ir.Psi2IrConfiguration
|
||||
@@ -178,10 +177,6 @@ class JvmIrCodegenFactory(private val phaseConfig: PhaseConfig) : CodegenFactory
|
||||
/* JvmBackendContext creates new unbound symbols, have to resolve them. */
|
||||
ExternalDependenciesGenerator(symbolTable, irProviders).generateUnboundSymbolsAsDependencies()
|
||||
|
||||
state.mapInlineClass = { descriptor ->
|
||||
context.typeMapper.mapType(context.referenceClass(descriptor).defaultType)
|
||||
}
|
||||
|
||||
context.state.factory.registerSourceFiles(irModuleFragment.files.map(IrFile::getKtFile))
|
||||
|
||||
JvmLower(context).lower(irModuleFragment)
|
||||
@@ -37,6 +37,7 @@ import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrFunctionReference
|
||||
import org.jetbrains.kotlin.ir.symbols.*
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.defaultType
|
||||
import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||
@@ -130,6 +131,12 @@ class JvmBackendContext(
|
||||
|
||||
internal val continuationClassesVarsCountByType: MutableMap<IrAttributeContainer, Map<Type, Int>> = hashMapOf()
|
||||
|
||||
init {
|
||||
state.mapInlineClass = { descriptor ->
|
||||
typeMapper.mapType(referenceClass(descriptor).defaultType)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun referenceClass(descriptor: ClassDescriptor): IrClassSymbol =
|
||||
symbolTable.lazyWrapper.referenceClass(descriptor)
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ dependencies {
|
||||
testApi(project(":compiler:fir:entrypoint"))
|
||||
testApi(project(":compiler:cli"))
|
||||
testImplementation(project(":compiler:ir.tree.impl"))
|
||||
testImplementation(project(":compiler:backend.jvm:backend.jvm.entrypoint"))
|
||||
testImplementation(intellijCoreDep()) { includeJars("intellij-core") }
|
||||
|
||||
testCompileOnly(project(":kotlin-reflect-api"))
|
||||
|
||||
@@ -23,6 +23,7 @@ dependencies {
|
||||
testCompile(project(":compiler:cli-js"))
|
||||
testCompile(project(":compiler:serialization"))
|
||||
testCompile(project(":compiler:fir:entrypoint"))
|
||||
testCompile(project(":compiler:backend.jvm:backend.jvm.entrypoint"))
|
||||
testCompile(projectTests(":compiler:test-infrastructure-utils"))
|
||||
testCompile(project(":kotlin-preloader"))
|
||||
testCompile(commonDep("com.android.tools:r8"))
|
||||
|
||||
@@ -86,6 +86,7 @@ dependencies {
|
||||
compile(project(":kotlin-script-util")) { isTransitive = false }
|
||||
compile(project(":kotlin-scripting-intellij"))
|
||||
compile(project(":compiler:backend.jvm")) // Do not delete, for Pill
|
||||
compile(project(":compiler:backend.jvm:backend.jvm.entrypoint"))
|
||||
|
||||
compile(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false }
|
||||
|
||||
|
||||
@@ -177,6 +177,7 @@ dependencies {
|
||||
compilerCompile project(":kotlin-util-klib")
|
||||
compilerCompile project(":kotlin-util-klib-metadata")
|
||||
compilerCompile project(":compiler:ir.serialization.common")
|
||||
compilerCompile project(":compiler:ir.psi2ir")
|
||||
use(LocalDependenciesKt) {
|
||||
compilerCompile(intellijCoreDep()){
|
||||
artifact {
|
||||
|
||||
+3
-3
@@ -18,11 +18,11 @@ package org.jetbrains.kotlin.parcelize
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import org.jetbrains.kotlin.backend.common.serialization.findPackage
|
||||
import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.descriptors.containingPackage
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.parcelize.diagnostic.ErrorsParcelize
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
@@ -76,8 +76,8 @@ open class ParcelizeAnnotationChecker : CallChecker {
|
||||
context: CallCheckerContext,
|
||||
isForbidden: Boolean
|
||||
) {
|
||||
val descriptorPackage = resolvedCall.resultingDescriptor.findPackage()
|
||||
if (descriptorPackage.fqName == DEPRECATED_RUNTIME_PACKAGE) {
|
||||
val descriptorPackage = resolvedCall.resultingDescriptor.containingPackage()
|
||||
if (descriptorPackage == DEPRECATED_RUNTIME_PACKAGE) {
|
||||
val factory = if (isForbidden) ErrorsParcelize.FORBIDDEN_DEPRECATED_ANNOTATION else ErrorsParcelize.DEPRECATED_ANNOTATION
|
||||
context.trace.report(factory.on(annotationEntry))
|
||||
}
|
||||
|
||||
-2
@@ -5,7 +5,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.parcelize
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.serialization.findPackage
|
||||
import org.jetbrains.kotlin.codegen.ClassBuilderMode
|
||||
import org.jetbrains.kotlin.codegen.FrameMap
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
|
||||
@@ -18,7 +17,6 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.parcelize.ParcelizeAnnotationChecker.Companion.DEPRECATED_RUNTIME_PACKAGE
|
||||
import org.jetbrains.kotlin.parcelize.diagnostic.ErrorsParcelize
|
||||
import org.jetbrains.kotlin.parcelize.serializers.ParcelSerializer
|
||||
import org.jetbrains.kotlin.parcelize.serializers.isParcelable
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
description = "Kotlin Scripting Compiler Plugin"
|
||||
|
||||
plugins {
|
||||
@@ -15,6 +14,7 @@ dependencies {
|
||||
compileOnly(project(":compiler:backend.js"))
|
||||
compileOnly(project(":core:descriptors.runtime"))
|
||||
compileOnly(project(":compiler:ir.tree.impl"))
|
||||
compileOnly(project(":compiler:backend.jvm:backend.jvm.entrypoint"))
|
||||
compileOnly(project(":kotlin-reflect-api"))
|
||||
compile(project(":kotlin-scripting-common"))
|
||||
compile(project(":kotlin-scripting-js"))
|
||||
|
||||
@@ -19,6 +19,7 @@ val projectsToShadow by extra(listOf(
|
||||
":compiler:backend.common.jvm",
|
||||
":compiler:backend-common",
|
||||
":compiler:backend.jvm",
|
||||
":compiler:backend.jvm:backend.jvm.entrypoint",
|
||||
":compiler:ir.backend.common",
|
||||
":compiler:ir.serialization.jvm",
|
||||
":compiler:ir.serialization.common",
|
||||
|
||||
@@ -106,6 +106,7 @@ include ":benchmarks",
|
||||
":compiler:backend.js",
|
||||
":compiler:backend.wasm",
|
||||
":compiler:backend.jvm",
|
||||
":compiler:backend.jvm:backend.jvm.entrypoint",
|
||||
":compiler:backend-common",
|
||||
":compiler:backend",
|
||||
":compiler:plugin-api",
|
||||
@@ -483,6 +484,7 @@ project(':compiler:ir.backend.common').projectDir = "$rootDir/compiler/ir/backen
|
||||
project(':compiler:backend.js').projectDir = "$rootDir/compiler/ir/backend.js" as File
|
||||
project(':compiler:backend.wasm').projectDir = "$rootDir/compiler/ir/backend.wasm" as File
|
||||
project(':compiler:backend.jvm').projectDir = "$rootDir/compiler/ir/backend.jvm" as File
|
||||
project(':compiler:backend.jvm:backend.jvm.entrypoint').projectDir = "$rootDir/compiler/ir/backend.jvm/entrypoint" as File
|
||||
project(':compiler:ir.serialization.common').projectDir = "$rootDir/compiler/ir/serialization.common" as File
|
||||
project(':compiler:ir.serialization.jvm').projectDir = "$rootDir/compiler/ir/serialization.jvm" as File
|
||||
project(':compiler:ir.serialization.js').projectDir = "$rootDir/compiler/ir/serialization.js" as File
|
||||
|
||||
Reference in New Issue
Block a user