[Gradle] Introduce 'kotlin.internal.compiler.arguments.log.level' property
This property allows changing log level for message printing the final set of compiler arguments used to run compilation. Possible levels are 'error', 'warning', 'info', 'debug'. Default level is 'debug'. ^KT-60733 Fixed
This commit is contained in:
committed by
Space Team
parent
03ed1d1d31
commit
a20f21f76f
+11
-58
@@ -100,7 +100,7 @@ internal class CompilerOptionsIT : KGPBaseTest() {
|
||||
""".trimMargin()
|
||||
)
|
||||
|
||||
build("assemble", buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)) {
|
||||
build("assemble") {
|
||||
assertOutputContainsExactlyTimes("-P plugin:blah-blah:", 3)
|
||||
}
|
||||
}
|
||||
@@ -138,7 +138,7 @@ internal class CompilerOptionsIT : KGPBaseTest() {
|
||||
"compileKotlinJs",
|
||||
// we do not allow modifying free args for K/N at execution time
|
||||
)
|
||||
build(*compileTasks.toTypedArray(), buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)) {
|
||||
build(*compileTasks.toTypedArray()) {
|
||||
assertOutputContainsExactlyTimes("-P plugin:blah-blah:", 3 * compileTasks.size) // 3 times per task
|
||||
}
|
||||
}
|
||||
@@ -151,7 +151,6 @@ internal class CompilerOptionsIT : KGPBaseTest() {
|
||||
project(
|
||||
projectName = "simpleProject",
|
||||
gradleVersion = gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)
|
||||
) {
|
||||
buildGradle.appendText(
|
||||
"""
|
||||
@@ -163,18 +162,8 @@ internal class CompilerOptionsIT : KGPBaseTest() {
|
||||
)
|
||||
|
||||
build("compileKotlin") {
|
||||
val compilerArgs = output
|
||||
.lineSequence()
|
||||
.first {
|
||||
it.contains("Kotlin compiler args:")
|
||||
}
|
||||
.substringAfter("Kotlin compiler args:")
|
||||
|
||||
val expectedOptIn = "-opt-in kotlin.RequiresOptIn,my.CustomOptIn"
|
||||
assert(compilerArgs.contains(expectedOptIn)) {
|
||||
printBuildOutput()
|
||||
"compiler arguments does not contain '$expectedOptIn' - actual value: $compilerArgs"
|
||||
}
|
||||
assertCompilerArgument(":compileKotlin", expectedOptIn, logLevel = LogLevel.INFO)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,7 +175,6 @@ internal class CompilerOptionsIT : KGPBaseTest() {
|
||||
project(
|
||||
projectName = "new-mpp-lib-and-app/sample-lib",
|
||||
gradleVersion = gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)
|
||||
) {
|
||||
buildGradle.appendText(
|
||||
//language=Groovy
|
||||
@@ -208,10 +196,11 @@ internal class CompilerOptionsIT : KGPBaseTest() {
|
||||
|
||||
build("compileKotlinJvm6") {
|
||||
assertTasksExecuted(":compileKotlinJvm6")
|
||||
assert(output.contains("-opt-in my.custom.OptInAnnotation,another.custom.UnderOptIn")) {
|
||||
printBuildOutput()
|
||||
"Output does not contain '-opt-in my.custom.OptInAnnotation,another.custom.UnderOptIn'!"
|
||||
}
|
||||
assertCompilerArgument(
|
||||
":compileKotlinJvm6",
|
||||
"-opt-in my.custom.OptInAnnotation,another.custom.UnderOptIn",
|
||||
logLevel = LogLevel.INFO
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,7 +298,6 @@ internal class CompilerOptionsIT : KGPBaseTest() {
|
||||
project(
|
||||
projectName = "simpleProject",
|
||||
gradleVersion = gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)
|
||||
) {
|
||||
buildGradle.appendText(
|
||||
//language=Groovy
|
||||
@@ -322,18 +310,7 @@ internal class CompilerOptionsIT : KGPBaseTest() {
|
||||
)
|
||||
|
||||
build("compileKotlin") {
|
||||
val compilerArgs = output
|
||||
.lineSequence()
|
||||
.first {
|
||||
it.contains("Kotlin compiler args:")
|
||||
}
|
||||
.substringAfter("Kotlin compiler args:")
|
||||
|
||||
val expectedArg = "-progressive"
|
||||
assert(compilerArgs.contains(expectedArg)) {
|
||||
printBuildOutput()
|
||||
"compiler arguments does not contain '$expectedArg' - actual value: $compilerArgs"
|
||||
}
|
||||
assertCompilerArgument(":compileKotlin", "-progressive", logLevel = LogLevel.INFO)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -345,21 +322,9 @@ internal class CompilerOptionsIT : KGPBaseTest() {
|
||||
project(
|
||||
projectName = "simpleProject",
|
||||
gradleVersion = gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)
|
||||
) {
|
||||
build("compileKotlin") {
|
||||
val compilerArgs = output
|
||||
.lineSequence()
|
||||
.first {
|
||||
it.contains("Kotlin compiler args:")
|
||||
}
|
||||
.substringAfter("Kotlin compiler args:")
|
||||
|
||||
val expectedArg = "-progressive"
|
||||
assert(!compilerArgs.contains(expectedArg)) {
|
||||
printBuildOutput()
|
||||
"compiler arguments contains '$expectedArg' - actual value: $compilerArgs"
|
||||
}
|
||||
assertNoCompilerArgument(":compileKotlin", "-progressive", logLevel = LogLevel.INFO)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -371,7 +336,6 @@ internal class CompilerOptionsIT : KGPBaseTest() {
|
||||
project(
|
||||
projectName = "simpleProject",
|
||||
gradleVersion = gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)
|
||||
) {
|
||||
buildGradle.appendText(
|
||||
//language=Groovy
|
||||
@@ -386,18 +350,7 @@ internal class CompilerOptionsIT : KGPBaseTest() {
|
||||
)
|
||||
|
||||
build("compileKotlin") {
|
||||
val compilerArgs = output
|
||||
.lineSequence()
|
||||
.first {
|
||||
it.contains("Kotlin compiler args:")
|
||||
}
|
||||
.substringAfter("Kotlin compiler args:")
|
||||
|
||||
val expectedArg = "-progressive"
|
||||
assert(compilerArgs.contains(expectedArg)) {
|
||||
printBuildOutput()
|
||||
"compiler arguments does not contain '$expectedArg' - actual value: $compilerArgs"
|
||||
}
|
||||
assertCompilerArgument(":compileKotlin", "-progressive", logLevel = LogLevel.INFO)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+54
-99
@@ -22,7 +22,6 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
project(
|
||||
projectName = "simpleProject",
|
||||
gradleVersion = gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)
|
||||
) {
|
||||
buildGradle.appendText(
|
||||
//language=Groovy
|
||||
@@ -40,18 +39,8 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
build("compileKotlin") {
|
||||
assertTasksExecuted(":compileKotlin")
|
||||
|
||||
val compilationArgs = output.lineSequence().first { it.contains("Kotlin compiler args:") }
|
||||
|
||||
assert(compilationArgs.contains("-java-parameters")) {
|
||||
printBuildOutput()
|
||||
"Compiler arguments does not contain '-progressive': $compilationArgs"
|
||||
}
|
||||
|
||||
// '-verbose' by default will be set to 'true' by debug log level
|
||||
assert(!compilationArgs.contains("-verbose")) {
|
||||
printBuildOutput()
|
||||
"Compiler arguments contains '-verbose': $compilationArgs"
|
||||
}
|
||||
assertCompilerArguments(":compileKotlin", "-java-parameters", logLevel = LogLevel.INFO)
|
||||
assertNoCompilerArgument(":compileKotlin", "-verbose", logLevel = LogLevel.INFO)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,7 +52,6 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
project(
|
||||
"simpleProject",
|
||||
gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)
|
||||
) {
|
||||
buildGradle.appendText(
|
||||
//language=Groovy
|
||||
@@ -85,19 +73,8 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
|
||||
build("compileKotlin") {
|
||||
assertTasksExecuted(":compileKotlin")
|
||||
|
||||
val compilationArgs = output.lineSequence().first { it.contains("Kotlin compiler args:") }
|
||||
|
||||
assert(compilationArgs.contains("-java-parameters")) {
|
||||
printBuildOutput()
|
||||
"Compiler arguments does not contain '-progressive': $compilationArgs"
|
||||
}
|
||||
|
||||
// '-verbose' by default will be set to 'true' by debug log level
|
||||
assert(!compilationArgs.contains("-verbose")) {
|
||||
printBuildOutput()
|
||||
"Compiler arguments contains '-verbose': $compilationArgs"
|
||||
}
|
||||
assertCompilerArgument(":compileKotlin", "-java-parameters", logLevel = LogLevel.INFO)
|
||||
assertNoCompilerArgument(":compileKotlin", "-verbose", logLevel = LogLevel.INFO)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,7 +86,6 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
project(
|
||||
projectName = "simpleProject",
|
||||
gradleVersion = gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)
|
||||
) {
|
||||
buildGradle.appendText(
|
||||
//language=Groovy
|
||||
@@ -130,32 +106,11 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
build("compileKotlin") {
|
||||
assertTasksExecuted(":compileKotlin")
|
||||
|
||||
val compilationArgs = output.lineSequence().first { it.contains("Kotlin compiler args:") }
|
||||
|
||||
assert(compilationArgs.contains("-language-version 2.0")) {
|
||||
printBuildOutput()
|
||||
"Compiler arguments does not contain '-language-version 2.0': $compilationArgs"
|
||||
}
|
||||
|
||||
assert(compilationArgs.contains("-api-version 2.0")) {
|
||||
printBuildOutput()
|
||||
"Compiler arguments does not contain '-api-version 2.0': $compilationArgs"
|
||||
}
|
||||
|
||||
assert(compilationArgs.contains("-progressive")) {
|
||||
printBuildOutput()
|
||||
"Compiler arguments does not contain '-progressive': $compilationArgs"
|
||||
}
|
||||
|
||||
assert(compilationArgs.contains("-opt-in my.custom.OptInAnnotation")) {
|
||||
printBuildOutput()
|
||||
"Compiler arguments does not contain '-opt-in my.custom.OptInAnnotation': $compilationArgs"
|
||||
}
|
||||
|
||||
assert(compilationArgs.contains("-Xdebug")) {
|
||||
printBuildOutput()
|
||||
"Compiler arguments does not contain '-Xdebug': $compilationArgs"
|
||||
}
|
||||
assertCompilerArguments(
|
||||
":compileKotlin",
|
||||
"-language-version 2.0", "-api-version 2.0", "-progressive", "-opt-in my.custom.OptInAnnotation", "-Xdebug",
|
||||
logLevel = LogLevel.INFO
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,7 +122,6 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
project(
|
||||
projectName = "simpleProject",
|
||||
gradleVersion = gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)
|
||||
) {
|
||||
buildGradle.appendText(
|
||||
//language=Groovy
|
||||
@@ -204,10 +158,11 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
"-api-version 1.9",
|
||||
"-Xdebug",
|
||||
"-opt-in my.custom.OptInAnnotation,another.CustomOptInAnnotation",
|
||||
"-XXLanguage:+UnitConversionsOnArbitraryExpressions"
|
||||
"-XXLanguage:+UnitConversionsOnArbitraryExpressions",
|
||||
logLevel = LogLevel.INFO
|
||||
)
|
||||
|
||||
assertNoCompilerArgument(":compileKotlin", "-progressive")
|
||||
assertNoCompilerArgument(":compileKotlin", "-progressive", logLevel = LogLevel.INFO)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -219,7 +174,6 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
project(
|
||||
projectName = "simpleProject",
|
||||
gradleVersion = gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)
|
||||
) {
|
||||
buildGradle.appendText(
|
||||
//language=Groovy
|
||||
@@ -239,13 +193,7 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
assertOutputDoesNotContain(
|
||||
"w: :compileKotlin 'KotlinJvmCompile.moduleName' is deprecated, please migrate to 'compilerOptions.moduleName'!"
|
||||
)
|
||||
|
||||
val compilationArgs = output.lineSequence().first { it.contains("Kotlin compiler args:") }
|
||||
|
||||
assert(compilationArgs.contains("-module-name customModule")) {
|
||||
printBuildOutput()
|
||||
"Compiler arguments does not contain '-module-name customModule': $compilationArgs"
|
||||
}
|
||||
assertCompilerArgument(":compileKotlin", "-module-name customModule", logLevel = LogLevel.INFO)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -262,7 +210,7 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
"AndroidSimpleApp",
|
||||
gradleVersion,
|
||||
buildJdk = jdk.location,
|
||||
buildOptions = defaultBuildOptions.copy(androidVersion = agpVersion, logLevel = LogLevel.DEBUG)
|
||||
buildOptions = defaultBuildOptions.copy(androidVersion = agpVersion)
|
||||
) {
|
||||
buildGradle.appendText(
|
||||
//language=Groovy
|
||||
@@ -283,18 +231,11 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
assertOutputDoesNotContain(
|
||||
"w: :compileKotlin 'KotlinJvmCompile.moduleName' is deprecated, please migrate to 'compilerOptions.moduleName'!"
|
||||
)
|
||||
|
||||
val compilationArgs = output.lineSequence().first { it.contains("Kotlin compiler args:") }
|
||||
|
||||
assert(compilationArgs.contains("-java-parameters")) {
|
||||
printBuildOutput()
|
||||
"Compiler arguments does not contain '-java-parameters': $compilationArgs"
|
||||
}
|
||||
|
||||
assert(compilationArgs.contains("-module-name my_app_debug")) {
|
||||
printBuildOutput()
|
||||
"Compiler arguments does not contain '-module-name my_app_debug': $compilationArgs"
|
||||
}
|
||||
assertCompilerArguments(
|
||||
":compileDebugKotlin",
|
||||
"-java-parameters", "-module-name my_app_debug",
|
||||
logLevel = LogLevel.INFO
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -312,7 +253,7 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
"AndroidSimpleApp",
|
||||
gradleVersion,
|
||||
buildJdk = jdk.location,
|
||||
buildOptions = defaultBuildOptions.copy(androidVersion = agpVersion, logLevel = LogLevel.DEBUG)
|
||||
buildOptions = defaultBuildOptions.copy(androidVersion = agpVersion)
|
||||
) {
|
||||
buildGradle.appendText(
|
||||
//language=Groovy
|
||||
@@ -342,7 +283,8 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
assertCompilerArguments(
|
||||
":compileDebugKotlin",
|
||||
"-java-parameters",
|
||||
"-module-name my_app_debug"
|
||||
"-module-name my_app_debug",
|
||||
logLevel = LogLevel.INFO
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -361,7 +303,6 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(
|
||||
androidVersion = agpVersion,
|
||||
logLevel = LogLevel.DEBUG
|
||||
),
|
||||
buildJdk = jdk.location
|
||||
) {
|
||||
@@ -394,8 +335,16 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
build(":libAndroid:compileDebugKotlin") {
|
||||
assertTasksExecuted(":libAndroid:compileDebugKotlin")
|
||||
|
||||
assertCompilerArgument(":libAndroid:compileDebugKotlin", "-progressive")
|
||||
assertCompilerArgument(":libAndroid:compileDebugKotlin", "-opt-in=com.example.roo.requiresOpt.FunTests")
|
||||
assertCompilerArgument(
|
||||
":libAndroid:compileDebugKotlin",
|
||||
"-progressive",
|
||||
logLevel = LogLevel.INFO
|
||||
)
|
||||
assertCompilerArgument(
|
||||
":libAndroid:compileDebugKotlin",
|
||||
"-opt-in=com.example.roo.requiresOpt.FunTests",
|
||||
logLevel = LogLevel.INFO
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -407,7 +356,6 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
project(
|
||||
projectName = "simpleProject",
|
||||
gradleVersion = gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)
|
||||
) {
|
||||
buildGradle.appendText(
|
||||
//language=Groovy
|
||||
@@ -431,13 +379,7 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
assertOutputContains(
|
||||
"w: :compileKotlin 'KotlinJvmCompile.moduleName' is deprecated, please migrate to 'compilerOptions.moduleName'!"
|
||||
)
|
||||
|
||||
val compilationArgs = output.lineSequence().first { it.contains("Kotlin compiler args:") }
|
||||
|
||||
assert(compilationArgs.contains("-module-name otherCustomModuleName")) {
|
||||
printBuildOutput()
|
||||
"Compiler arguments does not contain '-module-name otherCustomModuleName': $compilationArgs"
|
||||
}
|
||||
assertCompilerArgument(":compileKotlin", "-module-name otherCustomModuleName", logLevel = LogLevel.INFO)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -454,7 +396,7 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
project(
|
||||
"multiplatformAndroidSourceSetLayout2",
|
||||
gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(androidVersion = agpVersion, logLevel = LogLevel.DEBUG),
|
||||
buildOptions = defaultBuildOptions.copy(androidVersion = agpVersion),
|
||||
buildJdk = jdk.location
|
||||
) {
|
||||
buildGradleKts.appendText(
|
||||
@@ -474,7 +416,11 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
build(":compileGermanFreeDebugKotlinAndroid") {
|
||||
assertTasksExecuted(":compileGermanFreeDebugKotlinAndroid")
|
||||
|
||||
assertCompilerArgument(":compileGermanFreeDebugKotlinAndroid", "-module-name last-chance")
|
||||
assertCompilerArgument(
|
||||
":compileGermanFreeDebugKotlinAndroid",
|
||||
"-module-name last-chance",
|
||||
logLevel = LogLevel.INFO
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -487,7 +433,6 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
project(
|
||||
projectName = "mpp-default-hierarchy",
|
||||
gradleVersion = gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)
|
||||
) {
|
||||
buildGradle.modify {
|
||||
it.substringBefore("kotlin {") +
|
||||
@@ -530,7 +475,11 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
}
|
||||
|
||||
build(":compileCommonMainKotlinMetadata") {
|
||||
assertCompilerArguments(":compileCommonMainKotlinMetadata", "-language-version 1.7", "-api-version 1.7")
|
||||
assertCompilerArguments(
|
||||
":compileCommonMainKotlinMetadata",
|
||||
"-language-version 1.7", "-api-version 1.7",
|
||||
logLevel = LogLevel.INFO
|
||||
)
|
||||
}
|
||||
|
||||
build(":compileKotlinJvm") {
|
||||
@@ -539,12 +488,17 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
"-language-version 1.8",
|
||||
"-api-version 1.8",
|
||||
"-java-parameters",
|
||||
"-jvm-target 11"
|
||||
"-jvm-target 11",
|
||||
logLevel = LogLevel.INFO
|
||||
)
|
||||
}
|
||||
|
||||
build(":compileKotlinJs") {
|
||||
assertCompilerArguments(":compileKotlinJs", "-language-version 2.0", "-api-version 2.0", "-Xfriend-modules-disabled")
|
||||
assertCompilerArguments(
|
||||
":compileKotlinJs",
|
||||
"-language-version 2.0", "-api-version 2.0", "-Xfriend-modules-disabled",
|
||||
logLevel = LogLevel.INFO
|
||||
)
|
||||
}
|
||||
|
||||
build(":compileKotlinLinuxX64") {
|
||||
@@ -570,7 +524,7 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
project(
|
||||
projectName = "multiplatformAndroidSourceSetLayout2",
|
||||
gradleVersion = gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG , androidVersion = agpVersion),
|
||||
buildOptions = defaultBuildOptions.copy(androidVersion = agpVersion),
|
||||
buildJdk = jdk.location
|
||||
) {
|
||||
buildGradleKts.appendText(
|
||||
@@ -591,7 +545,8 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
build(":compileGermanFreeDebugKotlinAndroid") {
|
||||
assertCompilerArguments(
|
||||
":compileGermanFreeDebugKotlinAndroid",
|
||||
"-module-name my-custom-module_germanFreeDebug"
|
||||
"-module-name my-custom-module_germanFreeDebug",
|
||||
logLevel = LogLevel.INFO
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -15,6 +15,9 @@ import kotlin.io.path.writeText
|
||||
|
||||
@MppGradlePluginTests
|
||||
class MppDiagnosticsIt : KGPBaseTest() {
|
||||
override val defaultBuildOptions: BuildOptions
|
||||
get() = super.defaultBuildOptions.copy(compilerArgumentsLogLevel = null)
|
||||
|
||||
@GradleTest
|
||||
fun testDiagnosticsRenderingSmoke(gradleVersion: GradleVersion) {
|
||||
project("diagnosticsRenderingSmoke", gradleVersion) {
|
||||
|
||||
+5
@@ -54,6 +54,7 @@ data class BuildOptions(
|
||||
val runViaBuildToolsApi: Boolean? = null,
|
||||
val konanDataDir: Path? = konanDir, // null can be used only if you are using custom 'kotlin.native.home' or 'org.jetbrains.kotlin.native.home' property instead of konanDir
|
||||
val kotlinUserHome: Path? = testKitDir.resolve(".kotlin"),
|
||||
val compilerArgumentsLogLevel: String? = "info"
|
||||
) {
|
||||
val isK2ByDefault
|
||||
get() = KotlinVersion.DEFAULT >= KotlinVersion.KOTLIN_2_0
|
||||
@@ -222,6 +223,10 @@ data class BuildOptions(
|
||||
arguments.add("-Pkotlin.user.home=${kotlinUserHome.absolutePathString()}")
|
||||
}
|
||||
|
||||
if (compilerArgumentsLogLevel != null) {
|
||||
arguments.add("-Pkotlin.internal.compiler.arguments.log.level=$compilerArgumentsLogLevel")
|
||||
}
|
||||
|
||||
arguments.addAll(freeArgs)
|
||||
|
||||
return arguments.toList()
|
||||
|
||||
+6
-3
@@ -249,8 +249,9 @@ fun findParameterInOutput(name: String, output: String): String? =
|
||||
fun BuildResult.assertCompilerArgument(
|
||||
taskPath: String,
|
||||
expectedArgument: String,
|
||||
logLevel: LogLevel = LogLevel.DEBUG
|
||||
) {
|
||||
val taskOutput = getOutputForTask(taskPath)
|
||||
val taskOutput = getOutputForTask(taskPath, logLevel)
|
||||
val compilerArguments = taskOutput.lines().first {
|
||||
it.contains("Kotlin compiler args:")
|
||||
}.substringAfter("Kotlin compiler args:")
|
||||
@@ -280,8 +281,9 @@ fun BuildResult.assertNativeTasksClasspath(
|
||||
fun BuildResult.assertCompilerArguments(
|
||||
taskPath: String,
|
||||
vararg expectedArguments: String,
|
||||
logLevel: LogLevel = LogLevel.DEBUG,
|
||||
) {
|
||||
val taskOutput = getOutputForTask(taskPath)
|
||||
val taskOutput = getOutputForTask(taskPath, logLevel)
|
||||
val compilerArguments = taskOutput.lines().first {
|
||||
it.contains("Kotlin compiler args:")
|
||||
}.substringAfter("Kotlin compiler args:")
|
||||
@@ -301,8 +303,9 @@ fun BuildResult.assertCompilerArguments(
|
||||
fun BuildResult.assertNoCompilerArgument(
|
||||
taskPath: String,
|
||||
notExpectedArgument: String,
|
||||
logLevel: LogLevel = LogLevel.DEBUG,
|
||||
) {
|
||||
val taskOutput = getOutputForTask(taskPath)
|
||||
val taskOutput = getOutputForTask(taskPath, logLevel)
|
||||
val compilerArguments = taskOutput.lines().first {
|
||||
it.contains("Kotlin compiler args:")
|
||||
}.substringAfter("Kotlin compiler args:")
|
||||
|
||||
Reference in New Issue
Block a user