[Gradle, JS] root package json must run after simple package jsons
KT-34832
This commit is contained in:
+1
-1
@@ -17,7 +17,7 @@ open class PackageJsonDukatTask : AbstractDukatTask() {
|
||||
|
||||
@get:Internal
|
||||
val dts by lazy {
|
||||
val resolvedCompilation = nodeJs.npmResolutionManager.installIfNeeded()[project][compilation]
|
||||
val resolvedCompilation = nodeJs.npmResolutionManager.requireInstalled()[project][compilation]
|
||||
val dtsResolver = DtsResolver(resolvedCompilation.npmProject)
|
||||
dtsResolver.getAllDts(resolvedCompilation.externalNpmDependencies)
|
||||
}
|
||||
|
||||
+6
-5
@@ -47,20 +47,21 @@ import java.io.File
|
||||
* by compilation that depends on this compilation. Note that package.json will be executed only for
|
||||
* required compilations, while other may be missed.
|
||||
*
|
||||
* **installed**. Global final state. Initiated by executing global `rootPackageJson` task.
|
||||
* **Prepared**.
|
||||
* Global final state. Initiated by executing global `rootPackageJson` task.
|
||||
*
|
||||
* **resolved**.
|
||||
* **Installed**.
|
||||
* All created package.json files will be gathered and package manager will be executed.
|
||||
* Package manager will create lock file, that will be parsed for transitive npm dependencies
|
||||
* that will be added to the root [NpmDependency] objects. `kotlinNpmInstall` task may be up-to-date.
|
||||
* In this case, installed state will be reached by first call of [prepareIfNeeded] without executing
|
||||
* In this case, installed state will be reached by first call of [installIfNeeded] without executing
|
||||
* package manager.
|
||||
*
|
||||
* Resolution will be used from [NpmDependency] by calling [getNpmDependencyResolvedCompilation].
|
||||
* Also resolution will be checked before calling [NpmProject.require] and executing any task
|
||||
* that requires npm dependencies or node_modules.
|
||||
*
|
||||
* User can call [requirePrepared] to get resolution info.
|
||||
* User can call [requireInstalled] to get resolution info.
|
||||
*
|
||||
* ## Resolving process during Idea import
|
||||
*
|
||||
@@ -115,7 +116,7 @@ class KotlinNpmResolutionManager(private val nodeJsSettings: NodeJsRootExtension
|
||||
}
|
||||
|
||||
@Incubating
|
||||
internal fun requirePrepared() = prepareIfNeeded(requireUpToDateReason = "")
|
||||
internal fun requireInstalled() = installIfNeeded(reason = "")
|
||||
|
||||
internal fun requireConfiguringState(): KotlinRootNpmResolver =
|
||||
(this.state as? ResolutionState.Configuring ?: error("NPM Dependencies already resolved and installed")).resolver
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ open class KotlinPackageJsonTask : DefaultTask() {
|
||||
task.inputs.file(packageJsonTask.map { it.packageJson })
|
||||
}
|
||||
|
||||
npmInstallTask.mustRunAfter(packageJsonTask)
|
||||
nodeJs.rootPackageJsonTask.mustRunAfter(packageJsonTask)
|
||||
|
||||
compilation.compileKotlinTask.dependsOn(
|
||||
npmInstallTask,
|
||||
|
||||
-3
@@ -10,7 +10,6 @@ import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.BasePlugin
|
||||
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
|
||||
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask
|
||||
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinPackageJsonTask
|
||||
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.RootPackageJsonTask
|
||||
import org.jetbrains.kotlin.gradle.tasks.CleanDataTask
|
||||
|
||||
@@ -34,8 +33,6 @@ open class YarnPlugin : Plugin<Project> {
|
||||
task.description = "Create root package.json"
|
||||
|
||||
task.mustRunAfter(rootClean)
|
||||
|
||||
task.mustRunAfter(tasks.withType(KotlinPackageJsonTask::class.java))
|
||||
}
|
||||
|
||||
tasks.named(KotlinNpmInstallTask.NAME).configure {
|
||||
|
||||
Reference in New Issue
Block a user