Add argument to allow running compiler without sources

`-Xbuild-file` argument allows the compiler to run without
passing any Kotlin source file in arguments.
We have been using this property in
Kotlin Gradle plugin for a few important cases:
1. incremental compilation (to update caches when there are only removed files);
2. for KAPT (Kotlin sources don't make sense in context
of running APs).

We want to stop using `-Xbuild-file` in Kotlin Gradle plugin,
and avoid breaking the Gradle plugin or IC in other build-systems.

This change adds an argument to explicitly run
the compiler without specifying any Kotlin source file.
This commit is contained in:
Alexey Tsvetkov
2019-03-13 15:36:45 +03:00
parent 97d3d38374
commit 0687b8eac3
5 changed files with 11 additions and 5 deletions
@@ -275,6 +275,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
)
var friendPaths: Array<String>? by FreezableVar(null)
@Argument(
value = "-Xallow-no-source-files",
description = "Allow no source files"
)
var allowNoSourceFiles: Boolean by FreezableVar(false)
override fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
val result = super.configureAnalysisFlags(collector)
result[JvmAnalysisFlags.strictMetadataVersionSemantics] = strictMetadataVersionSemantics