Disable IC when IC cache is missing
Check task build directory for any files
This commit is contained in:
+3
@@ -454,6 +454,9 @@ abstract class BaseGradleIT {
|
|||||||
System.getProperty("maven.repo.local")?.let {
|
System.getProperty("maven.repo.local")?.let {
|
||||||
add("-Dmaven.repo.local=$it") // TODO: proper escaping
|
add("-Dmaven.repo.local=$it") // TODO: proper escaping
|
||||||
}
|
}
|
||||||
|
if (options.withBuildCache) {
|
||||||
|
add("--build-cache")
|
||||||
|
}
|
||||||
addAll(options.freeCommandLineArgs)
|
addAll(options.freeCommandLineArgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+14
-5
@@ -95,8 +95,6 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractKo
|
|||||||
logger.kotlinDebug { "Set $this.incremental=$value" }
|
logger.kotlinDebug { "Set $this.incremental=$value" }
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected fun createCompilerArgs(): T
|
|
||||||
|
|
||||||
@get:Internal
|
@get:Internal
|
||||||
internal val pluginOptions = CompilerPluginOptions()
|
internal val pluginOptions = CompilerPluginOptions()
|
||||||
|
|
||||||
@@ -238,6 +236,11 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractKo
|
|||||||
compilerArgs.pluginClasspaths = pluginClasspath.toTypedArray()
|
compilerArgs.pluginClasspaths = pluginClasspath.toTypedArray()
|
||||||
compilerArgs.pluginOptions = pluginOptions.arguments.toTypedArray()
|
compilerArgs.pluginOptions = pluginOptions.arguments.toTypedArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected fun hasFilesInTaskBuildDirectory(): Boolean {
|
||||||
|
val taskBuildDir = taskBuildDirectory
|
||||||
|
return taskBuildDir.walk().any { it != taskBuildDir && it.isFile }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@CacheableTask
|
@CacheableTask
|
||||||
@@ -341,11 +344,15 @@ open class KotlinCompile : AbstractKotlinCompile<K2JVMCompilerArguments>(), Kotl
|
|||||||
val reporter = GradleICReporter(project.rootProject.projectDir)
|
val reporter = GradleICReporter(project.rootProject.projectDir)
|
||||||
|
|
||||||
val environment = when {
|
val environment = when {
|
||||||
!incremental -> GradleCompilerEnvironment(computedCompilerClasspath, messageCollector, outputItemCollector, args)
|
!incremental ->
|
||||||
|
GradleCompilerEnvironment(computedCompilerClasspath, messageCollector, outputItemCollector, args)
|
||||||
else -> {
|
else -> {
|
||||||
logger.info(USING_INCREMENTAL_COMPILATION_MESSAGE)
|
logger.info(USING_INCREMENTAL_COMPILATION_MESSAGE)
|
||||||
val friendTask = friendTaskName?.let { project.tasks.findByName(it) as? KotlinCompile }
|
val friendTask = friendTaskName?.let { project.tasks.findByName(it) as? KotlinCompile }
|
||||||
GradleIncrementalCompilerEnvironment(computedCompilerClasspath, changedFiles, reporter, taskBuildDirectory,
|
GradleIncrementalCompilerEnvironment(
|
||||||
|
computedCompilerClasspath,
|
||||||
|
if (hasFilesInTaskBuildDirectory()) changedFiles else ChangedFiles.Unknown(),
|
||||||
|
reporter, taskBuildDirectory,
|
||||||
messageCollector, outputItemCollector, args, kaptAnnotationsFileUpdater,
|
messageCollector, outputItemCollector, args, kaptAnnotationsFileUpdater,
|
||||||
artifactDifferenceRegistryProvider,
|
artifactDifferenceRegistryProvider,
|
||||||
artifactFile = artifactFile,
|
artifactFile = artifactFile,
|
||||||
@@ -508,7 +515,9 @@ open class Kotlin2JsCompile() : AbstractKotlinCompile<K2JSCompilerArguments>(),
|
|||||||
incremental -> {
|
incremental -> {
|
||||||
logger.warn(USING_EXPERIMENTAL_JS_INCREMENTAL_COMPILATION_MESSAGE)
|
logger.warn(USING_EXPERIMENTAL_JS_INCREMENTAL_COMPILATION_MESSAGE)
|
||||||
GradleIncrementalCompilerEnvironment(
|
GradleIncrementalCompilerEnvironment(
|
||||||
computedCompilerClasspath, changedFiles, reporter, taskBuildDirectory,
|
computedCompilerClasspath,
|
||||||
|
if (hasFilesInTaskBuildDirectory()) changedFiles else ChangedFiles.Unknown(),
|
||||||
|
reporter, taskBuildDirectory,
|
||||||
messageCollector, outputItemCollector, args)
|
messageCollector, outputItemCollector, args)
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user