Skip to content

Commit

Permalink
Ydoc library (#11615)
Browse files Browse the repository at this point in the history
`ydoc-server` compilation requires generation of `ydoc.cjs` resource that can take time and slow down the libraries development (building the enso distribution). This PR splits Ydoc into a library and the server part to avoid JS resources generation during the compilation of the language server.

Changelog:
- refactor: Ydoc into ~~`ydoc`~~ `ydoc-polyglot` library and  `ydoc-server` server parts
- update: language server to depend on the ~~`ydoc`~~ `ydoc-polyglot` library
  • Loading branch information
4e6 authored Nov 25, 2024
1 parent b5f93f0 commit 3d6ca03
Show file tree
Hide file tree
Showing 79 changed files with 137 additions and 676 deletions.
81 changes: 59 additions & 22 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ lazy val enso = (project in file("."))
`test-utils`,
`text-buffer`,
`version-output`,
`ydoc-polyfill`,
`ydoc-server`,
`zio-wrapper`
)
Expand Down Expand Up @@ -649,7 +650,7 @@ lazy val componentModulesIds =
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion,
(`runtime-language-arrow` / projectID).value,
(`syntax-rust-definition` / projectID).value,
(`ydoc-server` / projectID).value,
(`ydoc-polyfill` / projectID).value,
(`profiling-utils` / projectID).value
)
}
Expand Down Expand Up @@ -738,7 +739,7 @@ lazy val componentModulesPaths =
(`language-server-deps-wrapper` / Compile / exportedModuleBin).value,
(`directory-watcher-wrapper` / Compile / exportedModuleBin).value,
(`jna-wrapper` / Compile / exportedModuleBin).value,
(`ydoc-server` / Compile / exportedModuleBin).value,
(`ydoc-polyfill` / Compile / exportedModuleBin).value,
(`library-manager` / Compile / exportedModuleBin).value,
(`logging-config` / Compile / exportedModuleBin).value,
(`logging-utils` / Compile / exportedModuleBin).value,
Expand Down Expand Up @@ -1724,7 +1725,7 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager"))
Test / addModules := Seq(
(`syntax-rust-definition` / javaModuleName).value,
(`profiling-utils` / javaModuleName).value,
(`ydoc-server` / javaModuleName).value
(`ydoc-polyfill` / javaModuleName).value
),
Test / moduleDependencies := {
GraalVM.modules ++ GraalVM.langsPkgs ++ logbackPkg ++ helidon ++ Seq(
Expand All @@ -1735,7 +1736,7 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager"))
Test / internalModuleDependencies := Seq(
(`profiling-utils` / Compile / exportedModule).value,
(`syntax-rust-definition` / Compile / exportedModule).value,
(`ydoc-server` / Compile / exportedModule).value
(`ydoc-polyfill` / Compile / exportedModule).value
),
Test / javaOptions ++= testLogProviderOptions,
Test / test := (Test / test).dependsOn(buildEngineDistribution).value
Expand Down Expand Up @@ -1783,7 +1784,7 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager"))
.dependsOn(testkit % Test)
.dependsOn(`runtime-version-manager-test` % Test)
.dependsOn(`logging-service-logback` % "test->test")
.dependsOn(`ydoc-server` % Test)
.dependsOn(`ydoc-polyfill` % Test)
.dependsOn(`profiling-utils` % Test)

lazy val `json-rpc-server` = project
Expand Down Expand Up @@ -1885,13 +1886,49 @@ lazy val searcher = project
.dependsOn(testkit % Test)
.dependsOn(`polyglot-api`)

lazy val `ydoc-polyfill` = project
.in(file("lib/java/ydoc-polyfill"))
.enablePlugins(JPMSPlugin)
.configs(Test)
.settings(
customFrgaalJavaCompilerSettings("21"),
javaModuleName := "org.enso.ydoc.polyfill",
Compile / exportJars := true,
crossPaths := false,
autoScalaLibrary := false,
Test / fork := true,
commands += WithDebugCommand.withDebug,
Compile / moduleDependencies ++= {
GraalVM.modules ++ GraalVM.jsPkgs ++ GraalVM.chromeInspectorPkgs ++ helidon ++ Seq(
"org.slf4j" % "slf4j-api" % slf4jVersion
)
},
Compile / internalModuleDependencies := Seq(
(`syntax-rust-definition` / Compile / exportedModule).value
),
libraryDependencies ++= Seq(
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided",
"org.graalvm.polyglot" % "inspect-community" % graalMavenPackagesVersion % "runtime",
"org.graalvm.polyglot" % "js-community" % graalMavenPackagesVersion % "runtime",
"org.slf4j" % "slf4j-api" % slf4jVersion,
"io.helidon.webclient" % "helidon-webclient-websocket" % helidonVersion,
"io.helidon.webserver" % "helidon-webserver-websocket" % helidonVersion,
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test
),
libraryDependencies ++= {
GraalVM.modules ++ GraalVM.jsPkgs ++ GraalVM.chromeInspectorPkgs ++ helidon
}
)
.dependsOn(`syntax-rust-definition`)

lazy val `ydoc-server` = project
.in(file("lib/java/ydoc-server"))
.enablePlugins(JPMSPlugin)
.configs(Test)
.settings(
customFrgaalJavaCompilerSettings("21"),
javaModuleName := "org.enso.ydoc",
javaModuleName := "org.enso.ydoc.server",
Compile / exportJars := true,
crossPaths := false,
autoScalaLibrary := false,
Expand All @@ -1903,17 +1940,18 @@ lazy val `ydoc-server` = project
)
},
Compile / internalModuleDependencies := Seq(
(`syntax-rust-definition` / Compile / exportedModule).value,
(`profiling-utils` / Compile / exportedModule).value
(`ydoc-polyfill` / Compile / exportedModule).value,
(`syntax-rust-definition` / Compile / exportedModule).value
),
libraryDependencies ++= Seq(
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided",
"org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion % "provided",
"org.graalvm.polyglot" % "inspect-community" % graalMavenPackagesVersion % "runtime",
"org.graalvm.polyglot" % "js-community" % graalMavenPackagesVersion % "runtime",
"org.slf4j" % "slf4j-api" % slf4jVersion,
"io.helidon.webclient" % "helidon-webclient-websocket" % helidonVersion,
"io.helidon.webserver" % "helidon-webserver-websocket" % helidonVersion,
"io.helidon.common" % "helidon-common" % helidonVersion,
"io.helidon.webclient" % "helidon-webclient-websocket" % helidonVersion % Test,
"io.helidon.webserver" % "helidon-webserver-websocket" % helidonVersion % Test,
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion % Test
Expand All @@ -1936,8 +1974,7 @@ lazy val `ydoc-server` = project
// would result in an sbt caught in an infinite recursion.
//
Compile / run / javaOptions ++= {
val mp =
(Compile / modulePath).value ++ (`profiling-utils` / Compile / modulePath).value
val mp = (Compile / modulePath).value
val jar = (Compile / exportedProductJars).value.head
val modName = javaModuleName.value
val allMp = mp ++ Seq(jar.data.absolutePath)
Expand Down Expand Up @@ -1969,7 +2006,7 @@ lazy val `ydoc-server` = project
.buildNativeImage(
"ydoc",
staticOnLinux = false,
mainClass = Some("org.enso.ydoc.Main")
mainClass = Some("org.enso.ydoc.server.Main")
)
.value,
buildNativeImage := NativeImage
Expand All @@ -1979,7 +2016,7 @@ lazy val `ydoc-server` = project
)
.value
)
.dependsOn(`syntax-rust-definition`)
.dependsOn(`ydoc-polyfill`)
.dependsOn(`logging-service-logback`)

lazy val `persistance` = (project in file("lib/java/persistance"))
Expand Down Expand Up @@ -2257,7 +2294,7 @@ lazy val `language-server` = (project in file("engine/language-server"))
(`language-server-deps-wrapper` / Compile / exportedModule).value,
(`directory-watcher-wrapper` / Compile / exportedModule).value,
(`engine-runner-common` / Compile / exportedModule).value,
(`ydoc-server` / Compile / exportedModule).value,
(`ydoc-polyfill` / Compile / exportedModule).value,
(`logging-utils` / Compile / exportedModule).value,
(`logging-utils-akka` / Compile / exportedModule).value,
(`logging-service` / Compile / exportedModule).value,
Expand Down Expand Up @@ -2342,7 +2379,7 @@ lazy val `language-server` = (project in file("engine/language-server"))
(`runtime-instrument-repl-debugger` / Compile / exportedModule).value,
(`runtime-instrument-id-execution` / Compile / exportedModule).value,
(`runtime-language-epb` / Compile / exportedModule).value,
(`ydoc-server` / Compile / exportedModule).value,
(`ydoc-polyfill` / Compile / exportedModule).value,
(`syntax-rust-definition` / Compile / exportedModule).value,
(`profiling-utils` / Compile / exportedModule).value,
(`logging-service-logback` / Compile / exportedModule).value,
Expand Down Expand Up @@ -2394,7 +2431,7 @@ lazy val `language-server` = (project in file("engine/language-server"))
javaModuleName.value,
(`syntax-rust-definition` / javaModuleName).value,
(`profiling-utils` / javaModuleName).value,
(`ydoc-server` / javaModuleName).value,
(`ydoc-polyfill` / javaModuleName).value,
(`library-manager` / javaModuleName).value
),
Test / addReads := {
Expand Down Expand Up @@ -2449,7 +2486,7 @@ lazy val `language-server` = (project in file("engine/language-server"))
.dependsOn(`logging-service-logback` % "test->test")
.dependsOn(`library-manager-test` % Test)
.dependsOn(`runtime-version-manager-test` % Test)
.dependsOn(`ydoc-server`)
.dependsOn(`ydoc-polyfill`)

lazy val cleanInstruments = taskKey[Unit](
"Cleans fragile class files to force a full recompilation and preserve" +
Expand Down Expand Up @@ -2866,7 +2903,7 @@ lazy val `runtime-integration-tests` =
(`runtime-instrument-repl-debugger` / Compile / exportedModule).value,
(`runtime-instrument-id-execution` / Compile / exportedModule).value,
(`runtime-language-epb` / Compile / exportedModule).value,
(`ydoc-server` / Compile / exportedModule).value,
(`ydoc-polyfill` / Compile / exportedModule).value,
(`syntax-rust-definition` / Compile / exportedModule).value,
(`profiling-utils` / Compile / exportedModule).value,
(`logging-service-logback` / Compile / exportedModule).value,
Expand Down Expand Up @@ -2916,7 +2953,7 @@ lazy val `runtime-integration-tests` =
"scala.library",
(`runtime` / javaModuleName).value,
(`runtime-test-instruments` / javaModuleName).value,
(`ydoc-server` / javaModuleName).value,
(`ydoc-polyfill` / javaModuleName).value,
(`runtime-instrument-common` / javaModuleName).value,
(`text-buffer` / javaModuleName).value,
(`logging-service-logback` / Test / javaModuleName).value,
Expand Down Expand Up @@ -3031,7 +3068,7 @@ lazy val `runtime-benchmarks` =
(`runtime-instrument-id-execution` / Compile / exportedModule).value,
(`runtime-language-epb` / Compile / exportedModule).value,
(`runtime-language-arrow` / Compile / exportedModule).value,
(`ydoc-server` / Compile / exportedModule).value,
(`ydoc-polyfill` / Compile / exportedModule).value,
(`benchmarks-common` / Compile / exportedModule).value,
(`syntax-rust-definition` / Compile / exportedModule).value,
(`profiling-utils` / Compile / exportedModule).value,
Expand Down Expand Up @@ -4049,7 +4086,7 @@ lazy val `std-benchmarks` = (project in file("std-bits/benchmarks"))
}.evaluated
)
.dependsOn(`bench-processor`)
.dependsOn(`ydoc-server`)
.dependsOn(`ydoc-polyfill`)
.dependsOn(`runtime-language-arrow`)
.dependsOn(`syntax-rust-definition`)
.dependsOn(`profiling-utils`)
Expand Down
20 changes: 0 additions & 20 deletions distribution/engine/THIRD-PARTY/NOTICE
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
Enso
Copyright 2020 - 2024 New Byte Order sp. z o. o.

