@@ -15,7 +15,7 @@ interface LibraryResolver {
15
15
16
16
abstract class LibraryDescriptorResolver (private val parent : LibraryResolver ? = null ) : LibraryResolver {
17
17
protected abstract fun tryResolve (reference : LibraryReference ): LibraryDefinition ?
18
- protected abstract fun save (reference : LibraryReference , descriptor : LibraryDefinition )
18
+ protected abstract fun save (reference : LibraryReference , definition : LibraryDefinition )
19
19
protected open fun shouldResolve (reference : LibraryReference ): Boolean = true
20
20
21
21
open val cache: Map <LibraryReference , LibraryDefinition >? = null
@@ -29,7 +29,7 @@ abstract class LibraryDescriptorResolver(private val parent: LibraryResolver? =
29
29
30
30
return processDescriptor(result, mapping)
31
31
}
32
- return result
32
+ if (result != null ) return result
33
33
}
34
34
35
35
val parentResult = parent?.resolve(reference, vars) ? : return null
@@ -92,7 +92,7 @@ class FallbackLibraryResolver : LibraryDescriptorResolver() {
92
92
return reference.resolve()
93
93
}
94
94
95
- override fun save (reference : LibraryReference , descriptor : LibraryDefinition ) {
95
+ override fun save (reference : LibraryReference , definition : LibraryDefinition ) {
96
96
// fallback resolver doesn't cache results
97
97
}
98
98
}
@@ -134,14 +134,14 @@ class LocalLibraryResolver(
134
134
return parseLibraryDescriptor(json)
135
135
}
136
136
137
- override fun save (reference : LibraryReference , library : LibraryDefinition ) {
138
- if (library !is LibraryDescriptor ) return
137
+ override fun save (reference : LibraryReference , definition : LibraryDefinition ) {
138
+ if (definition !is LibraryDescriptor ) return
139
139
val dir = pathsToCheck.first()
140
140
val file = reference.getFile(dir)
141
141
file.parentFile.mkdirs()
142
142
143
143
val format = Json { prettyPrint = true }
144
- file.writeText(format.encodeToString(library ))
144
+ file.writeText(format.encodeToString(definition ))
145
145
}
146
146
147
147
private fun LibraryReference.getFile (dir : String ) = Paths .get(dir, this .key + " ." + LibraryDescriptorExt ).toFile()
0 commit comments