Introduce internal property sourceMapBaseDirs for Kotlin2JsCompile

Separate property needed to prevent Gradle snapshotting absolute paths
as inputs when passed as compiler argument.
To reduce property visibility to external users put it to the impl class
which will make it invisible in completion but still usable in Kotlin
build.
This commit is contained in:
Vyacheslav Gerasimov
2020-01-24 20:42:37 +03:00
parent b06645d1c0
commit e4258e528f
2 changed files with 13 additions and 0 deletions
@@ -16,13 +16,19 @@
package org.jetbrains.kotlin.gradle.dsl
import org.gradle.api.file.FileCollection
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
internal class KotlinJsOptionsImpl : KotlinJsOptionsBase() {
override var freeCompilerArgs: List<String> = listOf()
var sourceMapBaseDirs: FileCollection? = null
override fun updateArguments(args: K2JSCompilerArguments) {
super.updateArguments(args)
copyFreeCompilerArgsToArgs(args)
sourceMapBaseDirs?.let {
args.sourceMapBaseDirs = it.asPath
}
}
}
@@ -547,6 +547,13 @@ open class Kotlin2JsCompile : AbstractKotlinCompile<K2JSCompilerArguments>(), Ko
return friendPaths.filter { filter(File(it)) }
}
@Suppress("unused")
@get:InputFiles
@get:Optional
@get:PathSensitive(PathSensitivity.RELATIVE)
internal val sourceMapBaseDirs: FileCollection?
get() = kotlinOptionsImpl.sourceMapBaseDirs
private fun isHybridKotlinJsLibrary(file: File): Boolean =
LibraryUtils.isKotlinJavascriptLibrary(file) && isKotlinLibrary(file)