@@ -68,12 +68,6 @@ import org.ossreviewtoolkit.utils.ort.ortDataDirectory
68
68
import org.semver4j.RangesList
69
69
import org.semver4j.RangesListFactory
70
70
71
- private val yarnInfoCache = DiskCache (
72
- directory = ortDataDirectory.resolve(" cache/analyzer/yarn/info" ),
73
- maxCacheSizeInBytes = 100 .mebibytes,
74
- maxCacheEntryAgeInSeconds = 7 .days.inWholeSeconds
75
- )
76
-
77
71
/* * Name of the scope with the regular dependencies. */
78
72
private const val DEPENDENCIES_SCOPE = " dependencies"
79
73
@@ -102,6 +96,7 @@ open class Yarn(override val descriptor: PluginDescriptor = YarnFactory.descript
102
96
override val globsForDefinitionFiles = listOf (NodePackageManagerType .DEFINITION_FILE )
103
97
104
98
private lateinit var stash: DirectoryStash
99
+ private lateinit var yarnInfoCache: DiskCache
105
100
106
101
/* * Cache for submodules identified by its moduleDir absolutePath */
107
102
private val submodulesCache = ConcurrentHashMap <String , Set <File >>()
@@ -135,12 +130,19 @@ open class Yarn(override val descriptor: PluginDescriptor = YarnFactory.descript
135
130
) {
136
131
YarnCommand .checkVersion()
137
132
133
+ yarnInfoCache = DiskCache (
134
+ directory = ortDataDirectory.resolve(" cache/analyzer/yarn/info" ),
135
+ maxCacheSizeInBytes = 100 .mebibytes,
136
+ maxCacheEntryAgeInSeconds = 7 .days.inWholeSeconds
137
+ )
138
+
138
139
val directories = definitionFiles.mapTo(mutableSetOf ()) { it.resolveSibling(" node_modules" ) }
139
140
stash = DirectoryStash (directories)
140
141
}
141
142
142
143
override fun afterResolution (analysisRoot : File , definitionFiles : List <File >) {
143
144
stash.close()
145
+ yarnInfoCache.close()
144
146
}
145
147
146
148
override fun resolveDependencies (
0 commit comments