[Gradle, JS] Force full configuring of NPM tasks in idea import

This commit is contained in:
Ilya Goncharov
2020-06-09 19:07:42 +03:00
parent aab4fd7225
commit 1f5012684b
2 changed files with 7 additions and 3 deletions
@@ -108,7 +108,11 @@ internal class KotlinCompilationNpmResolver(
fun getResolutionOrResolveIfForced(): KotlinCompilationNpmResolution? {
if (resolution != null) return resolution
if (packageJsonTaskHolder.get().state.upToDate) return resolve(skipWriting = true)
if (resolver.forceFullResolve && resolution == null) return resolve()
if (resolver.forceFullResolve && resolution == null) {
// need to force all NPM tasks to be configured in IDEA import
project.tasks.implementing(RequiresNpmDependencies::class).all {}
return resolve()
}
return null
}
@@ -284,7 +288,7 @@ internal class KotlinCompilationNpmResolver(
internalDependencies.map { it.npmProject.name },
internalCompositeDependencies.flatMap { it.getPackages() },
externalGradleDependencies.map { it.artifact.file },
externalNpmDependencies.map { "${it.scope} ${it.key}:${it.version}" }
externalNpmDependencies.map { it.uniqueRepresentation() }
)
fun createPackageJson(skipWriting: Boolean): KotlinCompilationNpmResolution {
@@ -121,6 +121,6 @@ internal class KotlinProjectNpmResolver(
*
* TODO properly express within the type system? The result should be a TaskCollection<T & R>
*/
private fun <T : Task, R : Any> TaskCollection<T>.implementing(kclass: KClass<R>): TaskCollection<T> =
internal fun <T : Task, R : Any> TaskCollection<T>.implementing(kclass: KClass<R>): TaskCollection<T> =
@Suppress("UNCHECKED_CAST")
withType(kclass.java as Class<T>)