[PowerAssert] Integrate with build
^KT-63617 Fixed
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
description = "Kotlin Power-Assert Compiler Plugin"
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
embedded(project(":kotlin-power-assert-compiler-plugin.backend")) { isTransitive = false }
|
||||
embedded(project(":kotlin-power-assert-compiler-plugin.cli")) { isTransitive = false }
|
||||
|
||||
testImplementation(project(":kotlin-power-assert-compiler-plugin.backend"))
|
||||
|
||||
testImplementation(platform(libs.junit.bom))
|
||||
testImplementation(libs.junit.jupiter.api)
|
||||
testRuntimeOnly(libs.junit.jupiter.engine)
|
||||
testImplementation(projectTests(":compiler:tests-common-new"))
|
||||
|
||||
testRuntimeOnly(commonDependency("org.codehaus.woodstox:stax2-api"))
|
||||
testRuntimeOnly(commonDependency("com.fasterxml:aalto-xml"))
|
||||
}
|
||||
|
||||
optInToExperimentalCompilerApi()
|
||||
|
||||
sourceSets {
|
||||
"main" { none() }
|
||||
"test" {
|
||||
projectDefault()
|
||||
generatedTestDir()
|
||||
}
|
||||
}
|
||||
|
||||
publish()
|
||||
|
||||
runtimeJar()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
testsJar()
|
||||
|
||||
projectTest(parallel = true) {
|
||||
dependsOn(":dist")
|
||||
workingDir = rootDir
|
||||
useJUnitPlatform()
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
description = "Kotlin Power-Assert Compiler Plugin (Backend)"
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":compiler:backend"))
|
||||
compileOnly(project(":compiler:ir.backend.common"))
|
||||
compileOnly(project(":compiler:ir.tree"))
|
||||
compileOnly(project(":compiler:cli"))
|
||||
}
|
||||
|
||||
optInToUnsafeDuringIrConstructionAPI()
|
||||
|
||||
sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" { none() }
|
||||
}
|
||||
|
||||
runtimeJar()
|
||||
javadocJar()
|
||||
sourcesJar()
|
||||
+3
-9
@@ -26,7 +26,6 @@ import org.jetbrains.kotlin.backend.jvm.ir.parentClassId
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.backend.js.utils.asString
|
||||
import org.jetbrains.kotlin.ir.builders.irCall
|
||||
import org.jetbrains.kotlin.ir.builders.irString
|
||||
import org.jetbrains.kotlin.ir.builders.parent
|
||||
@@ -36,12 +35,7 @@ import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
|
||||
import org.jetbrains.kotlin.ir.types.*
|
||||
import org.jetbrains.kotlin.ir.util.classId
|
||||
import org.jetbrains.kotlin.ir.util.deepCopyWithSymbols
|
||||
import org.jetbrains.kotlin.ir.util.functions
|
||||
import org.jetbrains.kotlin.ir.util.isFileClass
|
||||
import org.jetbrains.kotlin.ir.util.isFunctionOrKFunction
|
||||
import org.jetbrains.kotlin.ir.util.kotlinFqName
|
||||
import org.jetbrains.kotlin.ir.util.*
|
||||
import org.jetbrains.kotlin.name.CallableId
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
@@ -72,8 +66,8 @@ class PowerAssertCallTransformer(
|
||||
val delegate = delegates.maxByOrNull { it.function.valueParameters.size }
|
||||
if (delegate == null) {
|
||||
val valueTypesTruncated = function.valueParameters.subList(0, function.valueParameters.size - 1)
|
||||
.joinToString("") { it.type.asString() + ", " }
|
||||
val valueTypesAll = function.valueParameters.joinToString("") { it.type.asString() + ", " }
|
||||
.joinToString("") { it.type.render() + ", " }
|
||||
val valueTypesAll = function.valueParameters.joinToString("") { it.type.render() + ", " }
|
||||
messageCollector.warn(
|
||||
expression = expression,
|
||||
message = """
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ fun buildTree(expression: IrExpression): Node? {
|
||||
}
|
||||
|
||||
override fun visitContainerExpression(expression: IrContainerExpression, data: Node) {
|
||||
if (expression.origin is IrStatementOrigin.SAFE_CALL) {
|
||||
if (expression.origin == IrStatementOrigin.SAFE_CALL) {
|
||||
// Null safe expressions can be correctly navigated
|
||||
super.visitContainerExpression(expression, data)
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
description = "Kotlin Power-Assert Compiler Plugin (CLI)"
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":compiler:cli"))
|
||||
|
||||
implementation(project(":kotlin-power-assert-compiler-plugin.backend"))
|
||||
}
|
||||
|
||||
optInToExperimentalCompilerApi()
|
||||
|
||||
sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" { none() }
|
||||
}
|
||||
|
||||
runtimeJar()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.powerassert.PowerAssertCommandLineProcessor
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.powerassert.PowerAssertCompilerPluginRegistrar
|
||||
+1
-3
@@ -19,15 +19,13 @@
|
||||
|
||||
package org.jetbrains.kotlin.powerassert
|
||||
|
||||
import com.google.auto.service.AutoService
|
||||
import org.jetbrains.kotlin.compiler.plugin.AbstractCliOption
|
||||
import org.jetbrains.kotlin.compiler.plugin.CliOption
|
||||
import org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
|
||||
@AutoService(CommandLineProcessor::class)
|
||||
class PowerAssertCommandLineProcessor : CommandLineProcessor {
|
||||
override val pluginId: String = "com.bnorm.kotlin-power-assert"
|
||||
override val pluginId: String = "org.jetbrains.kotlin.powerassert"
|
||||
|
||||
override val pluginOptions: Collection<CliOption> = listOf(
|
||||
CliOption(
|
||||
|
||||
-2
@@ -19,7 +19,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.powerassert
|
||||
|
||||
import com.google.auto.service.AutoService
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
|
||||
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
@@ -30,7 +29,6 @@ import org.jetbrains.kotlin.name.FqName
|
||||
|
||||
val KEY_FUNCTIONS = CompilerConfigurationKey<List<String>>("fully-qualified function names")
|
||||
|
||||
@AutoService(CompilerPluginRegistrar::class)
|
||||
class PowerAssertCompilerPluginRegistrar(
|
||||
private val functions: Set<FqName>,
|
||||
) : CompilerPluginRegistrar() {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
plugins {
|
||||
id("org.jetbrains.kotlin.jvm")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
embedded(project(":kotlin-power-assert-compiler-plugin")) { isTransitive = false }
|
||||
}
|
||||
|
||||
publish {
|
||||
artifactId = artifactId.replace(".", "-")
|
||||
}
|
||||
|
||||
runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
|
||||
sourcesJarWithSourcesFromEmbedded(
|
||||
project(":kotlin-power-assert-compiler-plugin").tasks.named<Jar>("sourcesJar")
|
||||
)
|
||||
javadocJarWithJavadocFromEmbedded(
|
||||
project(":kotlin-power-assert-compiler-plugin").tasks.named<Jar>("javadocJar")
|
||||
)
|
||||
Reference in New Issue
Block a user