-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change layout of local library search path in order to be able to mov…
…e `Round_Spec.enso` back to `Tests` (#7634) - Closes #7633 - Moves `Round_Spec.enso` from published `Standard.Test` into our `test/Tests` project; the `Table_Tests` that depend on it, simply `import enso_dev.Tests`. - Changes the layout of the local libraries directory: - It used to be `root/<namespace>/<name>`. - Now it is `root/<dir>` - the namespace and name are now read from `package.yaml` instead. - Adds the parent directory of the current project to the default `ENSO_LIBRARY_PATH`. - It is treated as a secondary path, so the default `ENSO_HOME/lib` still takes precedence. - This allows projects to reference and load 'sibling' projects easily - the only requirement is for the project to enable `prefer-local-libraries: true` or add the other local project to its edition. The edition resolution logic is **not changed**.
- Loading branch information
Showing
34 changed files
with
428 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...age-server/src/test/scala/org/enso/languageserver/libraries/LocalLibraryManagerSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package org.enso.languageserver.libraries | ||
|
||
import akka.actor.ActorSystem | ||
import akka.testkit._ | ||
import org.enso.distribution.FileSystem.PathSyntax | ||
import org.enso.editions.LibraryName | ||
import org.enso.librarymanager.LibraryLocations | ||
import org.enso.pkg.PackageManager | ||
import org.enso.testkit.WithTemporaryDirectory | ||
import org.scalatest.matchers.should.Matchers | ||
import org.scalatest.wordspec.AnyWordSpecLike | ||
import org.scalatest.BeforeAndAfterAll | ||
import org.scalatest.time.SpanSugar.convertIntToGrainOfTime | ||
|
||
import scala.concurrent.duration.FiniteDuration | ||
|
||
class LocalLibraryManagerSpec | ||
extends TestKit(ActorSystem("TestSystem")) | ||
with ImplicitSender | ||
with AnyWordSpecLike | ||
with Matchers | ||
with BeforeAndAfterAll | ||
with WithTemporaryDirectory { | ||
|
||
val Timeout: FiniteDuration = 10.seconds | ||
|
||
override def afterAll(): Unit = { | ||
TestKit.shutdownActorSystem(system) | ||
} | ||
|
||
"LocalLibraryManager" should { | ||
"find the libraries it has itself created" in { | ||
val projectRoot = getTestDirectory / "project-root" | ||
PackageManager.Default.create(projectRoot.toFile, "Test_Project_123") | ||
val localLibraryRoot = getTestDirectory / "local-library-root" | ||
val libraryLocations = LibraryLocations( | ||
List(localLibraryRoot), | ||
getTestDirectory / "library-cache-root", | ||
List() | ||
) | ||
val manager = | ||
system.actorOf( | ||
LocalLibraryManager.props(projectRoot.toFile, libraryLocations) | ||
) | ||
|
||
val myLibraryName = LibraryName("user456", "My_Library") | ||
|
||
manager ! LocalLibraryManagerProtocol.Create( | ||
myLibraryName, | ||
Seq(), | ||
Seq(), | ||
"CC0" | ||
) | ||
expectMsg(Timeout, LocalLibraryManagerProtocol.EmptyResponse()) | ||
|
||
manager ! LocalLibraryManagerProtocol.FindLibrary(myLibraryName) | ||
expectMsgPF(Timeout, "FindLibraryResponse") { | ||
case LocalLibraryManagerProtocol.FindLibraryResponse(Some(root)) => | ||
assert(root.location.startsWith(localLibraryRoot)) | ||
} | ||
|
||
manager ! LocalLibraryManagerProtocol.ListLocalLibraries | ||
val foundLibraries = expectMsgPF(Timeout, "ListLocalLibrariesResponse") { | ||
case LocalLibraryManagerProtocol.ListLocalLibrariesResponse( | ||
libraries | ||
) => | ||
libraries | ||
} | ||
foundLibraries.map(entry => | ||
LibraryName(entry.namespace, entry.name) | ||
) should contain theSameElementsAs Seq(myLibraryName) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.