in sources/amper-cli/src/org/jetbrains/amper/tasks/AbstractResolveJvmExternalDependenciesTask.kt [52:109]
override suspend fun run(dependenciesResult: List<TaskResult>, executionContext: TaskGraphExecutionContext): TaskResult {
val repositories = module.mavenRepositories.filter { it.resolve }.map { it.toRepository() }.distinct()
val externalUnscopedDependencies = getMavenCoordinatesToResolve()
.filter { it !is UnscopedModuleDependency }
.ifEmpty { return Result(emptyList()) }
val configuration = mapOf(
"userCacheRoot" to userCacheRoot.path.pathString,
"repositories" to repositories.joinToString("|"),
"dependencies-coordinates" to externalUnscopedDependencies.map { when(it) {
is UnscopedExternalMavenDependency -> it.coordinates
is UnscopedExternalMavenBomDependency -> "bom: ${it.coordinates}"
else -> error("Unexpected dependency type: ${it::class.qualifiedName}")
} }.joinToString("|"),
)
val resolvedExternalJars = incrementalCache.execute(
incrementalCacheKey,
configuration,
emptyList(),
) {
spanBuilder(taskName.name)
.setAmperModule(module)
.setListAttribute("dependencies-coordinates", externalUnscopedDependencies.map {
when(it) {
is UnscopedExternalMavenDependency -> it.coordinates
is UnscopedExternalMavenBomDependency -> "bom: ${it.coordinates}"
else -> error("Unexpected dependency type: ${it::class.qualifiedName}")
}
})
.use {
mavenResolver.resolveWithContext(
repositories,
ResolutionScope.RUNTIME,
ResolutionPlatform.JVM,
"$resolutionMonikerPrefix${module.userReadableName}-${Platform.JVM.pretty}",
jvmRelease = JavaVersion(module.jdkSettings.version),
) { context ->
RootDependencyNodeWithContext(
templateContext = context,
children = externalUnscopedDependencies.map {
when(it) {
is UnscopedExternalMavenDependency -> {
context.parseCoordinates(it::coordinates.traceableString(), false)
}
is UnscopedExternalMavenBomDependency -> {
context.parseCoordinates(it::coordinates.traceableString(), true)
}
else -> error("Unexpected dependency type: ${it::class.qualifiedName}")
}
},
)
}.toIncrementalCacheResult()
}
}.outputFiles
return Result(resolvedExternalJars)
}