[CHERRY PICKED FROM IJ] [kotlin] i18n
GitOrigin-RevId: 0a55f4d8b088328c83e1af233f7f34ffd51e2382 Original commit: https://github.com/JetBrains/intellij-community/commit/3b2e2d8afdaafde31d52eb32cffae9c4aae6704b
This commit is contained in:
committed by
Nikita Bobko
parent
169ecabd2c
commit
cb0955a82d
@@ -16,7 +16,10 @@
|
||||
|
||||
package org.jetbrains.kotlin.config
|
||||
|
||||
import com.intellij.openapi.util.NlsSafe
|
||||
|
||||
object CompilerRunnerConstants {
|
||||
const val KOTLIN_COMPILER_NAME = "Kotlin"
|
||||
@NlsSafe
|
||||
const val INTERNAL_ERROR_PREFIX = "[Internal Error] "
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
compiler.text.experimental.bytecode.instrumentation.for.kotlin.classes.is.enabled=Experimental bytecode instrumentation for Kotlin classes is enabled
|
||||
compiler.text.incremental.caches.are.corrupted.all.kotlin.code.will.be.rebuilt=Incremental caches are corrupted. All Kotlin code will be rebuilt.
|
||||
compiler.text.0.is.not.yet.supported.in.idea.internal.build.system.please.use.gradle.to.build.1.enable.delegate.ide.build.run.actions.to.gradle.in.settings={0} is not yet supported in IDEA internal build system. Please use Gradle to build {1} (enable ''Delegate IDE build/run actions to Gradle'' in Settings).
|
||||
compiler.text.0.is.not.yet.supported.in.idea.internal.build.system.please.use.gradle.to.build.them.enable.delegate.ide.build.run.actions.to.gradle.in.settings={0} is not yet supported in IDEA internal build system.\nPlease use Gradle to build them (enable ''Delegate IDE build/run actions to Gradle'' in Settings).
|
||||
error.message.no.output.directory.found.for.0=No output directory found for {0}
|
||||
progress.text.compiling.0=compiling [{0}]
|
||||
error.text.cyclically.dependent.modules.are.not.supported.in.multiplatform.projects=Cyclically dependent modules are not supported in multiplatform projects
|
||||
info.text.kotlin.jps.plugin.is.disabled=Kotlin JPS plugin is disabled
|
||||
error.text.cyclically.dependent.modules.0.should.have.same.compiler=Cyclically dependent modules {0} should have same compiler.
|
||||
error.text.output.directory.not.specified.for.0=Output directory not specified for {0}
|
||||
@@ -5,9 +5,11 @@
|
||||
|
||||
package org.jetbrains.kotlin.compilerRunner
|
||||
|
||||
import org.jetbrains.annotations.Nls
|
||||
import org.jetbrains.jps.ModuleChunk
|
||||
import org.jetbrains.jps.incremental.CompileContext
|
||||
import org.jetbrains.jps.incremental.messages.ProgressMessage
|
||||
import org.jetbrains.kotlin.jps.KotlinJpsBundle
|
||||
|
||||
interface ProgressReporter {
|
||||
fun progress(message: String)
|
||||
@@ -16,12 +18,13 @@ interface ProgressReporter {
|
||||
}
|
||||
|
||||
class ProgressReporterImpl(private val context: CompileContext, private val chunk: ModuleChunk) : ProgressReporter {
|
||||
override fun progress(message: String) {
|
||||
override fun progress(@Nls message: String) {
|
||||
@Suppress("HardCodedStringLiteral")
|
||||
context.processMessage(ProgressMessage("Kotlin: $message"))
|
||||
}
|
||||
|
||||
override fun compilationStarted() {
|
||||
progress("compiling [${chunk.presentableShortName}]")
|
||||
progress(KotlinJpsBundle.message("progress.text.compiling.0", chunk.presentableShortName))
|
||||
}
|
||||
|
||||
override fun clearProgress() {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.kotlin.jps
|
||||
|
||||
import org.jetbrains.annotations.Nls
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.annotations.PropertyKey
|
||||
import org.jetbrains.kotlin.util.AbstractKotlinBundle
|
||||
|
||||
@NonNls
|
||||
private const val BUNDLE = "messages.KotlinJpsBundle"
|
||||
|
||||
object KotlinJpsBundle : AbstractKotlinBundle(BUNDLE) {
|
||||
@Nls
|
||||
@JvmStatic
|
||||
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params)
|
||||
|
||||
@Nls
|
||||
@JvmStatic
|
||||
fun htmlMessage(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String =
|
||||
getMessage(key, *params).withHtml()
|
||||
|
||||
@Nls
|
||||
@JvmStatic
|
||||
fun lazyMessage(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): () -> String = { getMessage(key, *params) }
|
||||
}
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.kotlin.jps.build
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.util.NlsSafe
|
||||
import org.jetbrains.jps.ModuleChunk
|
||||
import org.jetbrains.jps.builders.DirtyFilesHolder
|
||||
import org.jetbrains.jps.builders.FileProcessor
|
||||
@@ -32,7 +33,6 @@ import org.jetbrains.kotlin.build.GeneratedFile
|
||||
import org.jetbrains.kotlin.build.GeneratedJvmClass
|
||||
import org.jetbrains.kotlin.cli.common.ExitCode
|
||||
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.*
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollectorUtil
|
||||
import org.jetbrains.kotlin.compilerRunner.*
|
||||
@@ -44,6 +44,7 @@ import org.jetbrains.kotlin.incremental.*
|
||||
import org.jetbrains.kotlin.incremental.components.ExpectActualTracker
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.build.report.ICReporterBase
|
||||
import org.jetbrains.kotlin.jps.KotlinJpsBundle
|
||||
import org.jetbrains.kotlin.jps.incremental.JpsIncrementalCache
|
||||
import org.jetbrains.kotlin.jps.incremental.JpsLookupStorageManager
|
||||
import org.jetbrains.kotlin.jps.model.kotlinKind
|
||||
@@ -62,6 +63,7 @@ import kotlin.system.measureTimeMillis
|
||||
|
||||
class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
||||
companion object {
|
||||
@NlsSafe
|
||||
const val KOTLIN_BUILDER_NAME: String = "Kotlin Builder"
|
||||
|
||||
val LOG = Logger.getInstance("#org.jetbrains.kotlin.jps.build.KotlinBuilder")
|
||||
@@ -292,7 +294,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
||||
if (chunk.modules.size > 1) {
|
||||
messageCollector.report(
|
||||
ERROR,
|
||||
"Cyclically dependent modules are not supported in multiplatform projects"
|
||||
KotlinJpsBundle.message("error.text.cyclically.dependent.modules.are.not.supported.in.multiplatform.projects")
|
||||
)
|
||||
return ABORT
|
||||
}
|
||||
@@ -338,7 +340,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
||||
): ExitCode {
|
||||
// Workaround for Android Studio
|
||||
if (representativeTarget is KotlinJvmModuleBuildTarget && !JavaBuilder.IS_ENABLED[context, true]) {
|
||||
messageCollector.report(INFO, "Kotlin JPS plugin is disabled")
|
||||
messageCollector.report(INFO, KotlinJpsBundle.message("info.text.kotlin.jps.plugin.is.disabled"))
|
||||
return NOTHING_DONE
|
||||
}
|
||||
|
||||
@@ -348,7 +350,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
||||
if (!kotlinChunk.haveSameCompiler) {
|
||||
messageCollector.report(
|
||||
ERROR,
|
||||
"Cyclically dependent modules ${kotlinChunk.presentableModulesToCompilersList} should have same compiler."
|
||||
KotlinJpsBundle.message("error.text.cyclically.dependent.modules.0.should.have.same.compiler", kotlinChunk.presentableModulesToCompilersList)
|
||||
)
|
||||
return ABORT
|
||||
}
|
||||
@@ -386,7 +388,9 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
||||
|
||||
val targetsWithoutOutputDir = targets.filter { it.outputDir == null }
|
||||
if (targetsWithoutOutputDir.isNotEmpty()) {
|
||||
messageCollector.report(ERROR, "Output directory not specified for " + targetsWithoutOutputDir.joinToString())
|
||||
messageCollector.report(ERROR,
|
||||
KotlinJpsBundle.message("error.text.output.directory.not.specified.for.0", targetsWithoutOutputDir.joinToString())
|
||||
)
|
||||
return ABORT
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.jetbrains.jps.incremental.messages.CompilerMessage
|
||||
import org.jetbrains.kotlin.config.CompilerRunnerConstants.KOTLIN_COMPILER_NAME
|
||||
import org.jetbrains.kotlin.incremental.LookupSymbol
|
||||
import org.jetbrains.kotlin.incremental.storage.FileToPathConverter
|
||||
import org.jetbrains.kotlin.jps.KotlinJpsBundle
|
||||
import org.jetbrains.kotlin.jps.incremental.*
|
||||
import org.jetbrains.kotlin.jps.targets.KotlinTargetsIndex
|
||||
import org.jetbrains.kotlin.jps.targets.KotlinTargetsIndexBuilder
|
||||
@@ -70,7 +71,7 @@ class KotlinCompileContext(val jpsContext: CompileContext) {
|
||||
val isInstrumentationEnabled: Boolean by lazy {
|
||||
val value = System.getProperty("kotlin.jps.instrument.bytecode")?.toBoolean() ?: false
|
||||
if (value) {
|
||||
val message = "Experimental bytecode instrumentation for Kotlin classes is enabled"
|
||||
val message = KotlinJpsBundle.message("compiler.text.experimental.bytecode.instrumentation.for.kotlin.classes.is.enabled")
|
||||
jpsContext.processMessage(CompilerMessage(KOTLIN_COMPILER_NAME, BuildMessage.Kind.INFO, message))
|
||||
}
|
||||
value
|
||||
@@ -126,7 +127,7 @@ class KotlinCompileContext(val jpsContext: CompileContext) {
|
||||
jpsContext.processMessage(
|
||||
CompilerMessage(
|
||||
"Kotlin", BuildMessage.Kind.WARNING,
|
||||
"Incremental caches are corrupted. All Kotlin code will be rebuilt."
|
||||
KotlinJpsBundle.message("compiler.text.incremental.caches.are.corrupted.all.kotlin.code.will.be.rebuilt")
|
||||
)
|
||||
)
|
||||
KotlinBuilder.LOG.info(Error("Lookup storage is corrupted, probe failed: ${e.message}", e))
|
||||
@@ -286,11 +287,9 @@ class KotlinCompileContext(val jpsContext: CompileContext) {
|
||||
|
||||
val msg =
|
||||
if (kind == null) {
|
||||
"$presentableChunksListString is not yet supported in IDEA internal build system. " +
|
||||
"Please use Gradle to build them (enable 'Delegate IDE build/run actions to Gradle' in Settings)."
|
||||
KotlinJpsBundle.message("compiler.text.0.is.not.yet.supported.in.idea.internal.build.system.please.use.gradle.to.build.them.enable.delegate.ide.build.run.actions.to.gradle.in.settings", presentableChunksListString)
|
||||
} else {
|
||||
"$kind is not yet supported in IDEA internal build system. " +
|
||||
"Please use Gradle to build $presentableChunksListString (enable 'Delegate IDE build/run actions to Gradle' in Settings)."
|
||||
KotlinJpsBundle.message("compiler.text.0.is.not.yet.supported.in.idea.internal.build.system.please.use.gradle.to.build.1.enable.delegate.ide.build.run.actions.to.gradle.in.settings", kind, presentableChunksListString)
|
||||
}
|
||||
|
||||
testingLogger?.addCustomMessage(msg)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.jps.build
|
||||
|
||||
import org.jetbrains.annotations.Nls
|
||||
import org.jetbrains.jps.incremental.CompileContext
|
||||
import org.jetbrains.jps.incremental.messages.BuildMessage
|
||||
import org.jetbrains.jps.incremental.messages.CompilerMessage
|
||||
@@ -21,7 +22,7 @@ class MessageCollectorAdapter(
|
||||
) : MessageCollector {
|
||||
private var hasErrors = false
|
||||
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
|
||||
override fun report(severity: CompilerMessageSeverity, @Nls message: String, location: CompilerMessageSourceLocation?) {
|
||||
hasErrors = hasErrors || severity.isError
|
||||
|
||||
var prefix = ""
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.jetbrains.jps.incremental.CompileContext
|
||||
import org.jetbrains.jps.incremental.messages.CompilerMessage
|
||||
|
||||
fun jpsReportInternalBuilderError(context: CompileContext, error: Throwable) {
|
||||
@Suppress("HardCodedStringLiteral")
|
||||
val builderError = CompilerMessage.createInternalBuilderError("Kotlin", error)
|
||||
context.processMessage(builderError)
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.incremental.ChangesCollector
|
||||
import org.jetbrains.kotlin.incremental.ExpectActualTrackerImpl
|
||||
import org.jetbrains.kotlin.incremental.components.ExpectActualTracker
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.jps.KotlinJpsBundle
|
||||
import org.jetbrains.kotlin.jps.build.*
|
||||
import org.jetbrains.kotlin.jps.incremental.CacheAttributesDiff
|
||||
import org.jetbrains.kotlin.jps.incremental.JpsIncrementalCache
|
||||
@@ -102,7 +103,7 @@ abstract class KotlinModuleBuildTarget<BuildMetaInfoType : BuildMetaInfo> intern
|
||||
val explicitOutputDir = explicitOutputPath?.let { File(it).absoluteFile.parentFile }
|
||||
return@lazy explicitOutputDir
|
||||
?: jpsModuleBuildTarget.outputDir
|
||||
?: throw ProjectBuildException("No output directory found for " + this)
|
||||
?: throw ProjectBuildException(KotlinJpsBundle.message("error.message.no.output.directory.found.for.0", this))
|
||||
}
|
||||
|
||||
val friendBuildTargets: List<KotlinModuleBuildTarget<*>>
|
||||
|
||||
Reference in New Issue
Block a user