Merge pull request #1289 from gildor/KT-18765

Move incremental compilation message from Gradle's warning to info logging level
Issue #KT-18765 Fixed
This commit is contained in:
Sergey Igushkin
2017-10-04 16:52:35 +03:00
committed by GitHub
3 changed files with 24 additions and 2 deletions
@@ -419,7 +419,16 @@ abstract class BaseGradleIT {
private fun Project.createGradleTailParameters(options: BuildOptions, params: Array<out String> = arrayOf()): List<String> =
params.toMutableList().apply {
add("--stacktrace")
add("--${minLogLevel.name.toLowerCase()}")
when (minLogLevel) {
// Do not allow to configure Gradle project with `ERROR` log level (error logs visible on all log levels)
LogLevel.ERROR -> error("Log level ERROR is not supported by Gradle command-line")
// Omit log level argument for default `LIFECYCLE` log level,
// because there is no such command-line option `--lifecycle`
// see https://docs.gradle.org/current/userguide/logging.html#sec:choosing_a_log_level
LogLevel.LIFECYCLE -> Unit
//Command line option for other log levels
else -> add("--${minLogLevel.name.toLowerCase()}")
}
if (options.daemonOptionSupported) {
add(if (options.withDaemon) "--daemon" else "--no-daemon")
}
@@ -262,6 +262,19 @@ class KotlinGradleIT: BaseGradleIT() {
}
}
@Test
fun testIncrementalCompilationLogLevel() {
val infoProject = Project("kotlinProject", GRADLE_VERSION, minLogLevel = LogLevel.INFO)
infoProject.build("build") {
assertContains(USING_INCREMENTAL_COMPILATION_MESSAGE)
}
val lifecycleProject = Project("kotlinProject", GRADLE_VERSION, minLogLevel = LogLevel.LIFECYCLE)
lifecycleProject.build("build") {
assertNotContains(USING_INCREMENTAL_COMPILATION_MESSAGE)
}
}
@Test
fun testConvertJavaToKotlin() {
val project = Project("convertBetweenJavaAndKotlin", GRADLE_VERSION)
@@ -316,7 +316,7 @@ open class KotlinCompile : AbstractKotlinCompile<K2JVMCompilerArguments>(), Kotl
val environment = when {
!incremental -> GradleCompilerEnvironment(computedCompilerClasspath, messageCollector, outputItemCollector, args)
else -> {
logger.warn(USING_INCREMENTAL_COMPILATION_MESSAGE)
logger.info(USING_INCREMENTAL_COMPILATION_MESSAGE)
val friendTask = friendTaskName?.let { project.tasks.findByName(it) as? KotlinCompile }
GradleIncrementalCompilerEnvironment(computedCompilerClasspath, changedFiles, reporter, taskBuildDirectory,
messageCollector, outputItemCollector, args, kaptAnnotationsFileUpdater,