mirror of
https://github.com/enso-org/enso.git
synced 2024-11-22 22:10:15 +03:00
Disable UpdatingEditionProvider when running Enso CLI (#10408)
This commit is contained in:
parent
48fb999eb3
commit
5e3a5b7751
@ -158,7 +158,11 @@ class MainModule(serverConfig: LanguageServerConfig, logLevel: Level) {
|
||||
val distributionManager = new DistributionManager(environment)
|
||||
|
||||
val editionProvider =
|
||||
EditionManager.makeEditionProvider(distributionManager, Some(languageHome))
|
||||
EditionManager.makeEditionProvider(
|
||||
distributionManager,
|
||||
Some(languageHome),
|
||||
false
|
||||
)
|
||||
val editionResolver = EditionResolver(editionProvider)
|
||||
val editionReferenceResolver = new EditionReferenceResolver(
|
||||
contentRoot.file,
|
||||
|
@ -347,7 +347,8 @@ abstract class BaseServerTest
|
||||
val editionProvider =
|
||||
EditionManager.makeEditionProvider(
|
||||
distributionManager,
|
||||
Some(languageHome)
|
||||
Some(languageHome),
|
||||
true
|
||||
)
|
||||
val editionResolver = EditionResolver(editionProvider)
|
||||
val editionReferenceResolver = new EditionReferenceResolver(
|
||||
|
@ -43,7 +43,8 @@ object DependencyPreinstaller {
|
||||
|
||||
val editionProvider = EditionManager.makeEditionProvider(
|
||||
distributionManager,
|
||||
Some(languageHome)
|
||||
Some(languageHome),
|
||||
true
|
||||
)
|
||||
val editionResolver = EditionResolver(editionProvider)
|
||||
val edition = editionResolver
|
||||
|
@ -10,7 +10,9 @@ import java.nio.file.Path
|
||||
import scala.util.Try
|
||||
|
||||
/** A helper class for resolving editions. */
|
||||
class EditionManager private (editionProvider: UpdatingEditionProvider) {
|
||||
class EditionManager private (
|
||||
editionProvider: editions.provider.EditionProvider
|
||||
) {
|
||||
private val editionResolver = EditionResolver(editionProvider)
|
||||
private val engineVersionResolver =
|
||||
editions.EngineVersionResolver(editionProvider)
|
||||
@ -46,18 +48,26 @@ class EditionManager private (editionProvider: UpdatingEditionProvider) {
|
||||
object EditionManager {
|
||||
|
||||
/** Create an [[EditionProvider]] that can locate editions from the
|
||||
* distribution and the language home.
|
||||
* distribution (if updating) and the language home.
|
||||
*/
|
||||
def makeEditionProvider(
|
||||
final def makeEditionProvider(
|
||||
distributionManager: DistributionManager,
|
||||
languageHome: Option[LanguageHome]
|
||||
): UpdatingEditionProvider = {
|
||||
val config = new GlobalConfigurationManager(distributionManager).getConfig
|
||||
new UpdatingEditionProvider(
|
||||
getSearchPaths(distributionManager, languageHome),
|
||||
distributionManager.paths.cachedEditions,
|
||||
config.editionProviders
|
||||
)
|
||||
languageHome: Option[LanguageHome],
|
||||
updating: Boolean
|
||||
): editions.provider.EditionProvider = {
|
||||
val config = new GlobalConfigurationManager(distributionManager).getConfig
|
||||
val searchPaths = getSearchPaths(distributionManager, languageHome)
|
||||
val cachePath = distributionManager.paths.cachedEditions
|
||||
if (updating) {
|
||||
new UpdatingEditionProvider(
|
||||
searchPaths,
|
||||
cachePath,
|
||||
config.editionProviders
|
||||
)
|
||||
} else {
|
||||
val actualSearchPaths = (searchPaths ++ List(cachePath)).distinct
|
||||
new editions.provider.FileSystemEditionProvider(actualSearchPaths)
|
||||
}
|
||||
}
|
||||
|
||||
/** Get search paths associated with the distribution and language home. */
|
||||
@ -77,6 +87,6 @@ object EditionManager {
|
||||
distributionManager: DistributionManager,
|
||||
languageHome: Option[LanguageHome] = None
|
||||
): EditionManager = new EditionManager(
|
||||
makeEditionProvider(distributionManager, languageHome)
|
||||
makeEditionProvider(distributionManager, languageHome, false)
|
||||
)
|
||||
}
|
||||
|
@ -38,12 +38,8 @@ class UpdatingEditionProvider(
|
||||
case Right(value) => Right(value)
|
||||
}
|
||||
|
||||
/** Finds all editions available on the [[searchPaths]]. */
|
||||
override def findAvailableEditions(): Seq[String] =
|
||||
provider.findAvailableEditions()
|
||||
|
||||
/** Finds all available editions, performing an update if asked to. */
|
||||
def findAvailableEditions(update: Boolean): Seq[String] = {
|
||||
override def findAvailableEditions(update: Boolean): Seq[String] = {
|
||||
if (update) {
|
||||
updater.updateEditions()
|
||||
}
|
||||
|
@ -15,5 +15,5 @@ trait EditionProvider {
|
||||
): Either[EditionLoadingError, Editions.Raw.Edition]
|
||||
|
||||
/** Finds all editions that are currently available. */
|
||||
def findAvailableEditions(): Seq[String]
|
||||
def findAvailableEditions(update: Boolean = false): Seq[String]
|
||||
}
|
||||
|
@ -51,7 +51,9 @@ class FileSystemEditionProvider(searchPaths: List[Path])
|
||||
}
|
||||
|
||||
/** Finds all editions available on the [[searchPaths]]. */
|
||||
override def findAvailableEditions(): Seq[String] =
|
||||
override def findAvailableEditions(
|
||||
ignoreUpdateRequest: Boolean
|
||||
): Seq[String] =
|
||||
searchPaths.flatMap(findEditionsAt).distinct
|
||||
|
||||
private def findEditionName(path: Path): Option[String] =
|
||||
|
@ -54,7 +54,8 @@ class EditionResolverSpec
|
||||
): Either[EditionLoadingError, Editions.Raw.Edition] =
|
||||
editions.get(name).toRight(EditionNotFound(name))
|
||||
|
||||
override def findAvailableEditions(): Seq[String] = editions.keys.toSeq
|
||||
override def findAvailableEditions(update: Boolean): Seq[String] =
|
||||
editions.keys.toSeq
|
||||
}
|
||||
|
||||
val resolver = EditionResolver(FakeEditionProvider)
|
||||
|
Loading…
Reference in New Issue
Block a user