[Gradle, JS] Fix K/JS project build with configuration cache enabled
KT-42494 Fixed
This commit is contained in:
+3
@@ -15,9 +15,11 @@ import java.io.File
|
|||||||
|
|
||||||
abstract class DukatTask(
|
abstract class DukatTask(
|
||||||
@Internal
|
@Internal
|
||||||
|
@Transient
|
||||||
override val compilation: KotlinJsCompilation
|
override val compilation: KotlinJsCompilation
|
||||||
) : DefaultTask(), RequiresNpmDependencies {
|
) : DefaultTask(), RequiresNpmDependencies {
|
||||||
@get:Internal
|
@get:Internal
|
||||||
|
@Transient
|
||||||
protected val nodeJs = NodeJsRootPlugin.apply(project.rootProject)
|
protected val nodeJs = NodeJsRootPlugin.apply(project.rootProject)
|
||||||
|
|
||||||
@get:Internal
|
@get:Internal
|
||||||
@@ -35,6 +37,7 @@ abstract class DukatTask(
|
|||||||
var externalsOutputFormat: ExternalsOutputFormat = ExternalsOutputFormat.SOURCE
|
var externalsOutputFormat: ExternalsOutputFormat = ExternalsOutputFormat.SOURCE
|
||||||
|
|
||||||
@get:Internal
|
@get:Internal
|
||||||
|
@delegate:Transient
|
||||||
val dts by lazy {
|
val dts by lazy {
|
||||||
val resolvedCompilation = nodeJs.npmResolutionManager.requireInstalled()[project][compilation]
|
val resolvedCompilation = nodeJs.npmResolutionManager.requireInstalled()[project][compilation]
|
||||||
val dtsResolver = DtsResolver(resolvedCompilation.npmProject)
|
val dtsResolver = DtsResolver(resolvedCompilation.npmProject)
|
||||||
|
|||||||
+1
@@ -24,6 +24,7 @@ constructor(
|
|||||||
override val destinationDir: File
|
override val destinationDir: File
|
||||||
get() = compilation.npmProject.externalsDir
|
get() = compilation.npmProject.externalsDir
|
||||||
|
|
||||||
|
@delegate:Transient
|
||||||
private val executor by lazy {
|
private val executor by lazy {
|
||||||
DukatExecutor(
|
DukatExecutor(
|
||||||
nodeJs,
|
nodeJs,
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,6 @@ import org.gradle.api.tasks.Nested
|
|||||||
import org.gradle.api.tasks.OutputFile
|
import org.gradle.api.tasks.OutputFile
|
||||||
import org.gradle.api.tasks.TaskAction
|
import org.gradle.api.tasks.TaskAction
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJsCompilation
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJsCompilation
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.ir.GENERATE_D_TS
|
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrCompilation
|
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrCompilation
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.npm.NpmProject.Companion.PACKAGE_JSON
|
import org.jetbrains.kotlin.gradle.targets.js.npm.NpmProject.Companion.PACKAGE_JSON
|
||||||
import org.jetbrains.kotlin.gradle.utils.property
|
import org.jetbrains.kotlin.gradle.utils.property
|
||||||
@@ -21,6 +20,7 @@ import javax.inject.Inject
|
|||||||
open class PublicPackageJsonTask
|
open class PublicPackageJsonTask
|
||||||
@Inject
|
@Inject
|
||||||
constructor(
|
constructor(
|
||||||
|
@Transient
|
||||||
private val compilation: KotlinJsCompilation
|
private val compilation: KotlinJsCompilation
|
||||||
) : DefaultTask() {
|
) : DefaultTask() {
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -24,7 +24,8 @@ open class KotlinNpmInstallTask : DefaultTask() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val nodeJs get() = NodeJsRootPlugin.apply(project.rootProject)
|
@Transient
|
||||||
|
private val nodeJs = NodeJsRootPlugin.apply(project.rootProject)
|
||||||
private val resolutionManager get() = nodeJs.npmResolutionManager
|
private val resolutionManager get() = nodeJs.npmResolutionManager
|
||||||
|
|
||||||
@Input
|
@Input
|
||||||
|
|||||||
+3
@@ -21,7 +21,10 @@ import org.jetbrains.kotlin.gradle.tasks.registerTask
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
open class KotlinPackageJsonTask : DefaultTask() {
|
open class KotlinPackageJsonTask : DefaultTask() {
|
||||||
|
@Transient
|
||||||
private lateinit var nodeJs: NodeJsRootExtension
|
private lateinit var nodeJs: NodeJsRootExtension
|
||||||
|
|
||||||
|
@Transient
|
||||||
private lateinit var compilation: KotlinJsCompilation
|
private lateinit var compilation: KotlinJsCompilation
|
||||||
|
|
||||||
private val compilationResolver
|
private val compilationResolver
|
||||||
|
|||||||
+2
-1
@@ -21,7 +21,8 @@ open class RootPackageJsonTask : DefaultTask() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val nodeJs get() = NodeJsRootPlugin.apply(project.rootProject)
|
@Transient
|
||||||
|
private val nodeJs = NodeJsRootPlugin.apply(project.rootProject)
|
||||||
private val resolutionManager get() = nodeJs.npmResolutionManager
|
private val resolutionManager get() = nodeJs.npmResolutionManager
|
||||||
|
|
||||||
@get:OutputFile
|
@get:OutputFile
|
||||||
|
|||||||
+2
@@ -35,8 +35,10 @@ open class KotlinWebpack
|
|||||||
@Inject
|
@Inject
|
||||||
constructor(
|
constructor(
|
||||||
@Internal
|
@Internal
|
||||||
|
@Transient
|
||||||
override val compilation: KotlinJsCompilation
|
override val compilation: KotlinJsCompilation
|
||||||
) : DefaultTask(), RequiresNpmDependencies {
|
) : DefaultTask(), RequiresNpmDependencies {
|
||||||
|
@Transient
|
||||||
private val nodeJs = NodeJsRootPlugin.apply(project.rootProject)
|
private val nodeJs = NodeJsRootPlugin.apply(project.rootProject)
|
||||||
private val versions = nodeJs.versions
|
private val versions = nodeJs.versions
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -40,6 +40,9 @@ open class KotlinJsDce : AbstractKotlinCompileTool<K2JSDceArguments>(), KotlinJs
|
|||||||
cacheOnlyIfEnabledForKotlin()
|
cacheOnlyIfEnabledForKotlin()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@get:Internal
|
||||||
|
internal val objects = project.objects
|
||||||
|
|
||||||
override fun localStateDirectories(): FileCollection = project.files()
|
override fun localStateDirectories(): FileCollection = project.files()
|
||||||
|
|
||||||
override fun createCompilerArgs(): K2JSDceArguments = K2JSDceArguments()
|
override fun createCompilerArgs(): K2JSDceArguments = K2JSDceArguments()
|
||||||
@@ -72,7 +75,7 @@ open class KotlinJsDce : AbstractKotlinCompileTool<K2JSDceArguments>(), KotlinJs
|
|||||||
fun performDce() {
|
fun performDce() {
|
||||||
val inputFiles = (listOf(source) + classpath
|
val inputFiles = (listOf(source) + classpath
|
||||||
.filter { !kotlinFilesOnly || isDceCandidate(it) }
|
.filter { !kotlinFilesOnly || isDceCandidate(it) }
|
||||||
.map { project.fileTree(it) })
|
.map { objects.fileCollection().from(it).asFileTree })
|
||||||
.reduce(FileTree::plus)
|
.reduce(FileTree::plus)
|
||||||
.files.map { it.path }
|
.files.map { it.path }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user