[Gradle, JS] Do not use project on execution phase

This commit is contained in:
Ilya Goncharov
2024-01-30 10:38:09 +00:00
committed by Space Team
parent 42e8245007
commit 0350533189
2 changed files with 18 additions and 22 deletions
@@ -68,17 +68,15 @@ abstract class KotlinNpmInstallTask :
@get:IgnoreEmptyDirectories
@get:NormalizeLineEndings
@get:InputFiles
val packageJsonFiles: FileCollection = project.objects.fileCollection().from(
{
rootResolver.projectResolvers.values
.flatMap { it.compilationResolvers }
.map { it.compilationNpmResolution }
.map { resolution ->
val name = resolution.npmProjectName
packagesDir.map { it.dir(name).file(NpmProject.PACKAGE_JSON) }
}
}
)
val packageJsonFiles: List<RegularFile> by lazy {
rootResolver.projectResolvers.values
.flatMap { it.compilationResolvers }
.map { it.compilationNpmResolution }
.map { resolution ->
val name = resolution.npmProjectName
packagesDir.map { it.dir(name).file(NpmProject.PACKAGE_JSON) }.get()
}
}
@get:OutputFiles
val additionalFiles: FileCollection by lazy {
@@ -68,17 +68,15 @@ abstract class RootPackageJsonTask :
@get:IgnoreEmptyDirectories
@get:NormalizeLineEndings
@get:InputFiles
val packageJsonFiles: FileCollection = project.objects.fileCollection().from(
{
rootResolver.projectResolvers.values
.flatMap { it.compilationResolvers }
.map { it.compilationNpmResolution }
.map { resolution ->
val name = resolution.npmProjectName
packagesDir.map { it.dir(name).file(NpmProject.PACKAGE_JSON) }
}
}
)
val packageJsonFiles: List<RegularFile> by lazy {
rootResolver.projectResolvers.values
.flatMap { it.compilationResolvers }
.map { it.compilationNpmResolution }
.map { resolution ->
val name = resolution.npmProjectName
packagesDir.map { it.dir(name).file(NpmProject.PACKAGE_JSON) }.get()
}
}
@TaskAction
fun resolve() {