[Gradle, JS] Fix K/JS project build with configuration cache (part 2)
It is still does not support configuration cache but these changes allows build to pass with warnings #KT-42494 Fixed
This commit is contained in:
-1
@@ -19,7 +19,6 @@ abstract class DukatTask(
|
||||
override val compilation: KotlinJsCompilation
|
||||
) : DefaultTask(), RequiresNpmDependencies {
|
||||
@get:Internal
|
||||
@Transient
|
||||
protected val nodeJs = NodeJsRootPlugin.apply(project.rootProject)
|
||||
|
||||
@get:Internal
|
||||
|
||||
+5
-1
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.gradle.targets.js.yarn.Yarn
|
||||
import org.jetbrains.kotlin.gradle.tasks.internal.CleanableStore
|
||||
import java.io.File
|
||||
|
||||
open class NodeJsRootExtension(val rootProject: Project) : ConfigurationPhaseAware<NodeJsEnv>() {
|
||||
open class NodeJsRootExtension(@Transient val rootProject: Project) : ConfigurationPhaseAware<NodeJsEnv>() {
|
||||
init {
|
||||
check(rootProject.rootProject == rootProject)
|
||||
}
|
||||
@@ -41,6 +41,7 @@ open class NodeJsRootExtension(val rootProject: Project) : ConfigurationPhaseAwa
|
||||
|
||||
var packageManager: NpmApi by Property(Yarn())
|
||||
|
||||
@Transient
|
||||
private val projectProperties = PropertiesProvider(rootProject)
|
||||
|
||||
inner class Experimental {
|
||||
@@ -50,6 +51,7 @@ open class NodeJsRootExtension(val rootProject: Project) : ConfigurationPhaseAwa
|
||||
|
||||
val experimental = Experimental()
|
||||
|
||||
@Transient
|
||||
val taskRequirements = TasksRequirements()
|
||||
|
||||
val nodeJsSetupTaskProvider: TaskProvider<out NodeJsSetupTask>
|
||||
@@ -117,6 +119,8 @@ open class NodeJsRootExtension(val rootProject: Project) : ConfigurationPhaseAwa
|
||||
}
|
||||
|
||||
val versions = NpmVersions()
|
||||
|
||||
@Transient
|
||||
internal val npmResolutionManager = KotlinNpmResolutionManager(this)
|
||||
|
||||
companion object {
|
||||
|
||||
+1
-2
@@ -23,9 +23,8 @@ constructor(
|
||||
@Transient
|
||||
private val compilation: KotlinJsCompilation
|
||||
) : DefaultTask() {
|
||||
|
||||
@Transient
|
||||
private val npmProject = compilation.npmProject
|
||||
|
||||
private val nodeJs = npmProject.nodeJs
|
||||
|
||||
private val compilationResolution
|
||||
|
||||
-1
@@ -24,7 +24,6 @@ open class KotlinNpmInstallTask : DefaultTask() {
|
||||
}
|
||||
}
|
||||
|
||||
@Transient
|
||||
private val nodeJs = NodeJsRootPlugin.apply(project.rootProject)
|
||||
private val resolutionManager get() = nodeJs.npmResolutionManager
|
||||
|
||||
|
||||
-1
@@ -21,7 +21,6 @@ import org.jetbrains.kotlin.gradle.tasks.registerTask
|
||||
import java.io.File
|
||||
|
||||
open class KotlinPackageJsonTask : DefaultTask() {
|
||||
@Transient
|
||||
private lateinit var nodeJs: NodeJsRootExtension
|
||||
|
||||
@Transient
|
||||
|
||||
-1
@@ -21,7 +21,6 @@ open class RootPackageJsonTask : DefaultTask() {
|
||||
}
|
||||
}
|
||||
|
||||
@Transient
|
||||
private val nodeJs = NodeJsRootPlugin.apply(project.rootProject)
|
||||
private val resolutionManager get() = nodeJs.npmResolutionManager
|
||||
|
||||
|
||||
+4
-5
@@ -38,7 +38,6 @@ constructor(
|
||||
@Transient
|
||||
override val compilation: KotlinJsCompilation
|
||||
) : DefaultTask(), RequiresNpmDependencies {
|
||||
@Transient
|
||||
private val nodeJs = NodeJsRootPlugin.apply(project.rootProject)
|
||||
private val versions = nodeJs.versions
|
||||
|
||||
@@ -215,6 +214,8 @@ constructor(
|
||||
override val requiredNpmDependencies: Set<RequiredKotlinJsDependency>
|
||||
@Internal get() = createRunner().config.getRequiredDependencies(versions)
|
||||
|
||||
private val isContinuous = project.gradle.startParameter.isContinuous
|
||||
|
||||
@TaskAction
|
||||
fun doExecute() {
|
||||
nodeJs.npmResolutionManager.checkRequiredDependencies(this)
|
||||
@@ -226,13 +227,11 @@ constructor(
|
||||
return
|
||||
}
|
||||
|
||||
if (project.gradle.startParameter.isContinuous) {
|
||||
val continuousRunner = runner
|
||||
|
||||
if (isContinuous) {
|
||||
val deploymentRegistry = services.get(DeploymentRegistry::class.java)
|
||||
val deploymentHandle = deploymentRegistry.get("webpack", Handle::class.java)
|
||||
if (deploymentHandle == null) {
|
||||
deploymentRegistry.start("webpack", DeploymentRegistry.ChangeBehavior.BLOCK, Handle::class.java, continuousRunner)
|
||||
deploymentRegistry.start("webpack", DeploymentRegistry.ChangeBehavior.BLOCK, Handle::class.java, runner)
|
||||
}
|
||||
} else {
|
||||
runner.copy(
|
||||
|
||||
Reference in New Issue
Block a user