'logback-classic', licensed under the GNU Lesser General Public License, is distributed with the engine.
The license file can be found at `licenses/GNU_Lesser_General_Public_License`.
Copyright notices related to this dependency can be found in the directory `ch.qos.logback.logback-classic-1.3.7`.


'logback-core', licensed under the GNU Lesser General Public License, is distributed with the engine.
The license file can be found at `licenses/GNU_Lesser_General_Public_License`.
Copyright notices related to this dependency can be found in the directory `ch.qos.logback.logback-core-1.3.7`.


'shapeless_2.13', licensed under the Apache 2, is distributed with the engine.
The license file can be found at `licenses/APACHE2.0`.
Copyright notices related to this dependency can be found in the directory `com.chuusai.shapeless_2.13-2.3.10`.
Expand Down Expand Up @@ -371,16 +361,6 @@ The license file can be found at `licenses/APACHE2.0`.
Copyright notices related to this dependency can be found in the directory `io.methvin.directory-watcher-0.18.0`.


'sentry', licensed under the MIT, is distributed with the engine.
The license file can be found at `licenses/MIT`.
Copyright notices related to this dependency can be found in the directory `io.sentry.sentry-6.28.0`.


'sentry-logback', licensed under the MIT, is distributed with the engine.
The license file can be found at `licenses/MIT`.
Copyright notices related to this dependency can be found in the directory `io.sentry.sentry-logback-6.28.0`.


'jakarta.inject-api', licensed under the The Apache Software License, Version 2.0, is distributed with the engine.
The license file can be found at `licenses/APACHE2.0`.
Copyright notices related to this dependency can be found in the directory `jakarta.inject.jakarta.inject-api-2.0.1`.
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 3d6ca03

Please sign in to comment.