KT-43818:NPM Dependencies already resolved and installed in Android Studio resolve
This commit is contained in:
committed by
Ilya Goncharov
parent
5382e68180
commit
49f2ac3545
+6
-3
@@ -80,11 +80,11 @@ class KotlinNpmResolutionManager(private val nodeJsSettings: NodeJsRootExtension
|
|||||||
private val forceFullResolve: Boolean
|
private val forceFullResolve: Boolean
|
||||||
get() = isInIdeaSync
|
get() = isInIdeaSync
|
||||||
|
|
||||||
|
internal val resolver = KotlinRootNpmResolver(nodeJsSettings, forceFullResolve)
|
||||||
|
|
||||||
@Volatile
|
@Volatile
|
||||||
private var state: ResolutionState =
|
private var state: ResolutionState =
|
||||||
ResolutionState.Configuring(
|
ResolutionState.Configuring(resolver)
|
||||||
KotlinRootNpmResolver(nodeJsSettings, forceFullResolve)
|
|
||||||
)
|
|
||||||
|
|
||||||
internal sealed class ResolutionState {
|
internal sealed class ResolutionState {
|
||||||
abstract val npmProjects: List<NpmProject>
|
abstract val npmProjects: List<NpmProject>
|
||||||
@@ -121,6 +121,9 @@ class KotlinNpmResolutionManager(private val nodeJsSettings: NodeJsRootExtension
|
|||||||
internal fun requireConfiguringState(): KotlinRootNpmResolver =
|
internal fun requireConfiguringState(): KotlinRootNpmResolver =
|
||||||
(this.state as? ResolutionState.Configuring ?: error("NPM Dependencies already resolved and installed")).resolver
|
(this.state as? ResolutionState.Configuring ?: error("NPM Dependencies already resolved and installed")).resolver
|
||||||
|
|
||||||
|
internal fun isConfiguringState(): Boolean =
|
||||||
|
this.state is ResolutionState.Configuring
|
||||||
|
|
||||||
internal fun prepare() = prepareIfNeeded(requireNotPrepared = true)
|
internal fun prepare() = prepareIfNeeded(requireNotPrepared = true)
|
||||||
|
|
||||||
internal fun installIfNeeded(
|
internal fun installIfNeeded(
|
||||||
|
|||||||
+8
-1
@@ -21,13 +21,20 @@ import org.jetbrains.kotlin.gradle.tasks.registerTask
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
open class KotlinPackageJsonTask : DefaultTask() {
|
open class KotlinPackageJsonTask : DefaultTask() {
|
||||||
|
|
||||||
|
init {
|
||||||
|
onlyIf {
|
||||||
|
nodeJs.npmResolutionManager.isConfiguringState()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private lateinit var nodeJs: NodeJsRootExtension
|
private lateinit var nodeJs: NodeJsRootExtension
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private lateinit var compilation: KotlinJsCompilation
|
private lateinit var compilation: KotlinJsCompilation
|
||||||
|
|
||||||
private val compilationResolver
|
private val compilationResolver
|
||||||
get() = nodeJs.npmResolutionManager.requireConfiguringState()[project][compilation]
|
get() = nodeJs.npmResolutionManager.resolver[project][compilation]
|
||||||
|
|
||||||
private val producer: KotlinCompilationNpmResolver.PackageJsonProducer
|
private val producer: KotlinCompilationNpmResolver.PackageJsonProducer
|
||||||
get() = compilationResolver.packageJsonProducer
|
get() = compilationResolver.packageJsonProducer
|
||||||
|
|||||||
+4
@@ -20,6 +20,10 @@ open class RootPackageJsonTask : DefaultTask() {
|
|||||||
outputs.upToDateWhen {
|
outputs.upToDateWhen {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onlyIf {
|
||||||
|
resolutionManager.isConfiguringState()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val nodeJs = NodeJsRootPlugin.apply(project.rootProject)
|
private val nodeJs = NodeJsRootPlugin.apply(project.rootProject)
|
||||||
|
|||||||
Reference in New Issue
Block a user