[Gradle, JS] Remove redundant fields inside NpmDependency

This commit is contained in:
Ilya Goncharov
2023-03-06 15:29:56 +04:00
committed by Space Team
parent df50994f4f
commit 9d8e7991a8
6 changed files with 9 additions and 15 deletions
@@ -47,7 +47,7 @@ open class NodeJsRootExtension(
} }
val rootProjectDir val rootProjectDir
get() = project.projectDir get() = project.rootDir
private val gradleHome = project.gradle.gradleUserHomeDir.also { private val gradleHome = project.gradle.gradleUserHomeDir.also {
project.logger.kotlinInfo("Storing cached files in $it") project.logger.kotlinInfo("Storing cached files in $it")
@@ -38,11 +38,6 @@ data class NpmDependency(
override fun getVersion() = version override fun getVersion() = version
internal var parent: NpmDependency? = null
internal val dependencies = mutableSetOf<NpmDependency>()
internal var resolvedVersion: String? = null
internal var integrity: String? = null
override fun resolve(transitive: Boolean): Set<File> = override fun resolve(transitive: Boolean): Set<File> =
resolve() resolve()
@@ -50,7 +50,7 @@ abstract class PublicPackageJsonTask :
private val compilationResolution private val compilationResolution
get() = npmResolutionManager.get().resolution.get()[projectPath][compilationDisambiguatedName.get()] get() = npmResolutionManager.get().resolution.get()[projectPath][compilationDisambiguatedName.get()]
.getResolutionOrResolve( .getResolutionOrPrepare(
npmResolutionManager.get(), npmResolutionManager.get(),
logger logger
) )
@@ -61,7 +61,7 @@ class KotlinCompilationNpmResolution(
} }
@Synchronized @Synchronized
fun getResolutionOrResolve( fun getResolutionOrPrepare(
npmResolutionManager: KotlinNpmResolutionManager, npmResolutionManager: KotlinNpmResolutionManager,
logger: Logger, logger: Logger,
): PreparedKotlinCompilationNpmResolution { ): PreparedKotlinCompilationNpmResolution {
@@ -80,7 +80,7 @@ class KotlinCompilationNpmResolution(
): PreparedKotlinCompilationNpmResolution { ): PreparedKotlinCompilationNpmResolution {
check(!closed) { "$this already closed" } check(!closed) { "$this already closed" }
closed = true closed = true
return getResolutionOrResolve(npmResolutionManager, logger) return getResolutionOrPrepare(npmResolutionManager, logger)
} }
fun createPreparedResolution( fun createPreparedResolution(
@@ -92,7 +92,7 @@ class KotlinCompilationNpmResolution(
internalDependencies.map { internalDependencies.map {
val compilationNpmResolution: KotlinCompilationNpmResolution = rootResolver[it.projectPath][it.compilationName] val compilationNpmResolution: KotlinCompilationNpmResolution = rootResolver[it.projectPath][it.compilationName]
compilationNpmResolution.getResolutionOrResolve( compilationNpmResolution.getResolutionOrPrepare(
npmResolutionManager, npmResolutionManager,
logger logger
) )
@@ -109,7 +109,7 @@ class KotlinCompilationNpmResolver(
return _compilationNpmResolution return _compilationNpmResolution
} }
fun createAggregatedConfiguration(): Configuration { private fun createAggregatedConfiguration(): Configuration {
val all = project.configurations.create(compilation.disambiguateName("npm")) val all = project.configurations.create(compilation.disambiguateName("npm"))
all.usesPlatformOf(target) all.usesPlatformOf(target)
@@ -29,14 +29,13 @@ abstract class YarnSetupTask : DefaultTask() {
private val shouldDownload = settings.download private val shouldDownload = settings.download
@get:Inject @get:Inject
abstract internal val archiveOperations: ArchiveOperations internal abstract val archiveOperations: ArchiveOperations
@get:Inject @get:Inject
abstract internal val fileHasher: FileHasher internal abstract val fileHasher: FileHasher
@get:Inject @get:Inject
internal open val fs: FileSystemOperations internal abstract val fs: FileSystemOperations
get() = error("Should be injected")
@Suppress("MemberVisibilityCanBePrivate") @Suppress("MemberVisibilityCanBePrivate")
val downloadUrl val downloadUrl