[JS] Implementation dependencies for JS klibs

^KT-56158 fixed
This commit is contained in:
Ilya Goncharov
2023-01-27 13:31:59 +00:00
committed by Space Team
parent ca0b3ffa78
commit 1150ec6882
22 changed files with 128 additions and 72 deletions
@@ -18,7 +18,22 @@ interface KotlinLibraryResolver<L: KotlinLibrary> {
noStdLib: Boolean = false,
noDefaultLibs: Boolean = false,
noEndorsedLibs: Boolean = false
): KotlinLibraryResolveResult
): KotlinLibraryResolveResult =
resolveWithoutDependencies(
unresolvedLibraries,
noStdLib,
noDefaultLibs,
noEndorsedLibs
).resolveDependencies()
fun resolveWithoutDependencies(
unresolvedLibraries: List<UnresolvedLibrary>,
noStdLib: Boolean = false,
noDefaultLibs: Boolean = false,
noEndorsedLibs: Boolean = false
): List<KotlinLibrary>
fun List<KotlinLibrary>.resolveDependencies(): KotlinLibraryResolveResult
}
interface KotlinLibraryResolveResult {
@@ -32,16 +32,14 @@ class KotlinLibraryResolverImpl<L: KotlinLibrary> internal constructor(
override val searchPathResolver: SearchPathResolver<L>,
val resolveManifestDependenciesLenient: Boolean
): KotlinLibraryResolver<L>, WithLogger by searchPathResolver {
override fun resolveWithDependencies(
override fun resolveWithoutDependencies(
unresolvedLibraries: List<UnresolvedLibrary>,
noStdLib: Boolean,
noDefaultLibs: Boolean,
noEndorsedLibs: Boolean
) = findLibraries(unresolvedLibraries, noStdLib, noDefaultLibs, noEndorsedLibs)
.leaveDistinct()
.omitDuplicateNames()
.resolveDependencies()
.leaveDistinct()
.omitDuplicateNames()
/**
* Returns the list of libraries based on [libraryNames], [noStdLib], [noDefaultLibs] and [noEndorsedLibs] criteria.
@@ -102,7 +100,7 @@ class KotlinLibraryResolverImpl<L: KotlinLibrary> internal constructor(
* 2. Wraps each [KotlinLibrary] into a [KotlinResolvedLibrary] with information about dependencies on other libraries.
* 3. Creates resulting [KotlinLibraryResolveResult] object.
*/
private fun List<KotlinLibrary>.resolveDependencies(): KotlinLibraryResolveResult {
override fun List<KotlinLibrary>.resolveDependencies(): KotlinLibraryResolveResult {
val rootLibraries = this.map { KotlinResolvedLibraryImpl(it) }