Gradle, npm: use state file as fake output for :kotlinNpmInstall task
This is required in case when NpmSimpleLinker works (instead of yarn). NpmSimpleLinker will not produce yarn.lock file, so :kotlinNpmInstall was always up-to-date. Adding fake state file fixes the problem. #KT-32874 Fixed
This commit is contained in:
+3
@@ -58,6 +58,9 @@ open class NodeJsRootExtension(val rootProject: Project) {
|
||||
val rootPackageDir: File
|
||||
get() = rootProject.buildDir.resolve("js")
|
||||
|
||||
internal val rootNodeModulesStateFile: File
|
||||
get() = rootPackageDir.resolve("node_modules.state")
|
||||
|
||||
val projectPackagesDir: File
|
||||
get() = rootPackageDir.resolve("packages")
|
||||
|
||||
|
||||
+2
@@ -98,6 +98,8 @@ internal class KotlinRootNpmResolver internal constructor(
|
||||
}
|
||||
}
|
||||
|
||||
nodeJs.rootNodeModulesStateFile.writeText(System.currentTimeMillis().toString())
|
||||
|
||||
upToDateChecks.forEach { it.commit() }
|
||||
|
||||
return KotlinRootNpmResolution(rootProject, projectResolutions)
|
||||
|
||||
+5
@@ -26,6 +26,11 @@ open class KotlinNpmInstallTask : DefaultTask() {
|
||||
val packageJsonFiles: Collection<File>
|
||||
get() = resolutionManager.packageJsonFiles
|
||||
|
||||
// avoid using node_modules as output directory, as it is significantly slows down build
|
||||
@get:OutputFile
|
||||
val nodeModulesState: File
|
||||
get() = nodeJs.rootNodeModulesStateFile
|
||||
|
||||
@get:OutputFile
|
||||
val yarnLock: File
|
||||
get() = nodeJs.rootPackageDir.resolve("yarn.lock")
|
||||
|
||||
Reference in New Issue
Block a user